Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1877803pxk; Tue, 1 Sep 2020 09:50:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy05jHwIhNbStr52sSUcZKn8O3oFG8y9H1+l/jfHhgIoc1Gor2sDjnhgGWZZnmcVe536V/o X-Received: by 2002:a17:906:eb4f:: with SMTP id mc15mr2269073ejb.435.1598979033732; Tue, 01 Sep 2020 09:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598979033; cv=none; d=google.com; s=arc-20160816; b=MQhMqWJx3u78xJ6dFEg69mkGtzB2Mye+PopxO4y63d44MJJWJpglqoCJHVRGlUk18e hdUcd5+XymMTGMF/pdbLjHgGkYDwvmK5qaBPqF/mABTsdmwud/wd/85ZTy4Xicf33mkW PTmhI1Q4ytNef1BoFSGRwzsHrKiZ48ntcw32ualdrao0B0zI/B1WpnLyXGzQu688OtBn 3JMxyC4iKomWLfeWAEeEbpM4p1+8u3N2w73gU52209nSXRdEEYA3bGQiwmZSG1+pBtF0 T+S1Fco7EqZRleswM2pqMO0I/kTiFFbXVICVhpx2OZDOSP6a+PkHaYpYID/oiXn177ZS enNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:from:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:dkim-signature:dkim-filter; bh=YFSwODfeIZpeFJvQnKOhf6BrQ38YBN2aecwmJ1o1CT8=; b=sRWn2z6DOyxie1EogOGf9bFICzwIAK1T39PksUctBg3T/R0/9GiTEMZXz4gHtR22w3 7qFquzDqeiIWhK+4OZfyhfA/w3NNbzkmxnJ8ucIyLBDTCpoAASigO6YAdjihJFwcylmt vkzAaliUNQxWNO5ZRN65xh/TbbdBm20Emxl9qXSsWq4uOt7LHvz3rkEsnYspe8Lzm9er dd8mY7Obaa4kJIY+zQfpGrNfs1zYgvCEEIXbMv5sLCU65KArNpG2QQUd7a6DPeUmdlu0 LEU0dvixaVjw/jnOnYFiO2NIjMzizxL4d8X5mOCDVkrfcJ3mHNvzDO8+OHejW+ivi5nn dJ/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=afexJokt; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si827499edb.410.2020.09.01.09.49.58; Tue, 01 Sep 2020 09:50:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=afexJokt; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730007AbgIAQtl (ORCPT + 99 others); Tue, 1 Sep 2020 12:49:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729627AbgIAQtk (ORCPT ); Tue, 1 Sep 2020 12:49:40 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DCE2C061244 for ; Tue, 1 Sep 2020 09:49:40 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id AB70F6EEB; Tue, 1 Sep 2020 12:49:38 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org AB70F6EEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1598978978; bh=YFSwODfeIZpeFJvQnKOhf6BrQ38YBN2aecwmJ1o1CT8=; h=Date:To:Cc:Subject:References:In-Reply-To:From:From; b=afexJoktLJNCPwVgkZw3qKMKzjNxO/BuIN+wRBsXUPnUkD78C9+Co8QN48qRu/Fog FUZJL4f2Rji2jAA4wNjikDl+2C6pNkfue/uu/0S29+cKEryufwLAgP1gj+PVGUAh10 nNrnm8WC+b2H4uBHkFz1Gr95aD5E1w9X6hBS3AaY= Date: Tue, 1 Sep 2020 12:49:38 -0400 To: Anna Schumaker Cc: "J. Bruce Fields" , Chuck Lever , Linux NFS Mailing List Subject: Re: [PATCH v4 2/5] NFSD: Add READ_PLUS data support Message-ID: <20200901164938.GC12082@fieldses.org> References: <20200817165310.354092-1-Anna.Schumaker@Netapp.com> <20200817165310.354092-3-Anna.Schumaker@Netapp.com> <20200828212521.GA33226@pick.fieldses.org> <20200828215627.GB33226@pick.fieldses.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, Aug 31, 2020 at 02:16:26PM -0400, Anna Schumaker wrote: > On Fri, Aug 28, 2020 at 5:56 PM J. Bruce Fields wrote: > > > > On Fri, Aug 28, 2020 at 05:25:21PM -0400, J. Bruce Fields wrote: > > > On Mon, Aug 17, 2020 at 12:53:07PM -0400, schumaker.anna@gmail.com wrote: > > > > From: Anna Schumaker > > > > > > > > This patch adds READ_PLUS support for returning a single > > > > NFS4_CONTENT_DATA segment to the client. This is basically the same as > > > > the READ operation, only with the extra information about data segments. > > > > > > > > Signed-off-by: Anna Schumaker > > > > --- > > > > fs/nfsd/nfs4proc.c | 17 ++++++++++ > > > > fs/nfsd/nfs4xdr.c | 83 ++++++++++++++++++++++++++++++++++++++++++++-- > > > > 2 files changed, 98 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c > > > > index a09c35f0f6f0..9630d33211f2 100644 > > > > --- a/fs/nfsd/nfs4proc.c > > > > +++ b/fs/nfsd/nfs4proc.c > > > > @@ -2523,6 +2523,16 @@ static inline u32 nfsd4_read_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) > > > > return (op_encode_hdr_size + 2 + XDR_QUADLEN(rlen)) * sizeof(__be32); > > > > } > > > > > > > > +static inline u32 nfsd4_read_plus_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) > > > > +{ > > > > + u32 maxcount = svc_max_payload(rqstp); > > > > + u32 rlen = min(op->u.read.rd_length, maxcount); > > > > + /* enough extra xdr space for encoding either a hole or data segment. */ > > > > + u32 segments = 1 + 2 + 2; > > > > + > > > > + return (op_encode_hdr_size + 2 + segments + XDR_QUADLEN(rlen)) * sizeof(__be32); > > > > > > I'm not sure I understand this calculation. > > > > > > In the final code, there's no fixed limit on the number of segments > > > returned by a single READ_PLUS op, right? > > > > I think the worst-case overhead to represent a hole is around 50 bytes. > > > > So as long as we don't encode any holes less than that, then we can just > > use rlen as an upper bound. > > > > We really don't want to bother encoding small holes. I doubt > > filesystems want to bother with them either. Do they give us any > > guarantees as to the minimum size of a hole? > > The minimum size seems to be PAGE_SIZE from everything I've seen. OK, can we make that assumption explicit? It'd simplify stuff like this. --b.