Why do some ufs i-node fields have 2 copies?

Rick Macklem rmacklem at uoguelph.ca
Mon Apr 27 14:51:46 UTC 2009



On Mon, 27 Apr 2009, Rick C. Petty wrote:

[good stuff snipped]
>> If my interpretation of your answer is correct, I'd say that a "shadow
>> copy" doesn't really add anything to the code? What do others think?
>
> It adds plenty-- you don't have to dereference more than the inode pointer.
> If you don't use the shadows, you have to dereference the superblock (i_fs)
> to get the UFS version as well as dereference the dinode itself.  It
> doesn't make sense to change all the macros to not use the shadows.
>
Oops, poorly expressed. What I meant to say was "doesn't really add anything to
the line of code I listed in the original message":

 	DIP_SET(ip, i_modrev, DIP(ip, i_modrev) + 1);

since that is the only time i_modrev is manipulated. (I didn't mean "doesn't
add anything to the code, in general".)

If I were to add a "shadow copy" of i_modrev, the line would become:

 	ip->i_modrev++;
 	DIP_SET(ip, i_modrev, ip->i_modrev);

and then
 	ip->i_modrev = ip->i_din1->di_modrev;
and
 	ip->i_modrev = ip->i_din2->di_modrev;
would have to be added to ffs_subr.c and an extra field added to the 
i-node structure for the "shadow copy".

I don't think this would be an improvement compared to the one line.

Does it make sense this time?

Thanks, rick


More information about the freebsd-fs mailing list