Re: [RFC] Flex_BG ialloc awareness.

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

 



On Mon, 3 Dec 2007 13:42:47 -0700
Andreas Dilger <adilger@xxxxxxx> wrote:

> On Dec 03, 2007  13:05 -0600, Jose R. Santos wrote:
> > @@ -600,6 +600,7 @@ void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb,
> >  	ext4_grpblk_t group_freed;
> > +	ext4_group_t meta_group;
> 
> Please do not call these meta_groups.  This already means something very
> specific (i.e. desc_per_block groups) and using it for FLEX_BG is confusing.
> One possibly desirable relation is if the FLEX_BG count is some integer or
> power-of-two multiple of the metabg count.  That would allow the FLEX_BG
> code to share the same in-memory group struct as the mballoc code and save
> on some memory overhead.

Yes, need to clean the naming on some of these.  I also need to look
into the mballoc code to see if there is anything I can reuse.

> > +			meta_group = ext4_meta_group(sbi, block_group);
> > +			spin_lock(&sbi->s_meta_groups[meta_group].meta_group_lock);
> > +			sbi->s_meta_groups[meta_group].free_inodes++;
> > +			if (is_directory)
> > +				sbi->s_meta_groups[meta_group].num_dirs--;
> > +			spin_unlock(&sbi->s_meta_groups[meta_group].meta_group_lock);
> 
> This can be as many as hundreds or thousands of spin locks.  Why not use
> the same hashed locking code as the group descriptors themselves?
> 
> 		spin_lock(sb_bgl_lock(sbi, meta_group));
> 		spin_unlock(sb_bgl_lock(sbi, meta_group));
> 
> This scales with the number of CPUs and chance of contention is very low.

Excellent.  I was thinking that one spinlock per flex_bg was overkill
as well but I did not know the existence of blockgroup_lock.h.

> > +int find_group_meta(struct super_block *sb, struct inode *parent)
> > +{
> > +	ext4_group_t parent_mgroup = parent_group / sbi->s_groups_per_meta;
> 
> This could use ext4_meta_group(sbi, parent_group)?

Yes, thanks for catching.
 
> > +static inline ext4_group_t ext4_meta_group(struct ext4_sb_info *sbi,
> > +					     ext4_group_t block_group)
> > +{
> > +	return block_group/sbi->s_groups_per_meta;
> > +}
> 
> It would be preferable to limit s_groups_per_meta to be a power-of-two
> so that this can become a shift instead of a divide.

Seems like I always fall into the same trap.  I'll change this.

> Cheers, Andreas
> --
> Andreas Dilger
> Sr. Staff Engineer, Lustre Group
> Sun Microsystems of Canada, Inc.
> 

Thanks.

-JRS
-
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