diff mbox series

[10/15] xfs: remove xfarray_sortinfo.page_kaddr

Message ID 20240103084126.513354-11-hch@lst.de (mailing list archive)
State New
Headers show
Series [01/15] shmem: move the shmem_mapping assert into shmem_get_folio_gfp | expand

Commit Message

Christoph Hellwig Jan. 3, 2024, 8:41 a.m. UTC
Now that xfile pages don't need kmapping, there is no need to cache
the kernel virtual address for them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/scrub/xfarray.c | 22 ++++------------------
 fs/xfs/scrub/xfarray.h |  1 -
 2 files changed, 4 insertions(+), 19 deletions(-)

Comments

Darrick J. Wong Jan. 4, 2024, 12:04 a.m. UTC | #1
On Wed, Jan 03, 2024 at 08:41:21AM +0000, Christoph Hellwig wrote:
> Now that xfile pages don't need kmapping, there is no need to cache
> the kernel virtual address for them.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

LGTM!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/scrub/xfarray.c | 22 ++++------------------
>  fs/xfs/scrub/xfarray.h |  1 -
>  2 files changed, 4 insertions(+), 19 deletions(-)
> 
> diff --git a/fs/xfs/scrub/xfarray.c b/fs/xfs/scrub/xfarray.c
> index 3a44700037924b..c29a240d4e25f4 100644
> --- a/fs/xfs/scrub/xfarray.c
> +++ b/fs/xfs/scrub/xfarray.c
> @@ -570,18 +570,7 @@ xfarray_sort_get_page(
>  	loff_t			pos,
>  	uint64_t		len)
>  {
> -	int			error;
> -
> -	error = xfile_get_page(si->array->xfile, pos, len, &si->xfpage);
> -	if (error)
> -		return error;
> -
> -	/*
> -	 * xfile pages must never be mapped into userspace, so we skip the
> -	 * dcache flush when mapping the page.
> -	 */
> -	si->page_kaddr = page_address(si->xfpage.page);
> -	return 0;
> +	return xfile_get_page(si->array->xfile, pos, len, &si->xfpage);
>  }
>  
>  /* Release a page we grabbed for sorting records. */
> @@ -589,11 +578,8 @@ static inline int
>  xfarray_sort_put_page(
>  	struct xfarray_sortinfo	*si)
>  {
> -	if (!si->page_kaddr)
> +	if (!xfile_page_cached(&si->xfpage))
>  		return 0;
> -
> -	si->page_kaddr = NULL;
> -
>  	return xfile_put_page(si->array->xfile, &si->xfpage);
>  }
>  
> @@ -636,7 +622,7 @@ xfarray_pagesort(
>  		return error;
>  
>  	xfarray_sort_bump_heapsorts(si);
> -	startp = si->page_kaddr + offset_in_page(lo_pos);
> +	startp = page_address(si->xfpage.page) + offset_in_page(lo_pos);
>  	sort(startp, hi - lo + 1, si->array->obj_size, si->cmp_fn, NULL);
>  
>  	xfarray_sort_bump_stores(si);
> @@ -883,7 +869,7 @@ xfarray_sort_load_cached(
>  			return error;
>  	}
>  
> -	memcpy(ptr, si->page_kaddr + offset_in_page(idx_pos),
> +	memcpy(ptr, page_address(si->xfpage.page) + offset_in_page(idx_pos),
>  			si->array->obj_size);
>  	return 0;
>  }
> diff --git a/fs/xfs/scrub/xfarray.h b/fs/xfs/scrub/xfarray.h
> index 62b9c506fdd1b7..6f2862054e194d 100644
> --- a/fs/xfs/scrub/xfarray.h
> +++ b/fs/xfs/scrub/xfarray.h
> @@ -107,7 +107,6 @@ struct xfarray_sortinfo {
>  
>  	/* Cache a page here for faster access. */
>  	struct xfile_page	xfpage;
> -	void			*page_kaddr;
>  
>  #ifdef DEBUG
>  	/* Performance statistics. */
> -- 
> 2.39.2
> 
>
diff mbox series

Patch

diff --git a/fs/xfs/scrub/xfarray.c b/fs/xfs/scrub/xfarray.c
index 3a44700037924b..c29a240d4e25f4 100644
--- a/fs/xfs/scrub/xfarray.c
+++ b/fs/xfs/scrub/xfarray.c
@@ -570,18 +570,7 @@  xfarray_sort_get_page(
 	loff_t			pos,
 	uint64_t		len)
 {
-	int			error;
-
-	error = xfile_get_page(si->array->xfile, pos, len, &si->xfpage);
-	if (error)
-		return error;
-
-	/*
-	 * xfile pages must never be mapped into userspace, so we skip the
-	 * dcache flush when mapping the page.
-	 */
-	si->page_kaddr = page_address(si->xfpage.page);
-	return 0;
+	return xfile_get_page(si->array->xfile, pos, len, &si->xfpage);
 }
 
 /* Release a page we grabbed for sorting records. */
@@ -589,11 +578,8 @@  static inline int
 xfarray_sort_put_page(
 	struct xfarray_sortinfo	*si)
 {
-	if (!si->page_kaddr)
+	if (!xfile_page_cached(&si->xfpage))
 		return 0;
-
-	si->page_kaddr = NULL;
-
 	return xfile_put_page(si->array->xfile, &si->xfpage);
 }
 
@@ -636,7 +622,7 @@  xfarray_pagesort(
 		return error;
 
 	xfarray_sort_bump_heapsorts(si);
-	startp = si->page_kaddr + offset_in_page(lo_pos);
+	startp = page_address(si->xfpage.page) + offset_in_page(lo_pos);
 	sort(startp, hi - lo + 1, si->array->obj_size, si->cmp_fn, NULL);
 
 	xfarray_sort_bump_stores(si);
@@ -883,7 +869,7 @@  xfarray_sort_load_cached(
 			return error;
 	}
 
-	memcpy(ptr, si->page_kaddr + offset_in_page(idx_pos),
+	memcpy(ptr, page_address(si->xfpage.page) + offset_in_page(idx_pos),
 			si->array->obj_size);
 	return 0;
 }
diff --git a/fs/xfs/scrub/xfarray.h b/fs/xfs/scrub/xfarray.h
index 62b9c506fdd1b7..6f2862054e194d 100644
--- a/fs/xfs/scrub/xfarray.h
+++ b/fs/xfs/scrub/xfarray.h
@@ -107,7 +107,6 @@  struct xfarray_sortinfo {
 
 	/* Cache a page here for faster access. */
 	struct xfile_page	xfpage;
-	void			*page_kaddr;
 
 #ifdef DEBUG
 	/* Performance statistics. */