diff mbox series

[3/4] xfs: remove __xfs_filemap_fault

Message ID 20241029151214.255015-4-hch@lst.de (mailing list archive)
State New
Headers show
Series [1/4] xfs: split the page fault trace event | expand

Commit Message

Christoph Hellwig Oct. 29, 2024, 3:11 p.m. UTC
xfs_filemap_huge_fault only ever serves DAX faults, so hard code the
call to xfs_dax_read_fault and open code __xfs_filemap_fault in the
only remaining caller.

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

Comments

Darrick J. Wong Oct. 29, 2024, 4 p.m. UTC | #1
On Tue, Oct 29, 2024 at 04:11:59PM +0100, Christoph Hellwig wrote:
> xfs_filemap_huge_fault only ever serves DAX faults, so hard code the
> call to xfs_dax_read_fault and open code __xfs_filemap_fault in the
> only remaining caller.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_file.c | 29 +++++++++++------------------
>  1 file changed, 11 insertions(+), 18 deletions(-)
> 
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 0b8e36f8703c..7464d874e766 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -1481,20 +1481,6 @@ xfs_write_fault(
>  	return ret;
>  }
>  
> -static vm_fault_t
> -__xfs_filemap_fault(
> -	struct vm_fault		*vmf,
> -	unsigned int		order)
> -{
> -	struct inode		*inode = file_inode(vmf->vma->vm_file);
> -
> -	if (IS_DAX(inode))
> -		return xfs_dax_read_fault(vmf, order);
> -
> -	trace_xfs_read_fault(XFS_I(inode), order);
> -	return filemap_fault(vmf);
> -}
> -
>  static inline bool
>  xfs_is_write_fault(
>  	struct vm_fault		*vmf)
> @@ -1507,10 +1493,17 @@ static vm_fault_t
>  xfs_filemap_fault(
>  	struct vm_fault		*vmf)
>  {
> +	struct inode		*inode = file_inode(vmf->vma->vm_file);
> +
>  	/* DAX can shortcut the normal fault path on write faults! */
> -	if (IS_DAX(file_inode(vmf->vma->vm_file)) && xfs_is_write_fault(vmf))
> -		return xfs_write_fault(vmf, 0);
> -	return __xfs_filemap_fault(vmf, 0);
> +	if (IS_DAX(inode)) {
> +		if (xfs_is_write_fault(vmf))
> +			return xfs_write_fault(vmf, 0);
> +		return xfs_dax_read_fault(vmf, 0);
> +	}
> +
> +	trace_xfs_read_fault(XFS_I(inode), 0);
> +	return filemap_fault(vmf);
>  }
>  
>  static vm_fault_t
> @@ -1524,7 +1517,7 @@ xfs_filemap_huge_fault(
>  	/* DAX can shortcut the normal fault path on write faults! */
>  	if (xfs_is_write_fault(vmf))
>  		return xfs_write_fault(vmf, order);
> -	return __xfs_filemap_fault(vmf, order);
> +	return xfs_dax_read_fault(vmf, order);
>  }
>  
>  static vm_fault_t
> -- 
> 2.45.2
> 
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 0b8e36f8703c..7464d874e766 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -1481,20 +1481,6 @@  xfs_write_fault(
 	return ret;
 }
 
-static vm_fault_t
-__xfs_filemap_fault(
-	struct vm_fault		*vmf,
-	unsigned int		order)
-{
-	struct inode		*inode = file_inode(vmf->vma->vm_file);
-
-	if (IS_DAX(inode))
-		return xfs_dax_read_fault(vmf, order);
-
-	trace_xfs_read_fault(XFS_I(inode), order);
-	return filemap_fault(vmf);
-}
-
 static inline bool
 xfs_is_write_fault(
 	struct vm_fault		*vmf)
@@ -1507,10 +1493,17 @@  static vm_fault_t
 xfs_filemap_fault(
 	struct vm_fault		*vmf)
 {
+	struct inode		*inode = file_inode(vmf->vma->vm_file);
+
 	/* DAX can shortcut the normal fault path on write faults! */
-	if (IS_DAX(file_inode(vmf->vma->vm_file)) && xfs_is_write_fault(vmf))
-		return xfs_write_fault(vmf, 0);
-	return __xfs_filemap_fault(vmf, 0);
+	if (IS_DAX(inode)) {
+		if (xfs_is_write_fault(vmf))
+			return xfs_write_fault(vmf, 0);
+		return xfs_dax_read_fault(vmf, 0);
+	}
+
+	trace_xfs_read_fault(XFS_I(inode), 0);
+	return filemap_fault(vmf);
 }
 
 static vm_fault_t
@@ -1524,7 +1517,7 @@  xfs_filemap_huge_fault(
 	/* DAX can shortcut the normal fault path on write faults! */
 	if (xfs_is_write_fault(vmf))
 		return xfs_write_fault(vmf, order);
-	return __xfs_filemap_fault(vmf, order);
+	return xfs_dax_read_fault(vmf, order);
 }
 
 static vm_fault_t