diff mbox series

[3/5] xfs: remove xfs_buf_free_maps

Message ID 20250317054850.1132557-4-hch@lst.de (mailing list archive)
State Queued
Headers show
Series [1/5] xfs: call xfs_buf_alloc_backing_mem from _xfs_buf_alloc | expand

Commit Message

hch March 17, 2025, 5:48 a.m. UTC
xfs_buf_free_maps only has a single caller, so open code it there.  Stop
zeroing the b_maps pointer as the buffer is freed in the next line.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_buf.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

Comments

Carlos Maiolino March 18, 2025, 12:43 p.m. UTC | #1
On Mon, Mar 17, 2025 at 06:48:34AM +0100, Christoph Hellwig wrote:
> xfs_buf_free_maps only has a single caller, so open code it there.  Stop
> zeroing the b_maps pointer as the buffer is freed in the next line.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Sounds good.
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

> ---
>  fs/xfs/xfs_buf.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 878dc0f108d1..bf75964bbfe8 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -88,23 +88,14 @@ xfs_buf_stale(
>  	spin_unlock(&bp->b_lock);
>  }
> 
> -static void
> -xfs_buf_free_maps(
> -	struct xfs_buf	*bp)
> -{
> -	if (bp->b_maps != &bp->__b_map) {
> -		kfree(bp->b_maps);
> -		bp->b_maps = NULL;
> -	}
> -}
> -
>  static void
>  xfs_buf_free_callback(
>  	struct callback_head	*cb)
>  {
>  	struct xfs_buf		*bp = container_of(cb, struct xfs_buf, b_rcu);
> 
> -	xfs_buf_free_maps(bp);
> +	if (bp->b_maps != &bp->__b_map)
> +		kfree(bp->b_maps);
>  	kmem_cache_free(xfs_buf_cache, bp);
>  }
> 
> --
> 2.45.2
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 878dc0f108d1..bf75964bbfe8 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -88,23 +88,14 @@  xfs_buf_stale(
 	spin_unlock(&bp->b_lock);
 }
 
-static void
-xfs_buf_free_maps(
-	struct xfs_buf	*bp)
-{
-	if (bp->b_maps != &bp->__b_map) {
-		kfree(bp->b_maps);
-		bp->b_maps = NULL;
-	}
-}
-
 static void
 xfs_buf_free_callback(
 	struct callback_head	*cb)
 {
 	struct xfs_buf		*bp = container_of(cb, struct xfs_buf, b_rcu);
 
-	xfs_buf_free_maps(bp);
+	if (bp->b_maps != &bp->__b_map)
+		kfree(bp->b_maps);
 	kmem_cache_free(xfs_buf_cache, bp);
 }