On Thu, Aug 08, 2013 at 01:04:19PM +0800, Wang Shilong wrote: > struct __prelim_ref is allocated and freed frequently when > walking backref tree, using slab allocater can not only > speed up allocating but also detect memory leaks. > > Signed-off-by: Wang Shilong <wangsl.f...@cn.fujitsu.com> > Reviewed-by: Miao Xie <mi...@cn.fujitsu.com> > --- > fs/btrfs/backref.c | 30 +++++++++++++++++++++++++----- > fs/btrfs/backref.h | 2 ++ > fs/btrfs/super.c | 8 ++++++++ > 3 files changed, 35 insertions(+), 5 deletions(-) > > diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c > index f7781e6..916e4f1 100644 > --- a/fs/btrfs/backref.c > +++ b/fs/btrfs/backref.c > @@ -119,6 +119,26 @@ struct __prelim_ref { > u64 wanted_disk_byte; > }; > > +static struct kmem_cache *prelim_ref_cache; > + > +int __init btrfs_prelim_ref_init(void) > +{ > + prelim_ref_cache = kmem_cache_create("btrfs_prelim_ref", > + sizeof(struct __prelim_ref),
Would be nice to give it a name that matches the slab cache, btrfs_prelim_ref. david -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html