diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2013-11-04 18:21:05 +0800 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-11-06 16:31:27 -0600 |
commit | 359d992bcd398273637cd9edde10afca953783c4 (patch) | |
tree | bfe6012116dc8b8d59d16bc517d0c94fa24abae9 /fs/xfs/kmem.c | |
parent | d123031a5673cd38a85ce66cc07243dfe5f424c9 (diff) | |
download | linux-359d992bcd398273637cd9edde10afca953783c4.tar.gz linux-359d992bcd398273637cd9edde10afca953783c4.tar.bz2 linux-359d992bcd398273637cd9edde10afca953783c4.zip |
xfs: simplify kmem_{zone_}zalloc
Introduce flag KM_ZERO which is used to alloc zeroed entry, and convert
kmem_{zone_}zalloc to call kmem_{zone_}alloc() with KM_ZERO directly,
in order to avoid the setting to zero step.
And following Dave's suggestion, make kmem_{zone_}zalloc static inline
into kmem.h as they're now just a simple wrapper.
V2:
Make kmem_{zone_}zalloc static inline into kmem.h as Dave suggested.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/kmem.c')
-rw-r--r-- | fs/xfs/kmem.c | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c index a02cfb9e3bce..66a36befc5c0 100644 --- a/fs/xfs/kmem.c +++ b/fs/xfs/kmem.c @@ -63,17 +63,6 @@ kmem_alloc(size_t size, xfs_km_flags_t flags) } void * -kmem_zalloc(size_t size, xfs_km_flags_t flags) -{ - void *ptr; - - ptr = kmem_alloc(size, flags); - if (ptr) - memset((char *)ptr, 0, (int)size); - return ptr; -} - -void * kmem_zalloc_large(size_t size, xfs_km_flags_t flags) { void *ptr; @@ -128,14 +117,3 @@ kmem_zone_alloc(kmem_zone_t *zone, xfs_km_flags_t flags) congestion_wait(BLK_RW_ASYNC, HZ/50); } while (1); } - -void * -kmem_zone_zalloc(kmem_zone_t *zone, xfs_km_flags_t flags) -{ - void *ptr; - - ptr = kmem_zone_alloc(zone, flags); - if (ptr) - memset((char *)ptr, 0, kmem_cache_size(zone)); - return ptr; -} |