All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org, pnfs@linux-nfs.org
Subject: Re: [pnfs] [PATCH 28/46] NFS: use dynamically computed	compound_hdr.replen for xdr_inline_pages offset
Date: Sun, 29 Mar 2009 22:30:03 +0300	[thread overview]
Message-ID: <49CFCC3B.8070704@panasas.com> (raw)
In-Reply-To: <1236124723-3761-1-git-send-email-bhalevy@panasas.com>

On Mar. 04, 2009, 1:58 +0200, Benny Halevy <bhalevy@panasas.com> wrote:
> As Trond suggested, rather than passing a constant to xdr_inline_pages,
> keep a running count of the expected reply bytes.  In preparation for
> nfs41, where additional op sequence are expteced when talking to nfs41
> servers.
> 
> [NFS: cb_compoundhdr.replen is in words not bytes]
> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
> ---
>  fs/nfs/nfs4xdr.c |   44 ++++++--------------------------------------
>  1 files changed, 6 insertions(+), 38 deletions(-)
> 
> diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
> index e6f2d84..9cec237 100644
> --- a/fs/nfs/nfs4xdr.c
> +++ b/fs/nfs/nfs4xdr.c
> @@ -1757,20 +1757,13 @@ static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct n
>  	struct compound_hdr hdr = {
>  		.minorversion = clp->cl_minorversion,
>  	};
> -	struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
> -	unsigned int replen;
>  
>  	xdr_init_encode(&xdr, &req->rq_snd_buf, p);
>  	encode_compound_hdr(&xdr, req, &hdr);
>  	encode_putfh(&xdr, args->fh, &hdr);
>  	encode_readlink(&xdr, args, req, &hdr);
>  
> -	/* set up reply kvec
> -	 *    toplevel_status + taglen + rescount + OP_PUTFH + status
> -	 *      + OP_READLINK + status + string length = 8
> -	 */
> -	replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readlink_sz) << 2;
> -	xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages,
> +	xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages,
>  			args->pgbase, args->pglen);
>  	encode_nops(&hdr);
>  	return 0;
> @@ -1787,23 +1780,16 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf
>  	struct compound_hdr hdr = {
>  		.minorversion = clp->cl_minorversion,
>  	};
> -	struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
> -	int replen;
>  
>  	xdr_init_encode(&xdr, &req->rq_snd_buf, p);
>  	encode_compound_hdr(&xdr, req, &hdr);
>  	encode_putfh(&xdr, args->fh, &hdr);
>  	encode_readdir(&xdr, args, req, &hdr);
>  
> -	/* set up reply kvec
> -	 *    toplevel_status + taglen + rescount + OP_PUTFH + status
> -	 *      + OP_READDIR + status + verifer(2)  = 9
> -	 */
> -	replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readdir_sz) << 2;
> -	xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages,
> +	xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages,
>  			 args->pgbase, args->count);
>  	dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",
> -			__func__, replen, args->pages,
> +			__func__, hdr.replen << 2, args->pages,
>  			args->pgbase, args->count);
>  	encode_nops(&hdr);
>  	return 0;
> @@ -1814,26 +1800,19 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf
>   */
>  static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
>  {
> -	struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
>  	struct xdr_stream xdr;
>  	struct nfs_client *clp =
>  		(struct nfs_client *)req->rq_task->tk_client->cl_private;
>  	struct compound_hdr hdr = {
>  		.minorversion = clp->cl_minorversion,
>  	};
> -	int replen;
>  
>  	xdr_init_encode(&xdr, &req->rq_snd_buf, p);
>  	encode_compound_hdr(&xdr, req, &hdr);
>  	encode_putfh(&xdr, args->fh, &hdr);
>  	encode_read(&xdr, args, &hdr);
>  
> -	/* set up reply kvec
> -	 *    toplevel status + taglen=0 + rescount + OP_PUTFH + status
> -	 *       + OP_READ + status + eof + datalen = 9
> -	 */
> -	replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_read_sz) << 2;
> -	xdr_inline_pages(&req->rq_rcv_buf, replen,
> +	xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2,
>  			 args->pages, args->pgbase, args->count);
>  	req->rq_rcv_buf.flags |= XDRBUF_READ;
>  	encode_nops(&hdr);
> @@ -1869,22 +1848,18 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p,
>  		struct nfs_getaclargs *args)
>  {
>  	struct xdr_stream xdr;
> -	struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
>  	struct nfs_client *clp =
>  		(struct nfs_client *)req->rq_task->tk_client->cl_private;
>  	struct compound_hdr hdr = {
>  		.minorversion = clp->cl_minorversion,
>  	};
> -	int replen;
>  
>  	xdr_init_encode(&xdr, &req->rq_snd_buf, p);
>  	encode_compound_hdr(&xdr, req, &hdr);
>  	encode_putfh(&xdr, args->fh, &hdr);
>  	encode_getattr_two(&xdr, FATTR4_WORD0_ACL, 0, &hdr);
>  
> -	/* set up reply buffer: */
> -	replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_getacl_sz) << 2;
> -	xdr_inline_pages(&req->rq_rcv_buf, replen,
> +	xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2,
>  		args->acl_pages, args->acl_pgbase, args->acl_len);
>  	encode_nops(&hdr);
>  	return 0;
> @@ -2105,8 +2080,6 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs
>  	struct compound_hdr hdr = {
>  		.minorversion = clp->cl_minorversion,
>  	};
> -	struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
> -	int replen;
>  
>  	xdr_init_encode(&xdr, &req->rq_snd_buf, p);
>  	encode_compound_hdr(&xdr, req, &hdr);
> @@ -2114,12 +2087,7 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs
>  	encode_lookup(&xdr, args->name, &hdr);

