Hi,<br><br>I'm reading the source code for ext2/ext3/ext4, and cannot figure<br>out how descriptor_loc() runs:<br><br><pre class="done" id="28/d5/81ec51bf6aa0efa0042edd4054a73e42b060_3/1000"><a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1600" id="L1600" class="line" name="linux+v3.4.1/fs/ext3/super.c#L1600">1600</a>static <a href="http://lxr.linux.no/linux+*/+code=ext3_fsblk_t" class="sref">ext3_fsblk_t</a> <a href="http://lxr.linux.no/linux+*/+code=descriptor_loc" class="sref">descriptor_loc</a>(struct <a href="http://lxr.linux.no/linux+*/+code=super_block" class="sref">super_block</a> *<a href="http://lxr.linux.no/linux+*/+code=sb" class="sref">sb</a>,
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1601" id="L1601" class="line" name="L1601">1601</a> <a href="http://lxr.linux.no/linux+*/+code=ext3_fsblk_t" class="sref">ext3_fsblk_t</a> <a href="http://lxr.linux.no/linux+*/+code=logic_sb_block" class="sref">logic_sb_block</a>,
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1602" id="L1602" class="line" name="L1602">1602</a> int <a href="http://lxr.linux.no/linux+*/+code=nr" class="sref">nr</a>)
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1603" id="L1603" class="line" name="L1603">1603</a>{
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1604" id="L1604" class="line" name="L1604">1604</a> struct <a href="http://lxr.linux.no/linux+*/+code=ext3_sb_info" class="sref">ext3_sb_info</a> *<a href="http://lxr.linux.no/linux+*/+code=sbi" class="sref">sbi</a> = <a href="http://lxr.linux.no/linux+*/+code=EXT3_SB" class="sref">EXT3_SB</a>(<a href="http://lxr.linux.no/linux+*/+code=sb" class="sref">sb</a>);
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1605" id="L1605" class="line" name="L1605">1605</a> unsigned long <a href="http://lxr.linux.no/linux+*/+code=bg" class="sref">bg</a>, <a href="http://lxr.linux.no/linux+*/+code=first_meta_bg" class="sref">first_meta_bg</a>;
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1606" id="L1606" class="line" name="L1606">1606</a> int <a href="http://lxr.linux.no/linux+*/+code=has_super" class="sref">has_super</a> = 0;
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1607" id="L1607" class="line" name="L1607">1607</a>
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1608" id="L1608" class="line" name="L1608">1608</a> <a href="http://lxr.linux.no/linux+*/+code=first_meta_bg" class="sref">first_meta_bg</a> = <a href="http://lxr.linux.no/linux+*/+code=le32_to_cpu" class="sref">le32_to_cpu</a>(<a href="http://lxr.linux.no/linux+*/+code=sbi" class="sref">sbi</a>-><a href="http://lxr.linux.no/linux+*/+code=s_es" class="sref">s_es</a>-><a href="http://lxr.linux.no/linux+*/+code=s_first_meta_bg" class="sref">s_first_meta_bg</a>); <br>
<br>1) Who can setup the field ->s_first_meta_bg, mke2fs? And what does it mean?<br> What's a meta block group? <br><br><a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1609" id="L1609" class="line" name="L1609">1609</a>
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1610" id="L1610" class="line" name="L1610">1610</a> if (!<a href="http://lxr.linux.no/linux+*/+code=EXT3_HAS_INCOMPAT_FEATURE" class="sref">EXT3_HAS_INCOMPAT_FEATURE</a>(<a href="http://lxr.linux.no/linux+*/+code=sb" class="sref">sb</a>, <a href="http://lxr.linux.no/linux+*/+code=EXT3_FEATURE_INCOMPAT_META_BG" class="sref">EXT3_FEATURE_INCOMPAT_META_BG</a>) ||
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1611" id="L1611" class="line" name="L1611">1611</a> <a href="http://lxr.linux.no/linux+*/+code=nr" class="sref">nr</a> < <a href="http://lxr.linux.no/linux+*/+code=first_meta_bg" class="sref">first_meta_bg</a>)
<br>2) In which case, we can have "nr < first_meta_bg"?<br> And how does EXT3_FEATURE_INCOMPAT_META_BG affect the physical disk layout?<br><br><br><a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1612" id="L1612" class="line" name="L1612">1612</a> return (<a href="http://lxr.linux.no/linux+*/+code=logic_sb_block" class="sref">logic_sb_block</a> + <a href="http://lxr.linux.no/linux+*/+code=nr" class="sref">nr</a> + 1);
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1613" id="L1613" class="line" name="L1613">1613</a> <a href="http://lxr.linux.no/linux+*/+code=bg" class="sref">bg</a> = <a href="http://lxr.linux.no/linux+*/+code=sbi" class="sref">sbi</a>-><a href="http://lxr.linux.no/linux+*/+code=s_desc_per_block" class="sref">s_desc_per_block</a> * <a href="http://lxr.linux.no/linux+*/+code=nr" class="sref">nr</a>;
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1614" id="L1614" class="line" name="L1614">1614</a> if (<a href="http://lxr.linux.no/linux+*/+code=ext3_bg_has_super" class="sref">ext3_bg_has_super</a>(<a href="http://lxr.linux.no/linux+*/+code=sb" class="sref">sb</a>, <a href="http://lxr.linux.no/linux+*/+code=bg" class="sref">bg</a>))
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1615" id="L1615" class="line" name="L1615">1615</a> <a href="http://lxr.linux.no/linux+*/+code=has_super" class="sref">has_super</a> = 1;
<a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1616" id="L1616" class="line" name="L1616">1616</a> return (<a href="http://lxr.linux.no/linux+*/+code=has_super" class="sref">has_super</a> + <a href="http://lxr.linux.no/linux+*/+code=ext3_group_first_block_no" class="sref">ext3_group_first_block_no</a>(<a href="http://lxr.linux.no/linux+*/+code=sb" class="sref">sb</a>, <a href="http://lxr.linux.no/linux+*/+code=bg" class="sref">bg</a>));
<br>3) It always return the first block no of the specific bg, right?<br> Then its caller ext3_fill_super will read in the disk block.<br> It seems that ext3_fill_super just read many copies of one same block<br> (1st block), right?<br>
I'm sure I'm wrong with it, but cannot find out the right way.<br><br><a href="http://lxr.linux.no/linux+*/fs/ext3/super.c#L1617" id="L1617" class="line" name="L1617">1617</a>}
</pre><br>Any explanation are welcome.<br><br>thanks, <br>