diff mbox series

[03/12] xfs: remove xfs_buf.b_offset

Message ID 20250226155245.513494-4-hch@lst.de (mailing list archive)
State New
Headers show
Series [01/12] xfs: unmapped buffer item size straddling mismatch | expand

Commit Message

Christoph Hellwig Feb. 26, 2025, 3:51 p.m. UTC
b_offset is only set for slab backed buffers and always set to
offset_in_page(bp->b_addr), which can be done just as easily in the only
user of b_offset.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_buf.c | 3 +--
 fs/xfs/xfs_buf.h | 2 --
 2 files changed, 1 insertion(+), 4 deletions(-)

Comments

Darrick J. Wong Feb. 26, 2025, 5 p.m. UTC | #1
On Wed, Feb 26, 2025 at 07:51:31AM -0800, Christoph Hellwig wrote:
> b_offset is only set for slab backed buffers and always set to
> offset_in_page(bp->b_addr), which can be done just as easily in the only
> user of b_offset.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Wooo space savings!
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_buf.c | 3 +--
>  fs/xfs/xfs_buf.h | 2 --
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 9e0c64511936..ee678e13d9bd 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -336,7 +336,6 @@ xfs_buf_alloc_kmem(
>  		bp->b_addr = NULL;
>  		return -ENOMEM;
>  	}
> -	bp->b_offset = offset_in_page(bp->b_addr);
>  	bp->b_pages = bp->b_page_array;
>  	bp->b_pages[0] = kmem_to_page(bp->b_addr);
>  	bp->b_page_count = 1;
> @@ -1528,7 +1527,7 @@ xfs_buf_submit_bio(
>  
>  	if (bp->b_flags & _XBF_KMEM) {
>  		__bio_add_page(bio, virt_to_page(bp->b_addr), size,
> -				bp->b_offset);
> +				offset_in_page(bp->b_addr));
>  	} else {
>  		for (p = 0; p < bp->b_page_count; p++)
>  			__bio_add_page(bio, bp->b_pages[p], PAGE_SIZE, 0);
> diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
> index 3b4ed42e11c0..dc41b617b067 100644
> --- a/fs/xfs/xfs_buf.h
> +++ b/fs/xfs/xfs_buf.h
> @@ -197,8 +197,6 @@ struct xfs_buf {
>  	int			b_map_count;
>  	atomic_t		b_pin_count;	/* pin count */
>  	unsigned int		b_page_count;	/* size of page array */
> -	unsigned int		b_offset;	/* page offset of b_addr,
> -						   only for _XBF_KMEM buffers */
>  	int			b_error;	/* error code on I/O */
>  	void			(*b_iodone)(struct xfs_buf *bp);
>  
> -- 
> 2.45.2
> 
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 9e0c64511936..ee678e13d9bd 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -336,7 +336,6 @@  xfs_buf_alloc_kmem(
 		bp->b_addr = NULL;
 		return -ENOMEM;
 	}
-	bp->b_offset = offset_in_page(bp->b_addr);
 	bp->b_pages = bp->b_page_array;
 	bp->b_pages[0] = kmem_to_page(bp->b_addr);
 	bp->b_page_count = 1;
@@ -1528,7 +1527,7 @@  xfs_buf_submit_bio(
 
 	if (bp->b_flags & _XBF_KMEM) {
 		__bio_add_page(bio, virt_to_page(bp->b_addr), size,
-				bp->b_offset);
+				offset_in_page(bp->b_addr));
 	} else {
 		for (p = 0; p < bp->b_page_count; p++)
 			__bio_add_page(bio, bp->b_pages[p], PAGE_SIZE, 0);
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index 3b4ed42e11c0..dc41b617b067 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -197,8 +197,6 @@  struct xfs_buf {
 	int			b_map_count;
 	atomic_t		b_pin_count;	/* pin count */
 	unsigned int		b_page_count;	/* size of page array */
-	unsigned int		b_offset;	/* page offset of b_addr,
-						   only for _XBF_KMEM buffers */
 	int			b_error;	/* error code on I/O */
 	void			(*b_iodone)(struct xfs_buf *bp);