Re: [PATCH 04/12] xfs: remove xfs_buf_is_vmapped

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 26, 2025 at 07:51:32AM -0800, Christoph Hellwig wrote:
> No need to look at the page count if we can simply call is_vmalloc_addr
> on bp->b_addr.  This prepares for eventualy removing the b_page_count
> field.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Yeah, that's more direct.
Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>

--D

> ---
>  fs/xfs/xfs_buf.c | 20 +++-----------------
>  1 file changed, 3 insertions(+), 17 deletions(-)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index ee678e13d9bd..af1389ebdd69 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -60,20 +60,6 @@ static inline bool xfs_buf_is_uncached(struct xfs_buf *bp)
>  	return bp->b_rhash_key == XFS_BUF_DADDR_NULL;
>  }
>  
> -static inline int
> -xfs_buf_is_vmapped(
> -	struct xfs_buf	*bp)
> -{
> -	/*
> -	 * Return true if the buffer is vmapped.
> -	 *
> -	 * b_addr is null if the buffer is not mapped, but the code is clever
> -	 * enough to know it doesn't have to map a single page, so the check has
> -	 * to be both for b_addr and bp->b_page_count > 1.
> -	 */
> -	return bp->b_addr && bp->b_page_count > 1;
> -}
> -
>  static inline int
>  xfs_buf_vmap_len(
>  	struct xfs_buf	*bp)
> @@ -270,7 +256,7 @@ xfs_buf_free_pages(
>  
>  	ASSERT(bp->b_flags & _XBF_PAGES);
>  
> -	if (xfs_buf_is_vmapped(bp))
> +	if (is_vmalloc_addr(bp->b_addr))
>  		vm_unmap_ram(bp->b_addr, bp->b_page_count);
>  
>  	for (i = 0; i < bp->b_page_count; i++) {
> @@ -1361,7 +1347,7 @@ xfs_buf_ioend(
>  	trace_xfs_buf_iodone(bp, _RET_IP_);
>  
>  	if (bp->b_flags & XBF_READ) {
> -		if (!bp->b_error && xfs_buf_is_vmapped(bp))
> +		if (!bp->b_error && bp->b_addr && is_vmalloc_addr(bp->b_addr))
>  			invalidate_kernel_vmap_range(bp->b_addr,
>  					xfs_buf_vmap_len(bp));
>  		if (!bp->b_error && bp->b_ops)
> @@ -1533,7 +1519,7 @@ xfs_buf_submit_bio(
>  			__bio_add_page(bio, bp->b_pages[p], PAGE_SIZE, 0);
>  		bio->bi_iter.bi_size = size; /* limit to the actual size used */
>  
> -		if (xfs_buf_is_vmapped(bp))
> +		if (bp->b_addr && is_vmalloc_addr(bp->b_addr))
>  			flush_kernel_vmap_range(bp->b_addr,
>  					xfs_buf_vmap_len(bp));
>  	}
> -- 
> 2.45.2
> 
> 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux