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

Rick Macklem rmacklem at uoguelph.ca
Sun Apr 26 22:19:20 UTC 2009



On Sun, 26 Apr 2009, Rick C. Petty wrote:

>
> The reason is that the first set (the "copies") are what are referenced by
> the ffs/ufs code.  The real copies are what came from the disk (hence the
> "on-disk").  Because UFS1 & UFS2 have such different dinode structures, the
> copies are moved to/from the dinode structures when the inode is read to or
> written from the disk.  At all other times, the "copies" are used.
>
Righto. However some fields like i_mtime are just accessed using the
DIP() and DIP_SET() macros.

Are you just saying that it was easier to not bother using the macros for 
frequently referenced fields? (Or, to put it another way, "when support
for UFS2 was added, the code would have looked really grotty if DIP() and
DIP_SET() were used for frequently used fields?".)

The question came up because I had proposed a patch with:

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

in it and it was suggested that i_modrev might be more appropriate with
a "shadow copy". Since I realized I didn't know why there were "shadow 
copies" of some fields and not others, it lead to the original question.
(This is the only place i_modrev gets manipulated by the patch.)

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?

Thanks for the reply, rick



More information about the freebsd-fs mailing list