How to understand super.c/descriptor_loc for ext2/ext3/ext4?

Ryan Wang at
Thu Jun 7 09:37:07 EDT 2012


I'm reading the source code for ext2/ext3/ext4, and cannot figure
out how descriptor_loc() runs:

1600 <*/fs/ext3/super.c#L1600>static
ext3_fsblk_t <*/+code=ext3_fsblk_t>
descriptor_loc <*/+code=descriptor_loc>(struct
super_block <*/+code=super_block> *sb
<*/+code=ext3_fsblk_t> logic_sb_block
                int nr <*/+code=nr>)1603
<*/fs/ext3/super.c#L1604>        struct
ext3_sb_info <*/+code=ext3_sb_info> *sbi
<*/+code=sbi> = EXT3_SB
<*/fs/ext3/super.c#L1605>        unsigned
long bg <*/+code=bg>, first_meta_bg
<*/fs/ext3/super.c#L1606>        int
has_super <*/+code=has_super> = 0;1607
first_meta_bg <*/+code=first_meta_bg> =
le32_to_cpu <*/+code=le32_to_cpu>(sbi

1) Who can setup the field ->s_first_meta_bg, mke2fs? And what does it mean?
   What's a meta block group?

1609 <*/fs/ext3/super.c#L1609>1610
<*/fs/ext3/super.c#L1610>        if
||1611 <*/fs/ext3/super.c#L1611>
nr <*/+code=nr> < first_meta_bg
2) In which case, we can have "nr < first_meta_bg"?
   And how does EXT3_FEATURE_INCOMPAT_META_BG affect the physical disk layout?

1612 <*/fs/ext3/super.c#L1612>
 return (logic_sb_block
<*/+code=logic_sb_block> + nr
<*/+code=nr> + 1);1613
<*/fs/ext3/super.c#L1613>        bg
<*/+code=bg> = sbi
<*/+code=s_desc_per_block> * nr
<*/fs/ext3/super.c#L1614>        if
<*/+code=sb>, bg
has_super <*/+code=has_super> = 1;1616
<*/fs/ext3/super.c#L1616>        return
(has_super <*/+code=has_super> +
<*/+code=sb>, bg
3) It always return the first block no of the specific bg, right?
   Then its caller ext3_fill_super will read in the disk block.
   It seems that ext3_fill_super just read many copies of one same block
   (1st block), right?
   I'm sure I'm wrong with it, but cannot find out the right way.

1617 <*/fs/ext3/super.c#L1617>}

Any explanation are welcome.

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Kernelnewbies mailing list