To work around the fs_locations issue we can also get hdr.sample
replen here, right before calling encode_fs_locations.

Benny

>  	encode_fs_locations(&xdr, args->bitmask, &hdr);
>  
> -	/* set up reply
> -	 *   toplevel_status + OP_PUTFH + status
> -	 *   + OP_LOOKUP + status + OP_GETATTR + status = 7
> -	 */
> -	replen = (RPC_REPHDRSIZE + auth->au_rslack + 7) << 2;
> -	xdr_inline_pages(&req->rq_rcv_buf, replen, &args->page,
> +	xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, &args->page,
>  			0, PAGE_SIZE);
>  	encode_nops(&hdr);
>  	return 0;

  reply	other threads:[~2009-03-29 19:31 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03 23:28 [PATCH 0/46] nfs41 sessions infrastructure Benny Halevy
2009-03-03 23:51 ` [PATCH 02/46] nfs41: Add Kconfig symbols for NFSv4.1 Benny Halevy
2009-03-03 23:52 ` [PATCH 03/46] nfs41: define NFS4_MAX_MINOR_VERSION based on CONFIG_NFS_V4_1 Benny Halevy
2009-03-03 23:52 ` [PATCH 04/46] nfs41: nfs_client.cl_minorversion Benny Halevy
2009-03-29 16:02   ` Trond Myklebust
     [not found]     ` <1238342562.10999.0.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-03-29 16:57       ` Benny Halevy
2009-03-03 23:52 ` [PATCH 05/46] nfs41: add mount command option minorversion Benny Halevy
2009-03-29 16:18   ` Trond Myklebust
     [not found]     ` <1238343501.10999.6.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-03-30  8:01       ` Benny Halevy
2009-03-03 23:52 ` [PATCH 06/46] nfs41: Use mount minorversion option Benny Halevy
2009-03-29 16:16   ` Trond Myklebust
2009-03-03 23:52 ` [PATCH 07/46] nfs41: translate NFS4ERR_MINOR_VERS_MISMATCH to EPROTONOSUPPORT Benny Halevy
2009-03-03 23:53 ` [PATCH 08/46] nfs41: client xdr definitions Benny Halevy
2009-03-03 23:53 ` [PATCH 09/46] nfs41: sessions client infrastructure Benny Halevy
2009-03-29 16:31   ` Trond Myklebust
     [not found]     ` <1238344265.10999.14.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-03-30  8:30       ` Benny Halevy
2009-03-03 23:53 ` [PATCH 10/46] nfs41: find slot Benny Halevy
2009-03-03 23:53 ` [PATCH 11/46] nfs41: free slot Benny Halevy
2009-03-03 23:53 ` [PATCH 12/46] nfs41: use nfs4_server_caps_arg Benny Halevy
2009-03-03 23:54 ` [PATCH 13/46] nfs41: use nfs4_readlink_res Benny Halevy
2009-03-03 23:54 ` [PATCH 14/46] nfs41: use nfs4_statfs_res Benny Halevy
2009-03-03 23:54 ` [PATCH 15/46] nfs41: use nfs4_fsinfo_res Benny Halevy
2009-03-03 23:54 ` [PATCH 16/46] nfs41: use nfs4_pathconf_res Benny Halevy
2009-03-03 23:54 ` [PATCH 17/46] nfs41: use nfs4_getaclres Benny Halevy
2009-03-29 17:28   ` Trond Myklebust
     [not found]     ` <1238347692.10999.16.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-03-30  8:47       ` Benny Halevy
2009-03-03 23:55 ` [PATCH 18/46] NFS: get rid of unused xdr decode_setattr(, res) argument Benny Halevy
2009-03-03 23:55 ` [PATCH 19/46] nfs41: use nfs4_setaclres Benny Halevy
2009-03-29 17:30   ` Trond Myklebust
     [not found]     ` <1238347823.10999.17.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-03-29 17:48       ` Benny Halevy
2009-03-03 23:55 ` [PATCH 20/46] nfs41: use nfs4_fs_locations_res Benny Halevy
2009-03-03 23:55 ` [PATCH 21/46] sunrpc: add cl_private field to struct rpc_clnt Benny Halevy
2009-03-03 23:55 ` [PATCH 22/46] nfs41: sunrpc: use private void pointer in rpc_clnt Benny Halevy
2009-03-03 23:57 ` [PATCH 23/46] nfs41: encode minorversion in compound header Benny Halevy
2009-03-03 23:57 ` [PATCH 24/46] NFS: fix decode_fs_locations_maxsz Benny Halevy
2009-03-29 17:40   ` Trond Myklebust
     [not found]     ` <1238348417.23986.1.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-03-30 11:32       ` Benny Halevy
2009-03-03 23:58 ` [PATCH 25/46] NFS: use decode_change_info_maxsz for xdr maxsz calculations Benny Halevy
2009-03-03 23:58 ` [PATCH 26/46] NFS: define and initialize compound_hdr.replen Benny Halevy
2009-03-03 23:58 ` [PATCH 27/46] NFS: update hdr->replen for every encode op Benny Halevy
2009-03-29 17:46   ` Trond Myklebust
     [not found]     ` <1238348809.23986.4.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-03-29 19:25       ` Benny Halevy
2009-03-03 23:58 ` [PATCH 28/46] NFS: use dynamically computed compound_hdr.replen for xdr_inline_pages offset Benny Halevy
2009-03-29 19:30   ` Benny Halevy [this message]
2009-03-30 12:40   ` [pnfs] " Benny Halevy
2009-03-03 23:58 ` [PATCH 29/46] nfs41: xdr {encode,decode}_sequence Benny Halevy
2009-03-03 23:59 ` [PATCH 30/46] nfs41: stubs for nfs41 procedures Benny Halevy
2009-03-03 23:59 ` [PATCH 31/46] nfs41: introduce nfs4_call_sync Benny Halevy
2009-03-03 23:59 ` [PATCH 32/46] nfs41: set up seq_res.sr_slotid Benny Halevy
2009-03-03 23:59 ` [PATCH 33/46] nfs41: nfs4_setup_sequence Benny Halevy
2009-03-04  0:00 ` [PATCH 34/46] nfs41: setup_sequence method Benny Halevy
2009-03-04  0:00 ` [PATCH 35/46] nfs41: nfs41_sequence_free_slot Benny Halevy
2009-03-04  0:00 ` [PATCH 36/46] nfs41: nfs41_sequence_done Benny Halevy
2009-03-04  0:00 ` [PATCH 37/46] nfs41: nfs41_call_sync_done Benny Halevy
2009-03-04  0:00 ` [PATCH 38/46] nfs41: close sequence setup/done support Benny Halevy
2009-03-04  0:01 ` [PATCH 39/46] nfs41: open " Benny Halevy
2009-03-04  0:01 ` [PATCH 40/46] nfs41: lock " Benny Halevy
2009-03-04  0:01 ` [PATCH 41/46] nfs41: locku " Benny Halevy
2009-03-04  0:01 ` [PATCH 42/46] nfs41: unlink " Benny Halevy
2009-03-04  0:01 ` [PATCH 43/46] nfs41: read " Benny Halevy
2009-03-04  0:01 ` [PATCH 44/46] nfs41 write sequence setup done support Benny Halevy
2009-03-04  0:02 ` [PATCH 45/46] nfs41 commit " Benny Halevy
2009-03-04  0:02 ` [PATCH 46/46] nfs41 delegreturn " Benny Halevy

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=49CFCC3B.8070704@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=pnfs@linux-nfs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.