From: Chuck Lever <chuck.lever@oracle.com>
To: Christoph Hellwig <hch@infradead.org>,
Sergey Bashirov <sergeybashirov@gmail.com>
Cc: Jeff Layton <jlayton@kernel.org>, NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] NFSD: Impl multiple extents in block/scsi layoutget
Date: Mon, 29 Sep 2025 08:57:49 -0400 [thread overview]
Message-ID: <ab4428b2-9b0b-45a8-826a-455807316e49@oracle.com> (raw)
In-Reply-To: <aNo0BCzVQxR60qeT@infradead.org>
On 9/29/25 12:23 AM, Christoph Hellwig wrote:
> The subject line is odd. What is impl supposed to mean?
>
> I'd say something like:
>
> nfsd/blocklayout: support multiple extent per LAYOUTGET
>
> On Thu, Sep 11, 2025 at 07:02:03PM +0300, Sergey Bashirov wrote:
>> This patch allows the pNFS server to respond with multiple extents
>
> This patch is redundant and should generally be avoided in commit log.
To put this another way, the patch description should explain "why" you
want this change -- what's the benefit going to be. And maybe a little
"how" it is done, if that isn't obvious from the diff.
>> Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com>
>> ---
>> Checked with smatch, tested on pNFS block volume setup.
>
> Any chance we could get testing for this added to pynfs?
>
> Also what is this patch against? If fails to apply to linux-next for
> me.
>
>> +/**
>> + * nfsd4_block_map_extent - get extent that covers the start of segment
>> + * @inode: inode of the file requested by the client
>> + * @fhp: handle of the file requested by the client
>> + * @seg: layout subrange requested by the client
>> + * @minlength: layout min length requested by the client
>> + * @bex: output block extent structure
>> + *
>> + * Get an extent from the file system that starts at @seg->offset or below,
>> + * but may be shorter than @seg->length.
>> + *
>> + * Return values:
>> + * %nfs_ok: Success, @bex is initialized and valid
>> + * %nfserr_layoutunavailable: Failed to get extent for requested @seg
>> + * OS errors converted to NFS errors
>> + */
>
> I'm not sure how Chuck handles this, but kerneldoc comments for static
> functions and thus not as public documentation can be really annoying
> due to the verbose formatting of the paramters. I'd generally avoid
> them and instead of have short comments explaining the interesting bits
> about the calling convention and/or functionality.
For NFSD, the tradition is to avoid kdoc comments for static functions
unless they are the target of a virtual function call.
Static functions otherwise can have big comments. Just not kdoc style.
>> +nfsd4_block_map_extent(struct inode *inode, const struct svc_fh *fhp,
>> + const struct nfsd4_layout_seg *seg, u64 minlength,
>> + struct pnfs_block_extent *bex)
>> {
>> struct super_block *sb = inode->i_sb;
>> struct iomap iomap;
>> u32 device_generation = 0;
>> int error;
>>
>> - if (locks_in_grace(SVC_NET(rqstp)))
>> - return nfserr_grace;
>> -
>> - if (seg->offset & (block_size - 1)) {
>> - dprintk("pnfsd: I/O misaligned\n");
>> - goto out_layoutunavailable;
>> - }
>> -
>
> There is a lot of code movement here mixed with functional changes,
> which makes it very hard to follow. Any chance you could first
> split the functions, then introduce the new pnfs_block_layout structure
> and only then actually add multiple extents per layoutget? That'll
> make it a lot easier there are no unintended changes.
>
>> + * %nfserr_layoutunavailable: Failed to get extents for requested @seg
>> + * OS errors converted to NFS errors
>> + */
>> +static __be32
>> +nfsd4_block_map_segment(struct inode *inode, const struct svc_fh *fhp,
>> + const struct nfsd4_layout_seg *seg, u64 minlength,
>> + struct pnfs_block_layout *bl)
>
> I struggle to see what the point of the nfsd4_block_map_segment helpers
> is, as it seems to add no real value while making the code harder to
> follow.
>
>> +{
>> + struct nfsd4_layout_seg subseg = *seg;
>> + u32 i;
>> + __be32 nfserr;
>
> Nit: nfserr can be local in the loop.
>
> The subextent handling confuses me a bit - there is no such thing
> as a subsegment in NFS. I'd pass a never changing end of layout,
> a moving offset, and a constant iomode directly, which should simply
> the code quite a bit, i.e. something like:
>
> u64 map_start = seg->offset;
> u64 seg_end = seg->offset + seg->len;
>
> for (..) {
>
> nfserr = nfsd4_block_map_extent(inode, fhp, ...
> map_start, &end);
> if (end > seg_end) {
> bl->nr_extents = i + 1;
> break;
> }
>
> map_start = end;
> }
>
>
>> +nfsd4_block_proc_layoutget(struct svc_rqst *rqstp, struct inode *inode,
>> + const struct svc_fh *fhp, struct nfsd4_layoutget *args)
>> +{
>> + struct nfsd4_layout_seg *seg = &args->lg_seg;
>> + u64 seg_length;
>> + struct pnfs_block_extent *first_bex, *last_bex;
>> + struct pnfs_block_layout *bl;
>> + u32 nr_extents_max = PAGE_SIZE / sizeof(bl->extents[0]) - 1;
>
> Where is that -1 coming from? Or the magic PAGE_SIZE?
>
--
Chuck Lever
next prev parent reply other threads:[~2025-09-29 12:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-11 16:02 Sergey Bashirov
2025-09-11 18:05 ` Chuck Lever
2025-09-15 18:20 ` Dai Ngo
2025-09-15 21:12 ` Dai Ngo
2025-09-29 7:23 ` Christoph Hellwig
2025-09-29 12:57 ` Chuck Lever [this message]
2025-09-29 19:13 ` Sergey Bashirov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab4428b2-9b0b-45a8-826a-455807316e49@oracle.com \
--to=chuck.lever@oracle.com \
--cc=Dai.Ngo@oracle.com \
--cc=hch@infradead.org \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=sergeybashirov@gmail.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®