Re: spatch for 64-bit e2fsprogs (was Re: Fix device too big bug in mainline?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 04, 2009 at 01:24:08PM -0600, Andreas Dilger wrote:
> Semantic patches...  a very interesting idea.
> 
> On Aug 04, 2009  14:18 -0400, Valerie Aurora wrote:
> > // Free blocks
> > -fs->group_desc[group].bg_free_blocks_count++
> > +ext2fs_bg_free_blocks_count_set(fs, group, ext2fs_bg_free_blocks_count(fs, group)+1)
> > |
> > -fs->group_desc[group].bg_free_blocks_count--
> > +ext2fs_bg_free_blocks_count_set(fs, group, ext2fs_bg_free_blocks_count(fs, group)-1)
> > |
> > -fs->group_desc[group].bg_free_blocks_count += i
> > +ext2fs_bg_free_blocks_count_set(fs, group, ext2fs_bg_free_blocks_count(fs, group)+i)
> > |
> > -fs->group_desc[group].bg_free_blocks_count -= i
> > +ext2fs_bg_free_blocks_count_set(fs, group, ext2fs_bg_free_blocks_count(fs, group)-i)
> 
> I wonder if it makes more sense for ext2fs to export functions like
> ext2fs_bg_free_blocks_count_add() and ext2fs_bg_free_blocks_count_sub()?

I am agnostic.

> > -fs->group_desc[group].bg_flags = 0
> > +ext2fs_bg_flags_clear(fs, group, 0)
> 
> This last one looks like an error.  To clear the flags you should
> use ext2fs_bg_flags_set(fs, group, 0), otherwise you are "clearing
> no flags".

The code does the right thing:

void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flags)
{
        if (fs->super->s_desc_size >= EXT2_MIN_DESC_SIZE_64BIT) {
                struct ext4_group_desc *gdp;
                gdp = (struct ext4_group_desc *) (fs->group_desc) + group;

                gdp->bg_flags = 0;
                return;
        }

        fs->group_desc[group].bg_flags = 0;
}

The problem is that this function is stupidly named:

ext2fs_bg_flag_clear() - does what you think
ext2fs_bg_flags_clear() - does above
              ^

It should be removed and replaced by ext2fs_bg_flags_set(), I agree.

-VAL
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux