diff mbox series

[v2,09/12] dax: advance the iomap_iter on pte and pmd faults

Message ID 20250219175050.83986-10-bfoster@redhat.com (mailing list archive)
State New
Headers show
Series iomap: incremental advance conversion -- phase 2 | expand

Commit Message

Brian Foster Feb. 19, 2025, 5:50 p.m. UTC
Advance the iomap_iter on PTE and PMD faults. Each of these
operations assign a hardcoded size to iter.processed. Replace those
with an advance and status return.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 fs/dax.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Darrick J. Wong Feb. 19, 2025, 10:36 p.m. UTC | #1
On Wed, Feb 19, 2025 at 12:50:47PM -0500, Brian Foster wrote:
> Advance the iomap_iter on PTE and PMD faults. Each of these
> operations assign a hardcoded size to iter.processed. Replace those
> with an advance and status return.
> 
> Signed-off-by: Brian Foster <bfoster@redhat.com>

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

--D

> ---
>  fs/dax.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/dax.c b/fs/dax.c
> index c8c0d81122ab..44701865ca94 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -1771,8 +1771,10 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
>  			ret |= VM_FAULT_MAJOR;
>  		}
>  
> -		if (!(ret & VM_FAULT_ERROR))
> -			iter.processed = PAGE_SIZE;
> +		if (!(ret & VM_FAULT_ERROR)) {
> +			u64 length = PAGE_SIZE;
> +			iter.processed = iomap_iter_advance(&iter, &length);
> +		}
>  	}
>  
>  	if (iomap_errp)
> @@ -1885,8 +1887,10 @@ static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,
>  			continue; /* actually breaks out of the loop */
>  
>  		ret = dax_fault_iter(vmf, &iter, pfnp, &xas, &entry, true);
> -		if (ret != VM_FAULT_FALLBACK)
> -			iter.processed = PMD_SIZE;
> +		if (ret != VM_FAULT_FALLBACK) {
> +			u64 length = PMD_SIZE;
> +			iter.processed = iomap_iter_advance(&iter, &length);
> +		}
>  	}
>  
>  unlock_entry:
> -- 
> 2.48.1
> 
>
diff mbox series

Patch

diff --git a/fs/dax.c b/fs/dax.c
index c8c0d81122ab..44701865ca94 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1771,8 +1771,10 @@  static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
 			ret |= VM_FAULT_MAJOR;
 		}
 
-		if (!(ret & VM_FAULT_ERROR))
-			iter.processed = PAGE_SIZE;
+		if (!(ret & VM_FAULT_ERROR)) {
+			u64 length = PAGE_SIZE;
+			iter.processed = iomap_iter_advance(&iter, &length);
+		}
 	}
 
 	if (iomap_errp)
@@ -1885,8 +1887,10 @@  static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,
 			continue; /* actually breaks out of the loop */
 
 		ret = dax_fault_iter(vmf, &iter, pfnp, &xas, &entry, true);
-		if (ret != VM_FAULT_FALLBACK)
-			iter.processed = PMD_SIZE;
+		if (ret != VM_FAULT_FALLBACK) {
+			u64 length = PMD_SIZE;
+			iter.processed = iomap_iter_advance(&iter, &length);
+		}
 	}
 
 unlock_entry: