Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] NFSv4/flexfiles: calculate stripe boundaries from the file offset
@ 2026-10-24 14:08 Jorge Mora
  2026-10-26 23:44 ` Benjamin Coddington
  0 siblings, 1 reply; 3+ messages in thread
From: Jorge Mora @ 2026-10-24 14:08 UTC (permalink / raw)
  To: linux-nfs; +Cc: trondmy, anna, Rakesh.Bhargava, Mohit.Kumar, mora

From: Rakesh Bhargava <Rakesh.Bhargava@netapp.com>

ff_layout_pg_test() subtracted the layout segment offset when splitting
I/O across stripes. Device selection in nfs4_ff_layout_calc_dss_id()
uses the absolute file offset, which is also how RFC 8435 sparse
layouts number stripes.

A LAYOUTGET reply that starts off a stripe boundary therefore moves the
clipping point while the data server is still chosen from the file
offset. After a data-server error, a direct write that crosses a stripe
is joined and resent past the real boundary, and a later read of that
range is not split.

Clip with the same file offset used to select the data server. The
segment offset remains the covered byte range; pnfs_generic_pg_test()
already limits coalescing to that range.

Fixes: 4934ccbeaed3 ("NFSv4/flexfiles: Read path updates for striped layouts")

Signed-off-by: Rakesh Bhargava <Rakesh.Bhargava@netapp.com>
Signed-off-by: Jorge Mora <mora@netapp.com>
---
 fs/nfs/flexfilelayout/flexfilelayout.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 7fe8b91fa47c..09d44de2676a 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -996,7 +996,6 @@ ff_layout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
 	unsigned int size;
 	u64 p_stripe, r_stripe;
 	u32 stripe_offset;
-	u64 segment_offset = pgio->pg_lseg->pls_range.offset;
 	u32 stripe_unit = FF_LAYOUT_LSEG(pgio->pg_lseg)->stripe_unit;
 
 	/* calls nfs_generic_pg_test */
@@ -1006,10 +1005,17 @@ ff_layout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
 	else if (!ff_layout_lseg_is_striped(FF_LAYOUT_LSEG(pgio->pg_lseg)))
 		return size;
 
-	/* see if req and prev are in the same stripe */
+	/*
+	 * Sparse flexfiles stripes by logical file offset, the same value
+	 * nfs4_ff_layout_calc_dss_id() uses to choose a data server. The
+	 * layout segment offset is only the covered byte range.
+	 * pnfs_generic_pg_test() already stops coalescing at the end of it.
+	 * Subtracting that offset here shifts the stripe phase whenever a
+	 * LAYOUTGET reply starts off a stripe boundary.
+	 */
 	if (prev) {
-		p_stripe = (u64)req_offset(prev) - segment_offset;
-		r_stripe = (u64)req_offset(req) - segment_offset;
+		p_stripe = req_offset(prev);
+		r_stripe = req_offset(req);
 		do_div(p_stripe, stripe_unit);
 		do_div(r_stripe, stripe_unit);
 
@@ -1018,9 +1024,7 @@ ff_layout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
 	}
 
 	/* calculate remaining bytes in the current stripe */
-	div_u64_rem((u64)req_offset(req) - segment_offset,
-			stripe_unit,
-			&stripe_offset);
+	div_u64_rem(req_offset(req), stripe_unit, &stripe_offset);
 	WARN_ON_ONCE(stripe_offset > stripe_unit);
 	if (stripe_offset >= stripe_unit)
 		return 0;

base-commit: 18a80121193c6d19519e218434c9acf90e8d0e5c
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] NFSv4/flexfiles: calculate stripe boundaries from the file offset
  2026-10-24 14:08 [PATCH] NFSv4/flexfiles: calculate stripe boundaries from the file offset Jorge Mora
@ 2026-10-26 23:44 ` Benjamin Coddington
  2026-10-28  0:48   ` Mora, Jorge
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Coddington @ 2026-10-26 23:44 UTC (permalink / raw)
  To: Jorge Mora; +Cc: linux-nfs, trondmy, anna, Rakesh.Bhargava, Mohit.Kumar, mora

On 24 Oct 2026, at 7:08, Jorge Mora wrote:

> From: Rakesh Bhargava <Rakesh.Bhargava@netapp.com>

Hi Jorge, Rakesh — this is the same change as "NFSv4/flexfiles: Bound page
coalescing on the absolute stripe offset" (v4 06/24 of the flexfiles
device-notification series), which Anna has in her linux-next as
a84c62c4f037. Your base, 18a80121193c, is from Trond's tree and predates it.

Ben

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] NFSv4/flexfiles: calculate stripe boundaries from the file offset
  2026-10-26 23:44 ` Benjamin Coddington
@ 2026-10-28  0:48   ` Mora, Jorge
  0 siblings, 0 replies; 3+ messages in thread
From: Mora, Jorge @ 2026-10-28  0:48 UTC (permalink / raw)
  To: Benjamin Coddington, Jorge Mora
  Cc: linux-nfs@vger.kernel.org, trondmy@kernel.org, anna@kernel.org,
	Bhargava, Rakesh, Kumar, Mohit

Thank you Ben! Hope you’re doing well.

--Jorge

________________________________________
From: Benjamin Coddington <ben.coddington@hammerspace.com>
Sent: Monday, October 26, 2026 5:44 PM
To: Jorge Mora
Cc: linux-nfs@vger.kernel.org; trondmy@kernel.org; anna@kernel.org; Bhargava, Rakesh; Kumar, Mohit; Mora, Jorge
Subject: Re: [PATCH] NFSv4/flexfiles: calculate stripe boundaries from the file offset

EXTERNAL EMAIL - USE CAUTION when clicking links or attachments




On 24 Oct 2026, at 7:08, Jorge Mora wrote:

> From: Rakesh Bhargava <Rakesh.Bhargava@netapp.com>

Hi Jorge, Rakesh — this is the same change as "NFSv4/flexfiles: Bound page
coalescing on the absolute stripe offset" (v4 06/24 of the flexfiles
device-notification series), which Anna has in her linux-next as
a84c62c4f037. Your base, 18a80121193c, is from Trond's tree and predates it.

Ben

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-28  0:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-24 14:08 [PATCH] NFSv4/flexfiles: calculate stripe boundaries from the file offset Jorge Mora
2026-10-26 23:44 ` Benjamin Coddington
2026-10-28  0:48   ` Mora, Jorge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox