]> git.baikalelectronics.ru Git - kernel.git/commitdiff
pNFS/filelayout: Fix coalescing test for single DS
authorOlga Kornievskaia <olga.kornievskaia@gmail.com>
Tue, 20 Dec 2022 17:31:29 +0000 (12:31 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 06:17:58 +0000 (07:17 +0100)
[ Upstream commit a6b9d2fa0024e7e399c26facd0fb466b7396e2b9 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/filelayout/filelayout.c

index 98b74cdabb99af5b0774653b9fc446cd4b148186..8c72718d9fe01ec02dda9523502602f44c57028e 100644 (file)
@@ -837,6 +837,12 @@ filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid,
        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()
  *
@@ -857,6 +863,8 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
        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) {