xfs: change kmem_free to use generic kvfree()
authorWang, Yalin <Yalin.Wang@sonymobile.com>
Sun, 1 Feb 2015 22:54:18 +0000 (09:54 +1100)
committerDave Chinner <david@fromorbit.com>
Sun, 1 Feb 2015 22:54:18 +0000 (09:54 +1100)
Change kmem_free to use kvfree() generic function, remove the
duplicated code.

Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/kmem.c
fs/xfs/kmem.h

index 53e95b2a1369cf0836df38ccc3311095f7ed8e44..a7a3a63bb360c098889dab8341ac656ddbd348af 100644 (file)
@@ -91,16 +91,6 @@ kmem_zalloc_large(size_t size, xfs_km_flags_t flags)
        return ptr;
 }
 
-void
-kmem_free(const void *ptr)
-{
-       if (!is_vmalloc_addr(ptr)) {
-               kfree(ptr);
-       } else {
-               vfree(ptr);
-       }
-}
-
 void *
 kmem_realloc(const void *ptr, size_t newsize, size_t oldsize,
             xfs_km_flags_t flags)
index 64db0e53edeac506a23ea7b295e196528b435035..cc6b768fc068f4aa22e994724e9d91fe8698c8e2 100644 (file)
@@ -63,7 +63,10 @@ kmem_flags_convert(xfs_km_flags_t flags)
 extern void *kmem_alloc(size_t, xfs_km_flags_t);
 extern void *kmem_zalloc_large(size_t size, xfs_km_flags_t);
 extern void *kmem_realloc(const void *, size_t, size_t, xfs_km_flags_t);
-extern void  kmem_free(const void *);
+static inline void  kmem_free(const void *ptr)
+{
+       kvfree(ptr);
+}
 
 
 extern void *kmem_zalloc_greedy(size_t *, size_t, size_t);