LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] xfs:change kmem_free to use generic kvfree()
@ 2015-01-28  6:08 Wang, Yalin
  2015-01-29 15:46 ` Brian Foster
  0 siblings, 1 reply; 2+ messages in thread
From: Wang, Yalin @ 2015-01-28  6:08 UTC (permalink / raw)
  To: 'david@fromorbit.com', 'xfs@oss.sgi.com',
	'linux-kernel@vger.kernel.org'

Change kmem_free to use kvfree() generic function,
remove the duplicated code.

Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
---
 fs/xfs/kmem.c | 10 ----------
 fs/xfs/kmem.h |  5 ++++-
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c
index 53e95b2..a7a3a63 100644
--- a/fs/xfs/kmem.c
+++ b/fs/xfs/kmem.c
@@ -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)
diff --git a/fs/xfs/kmem.h b/fs/xfs/kmem.h
index 64db0e5..cc6b768 100644
--- a/fs/xfs/kmem.h
+++ b/fs/xfs/kmem.h
@@ -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);
-- 
2.2.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs:change kmem_free to use generic kvfree()
  2015-01-28  6:08 [PATCH] xfs:change kmem_free to use generic kvfree() Wang, Yalin
@ 2015-01-29 15:46 ` Brian Foster
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2015-01-29 15:46 UTC (permalink / raw)
  To: Wang, Yalin
  Cc: 'david@fromorbit.com', 'xfs@oss.sgi.com',
	'linux-kernel@vger.kernel.org'

On Wed, Jan 28, 2015 at 02:08:47PM +0800, Wang, Yalin wrote:
> Change kmem_free to use kvfree() generic function,
> remove the duplicated code.
> 
> Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
> ---

Looks good...

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/kmem.c | 10 ----------
>  fs/xfs/kmem.h |  5 ++++-
>  2 files changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c
> index 53e95b2..a7a3a63 100644
> --- a/fs/xfs/kmem.c
> +++ b/fs/xfs/kmem.c
> @@ -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)
> diff --git a/fs/xfs/kmem.h b/fs/xfs/kmem.h
> index 64db0e5..cc6b768 100644
> --- a/fs/xfs/kmem.h
> +++ b/fs/xfs/kmem.h
> @@ -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);
> -- 
> 2.2.2
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-29 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28  6:08 [PATCH] xfs:change kmem_free to use generic kvfree() Wang, Yalin
2015-01-29 15:46 ` Brian Foster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).