[PATCH v3 0/4] NFSD: Impl multiple extents in block/scsi layoutget

Sergey Bashirov posted 4 patches 2 months, 2 weeks ago
fs/nfsd/blocklayout.c    | 154 +++++++++++++++++++++++++++------------
fs/nfsd/blocklayoutxdr.c |  36 ++++++---
fs/nfsd/blocklayoutxdr.h |  14 ++++
3 files changed, 147 insertions(+), 57 deletions(-)
[PATCH v3 0/4] NFSD: Impl multiple extents in block/scsi layoutget
Posted by Sergey Bashirov 2 months, 2 weeks ago
Implement support for multiple extents in the LAYOUTGET response
for two main reasons.

First, it avoids unnecessary RPC calls. For files consisting of many
extents, especially large ones, too many LAYOUTGET requests are observed
in Wireshark traces.

Second, due to the current limitation on returning a single extent,
the client can only reliably request layouts with minimum length set
to 4K. Otherwise, NFS4ERR_LAYOUTUNAVAILABLE may be returned if XFS
allocated a 4K extent within the requested range.

We are using the ability to request layouts with a minimum length
greater than 4K to fix/workaround a bug in the client. I will prepare
the client's patch for review too.

Below is an example of multiple extents in the LAYOUTGET response
captured using Wireshark.

Network File System, Ops(3): SEQUENCE, PUTFH, LAYOUTGET
    [Program Version: 4]
    [V4 Procedure: COMPOUND (1)]
    Tag: <EMPTY>
        length: 0
        contents: <EMPTY>
    minorversion: 2
    Operations (count: 3): SEQUENCE, PUTFH, LAYOUTGET
        Opcode: SEQUENCE (53)
        Opcode: PUTFH (22)
        Opcode: LAYOUTGET (50)
            layout available?: No
            layout type: LAYOUT4_BLOCK_VOLUME (3)
            IO mode: IOMODE_RW (2)
            offset: 0
            length: 10485760
            min length: 16384
            StateID
            maxcount: 4096
    [Main Opcode: LAYOUTGET (50)]

Network File System, Ops(3): SEQUENCE PUTFH LAYOUTGET
    [Program Version: 4]
    [V4 Procedure: COMPOUND (1)]
    Status: NFS4_OK (0)
    Tag: <EMPTY>
        length: 0
        contents: <EMPTY>
    Operations (count: 3)
        Opcode: SEQUENCE (53)
        Opcode: PUTFH (22)
        Opcode: LAYOUTGET (50)
            Status: NFS4_OK (0)
            return on close?: Yes
            StateID
            Layout Segment (count: 1)
                offset: 0
                length: 385024
                IO mode: IOMODE_RW (2)
                layout type: LAYOUT4_BLOCK_VOLUME (3)
                layout: <DATA>
                    length: 4052
                    contents: <DATA>
    [Main Opcode: LAYOUTGET (50)]
pNFS Block Layout Extents
    bex_count: 92
    BEX[0]
    BEX[1]
    BEX[2]
    ...

Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com>
---
Changes in v3:
 - Added a Fixes tag
 - Removed an unnecessary sentence from the commit message

Sergey Bashirov (4):
  NFSD/blocklayout: Fix minlength check in proc_layoutget
  NFSD/blocklayout: Extract extent mapping from proc_layoutget
  NFSD/blocklayout: Introduce layout content structure
  NFSD/blocklayout: Support multiple extents per LAYOUTGET

 fs/nfsd/blocklayout.c    | 154 +++++++++++++++++++++++++++------------
 fs/nfsd/blocklayoutxdr.c |  36 ++++++---
 fs/nfsd/blocklayoutxdr.h |  14 ++++
 3 files changed, 147 insertions(+), 57 deletions(-)

-- 
2.43.0
Re: [PATCH v3 0/4] NFSD: Impl multiple extents in block/scsi layoutget
Posted by Chuck Lever 2 months, 1 week ago
From: Chuck Lever <chuck.lever@oracle.com>

On Fri, 03 Oct 2025 12:11:02 +0300, Sergey Bashirov wrote:
> Implement support for multiple extents in the LAYOUTGET response
> for two main reasons.
> 
> First, it avoids unnecessary RPC calls. For files consisting of many
> extents, especially large ones, too many LAYOUTGET requests are observed
> in Wireshark traces.
> 
> [...]

Applied to nfsd-testing, thanks!

[1/4] NFSD/blocklayout: Fix minlength check in proc_layoutget
      commit: b94708d49420881366669b7010269f159a6e1b70
[2/4] NFSD/blocklayout: Extract extent mapping from proc_layoutget
      commit: 88f8b3f8c4fc8c351aaae49d0fec4e7b5e6ad0db
[3/4] NFSD/blocklayout: Introduce layout content structure
      commit: 76fc273123889e9b1629fc9f1ec40465dbda1a73
[4/4] NFSD/blocklayout: Support multiple extents per LAYOUTGET
      commit: 8a3c46f07fb5c3cd6c1cc807d9a22e1531100625

--
Chuck Lever <chuck.lever@oracle.com>