Blob Blame History Raw
From: Olga Kornievskaia <olga.kornievskaia@gmail.com>
Date: Tue, 20 Dec 2022 12:31:29 -0500
Subject: [PATCH] pNFS/filelayout: Fix coalescing test for single DS
Git-commit: a6b9d2fa0024e7e399c26facd0fb466b7396e2b9
Patch-mainline: v6.2
References: git-fixes

When there is a single DS no striping constraints need to be placed on
the IO. When such constraint is applied then buffered reads don't
coalesce to the DS's rsize.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Acked-by: NeilBrown <neilb@suse.com>

---
 fs/nfs/filelayout/filelayout.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -865,6 +865,12 @@ filelayout_alloc_lseg(struct pnfs_layout
 	return &fl->generic_hdr;
 }
 
+static bool
+filelayout_lseg_is_striped(const struct nfs4_filelayout_segment *flseg)
+{
+	return flseg->num_fh > 1;
+}
+
 /*
  * filelayout_pg_test(). Called by nfs_can_coalesce_requests()
  *
@@ -885,6 +891,8 @@ filelayout_pg_test(struct nfs_pageio_des
 	size = pnfs_generic_pg_test(pgio, prev, req);
 	if (!size)
 		return 0;
+	else if (!filelayout_lseg_is_striped(FILELAYOUT_LSEG(pgio->pg_lseg)))
+		return size;
 
 	/* see if req and prev are in the same stripe */
 	if (prev) {