* [PATCH 1/2] NFSv4/flexfiles: calculate stripe boundaries from the file offset
[not found] <20261022164046.38079-1-mora@netapp.com>
@ 2026-10-22 16:40 ` Jorge Mora
0 siblings, 0 replies; 3+ messages in thread
From: Jorge Mora @ 2026-10-22 16:40 UTC (permalink / raw)
To: Jorge.Mora; +Cc: jorge_luis_mora, Jorge Mora, stable
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")
Cc: stable@vger.kernel.org
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 7fe8b91fa..09d44de26 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;
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/2] NFSv4/flexfiles: calculate stripe boundaries from the file offset
[not found] <20261022164826.38125-1-mora@netapp.com>
@ 2026-10-22 16:48 ` Jorge Mora
2026-10-22 17:11 ` Mora, Jorge
0 siblings, 1 reply; 3+ messages in thread
From: Jorge Mora @ 2026-10-22 16:48 UTC (permalink / raw)
To: Jorge.Mora, jorge_luis_mora; +Cc: Jorge Mora, stable
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")
Cc: stable@vger.kernel.org
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 7fe8b91fa..09d44de26 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;
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] NFSv4/flexfiles: calculate stripe boundaries from the file offset
2026-10-22 16:48 ` Jorge Mora
@ 2026-10-22 17:11 ` Mora, Jorge
0 siblings, 0 replies; 3+ messages in thread
From: Mora, Jorge @ 2026-10-22 17:11 UTC (permalink / raw)
To: Jorge Mora, jorge_luis_mora@yahoo.com; +Cc: stable@vger.kernel.org
Please disregard this message.
I was testing my git sendmail configuration and it automatically send it to stable@vger.kernel.org even though I did not add it to --to or --cc list. Also, this is no my patch and the author will re-send it soon.
________________________________________
From: Jorge Mora <jmora1300@gmail.com>
Sent: Thursday, October 22, 2026 10:48 AM
To: Mora, Jorge; jorge_luis_mora@yahoo.com
Cc: Mora, Jorge; stable@vger.kernel.org
Subject: [PATCH 1/2] NFSv4/flexfiles: calculate stripe boundaries from the file offset
[You don't often get email from jmora1300@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
EXTERNAL EMAIL - USE CAUTION when clicking links or attachments
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")
Cc: stable@vger.kernel.org
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 7fe8b91fa..09d44de26 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;
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-22 17:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261022164046.38079-1-mora@netapp.com>
2026-10-22 16:40 ` [PATCH 1/2] NFSv4/flexfiles: calculate stripe boundaries from the file offset Jorge Mora
[not found] <20261022164826.38125-1-mora@netapp.com>
2026-10-22 16:48 ` Jorge Mora
2026-10-22 17:11 ` Mora, Jorge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox