linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Benny Halevy <bhalevy@panasas.com>
Cc: linux-nfs@vger.kernel.org, pnfs@linux-nfs.org
Subject: Re: [PATCH 27/46] NFS: update hdr->replen for every encode op
Date: Sun, 29 Mar 2009 13:46:49 -0400	[thread overview]
Message-ID: <1238348809.23986.4.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <1236124713-3736-1-git-send-email-bhalevy@panasas.com>

On Tue, 2009-03-03 at 16:58 -0700, Benny Halevy wrote:
> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
> ---
>  fs/nfs/nfs4xdr.c |   31 +++++++++++++++++++++++++++++++
>  1 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
> index 5d665a1..e6f2d84 100644
> --- a/fs/nfs/nfs4xdr.c
> +++ b/fs/nfs/nfs4xdr.c
> @@ -753,6 +753,7 @@ static void encode_access(struct xdr_stream *xdr,
> u32 access, struct compound_hd
>         WRITE32(OP_ACCESS);
>         WRITE32(access);
>         hdr->nops++;
> +       hdr->replen += decode_access_maxsz;
>  }
> 
>  static void encode_close(struct xdr_stream *xdr, const struct
> nfs_closeargs *arg, struct compound_hdr *hdr)
> @@ -764,6 +765,7 @@ static void encode_close(struct xdr_stream *xdr,
> const struct nfs_closeargs *arg
>         WRITE32(arg->seqid->sequence->counter);
>         WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE);
>         hdr->nops++;
> +       hdr->replen += decode_close_maxsz;
>  }
> 
>  static void encode_commit(struct xdr_stream *xdr, const struct
> nfs_writeargs *args, struct compound_hdr *hdr)
> @@ -775,6 +777,7 @@ static void encode_commit(struct xdr_stream *xdr,
> const struct nfs_writeargs *ar
>         WRITE64(args->offset);
>         WRITE32(args->count);
>         hdr->nops++;
> +       hdr->replen += decode_commit_maxsz;
>  }
> 
>  static void encode_create(struct xdr_stream *xdr, const struct
> nfs4_create_arg *create, struct compound_hdr *hdr)
> @@ -806,6 +809,7 @@ static void encode_create(struct xdr_stream *xdr,
> const struct nfs4_create_arg *
>         WRITE32(create->name->len);
>         WRITEMEM(create->name->name, create->name->len);
>         hdr->nops++;
> +       hdr->replen += decode_create_maxsz;
> 
>         encode_attrs(xdr, create->attrs, create->server);
>  }
> @@ -819,6 +823,7 @@ static void encode_getattr_one(struct xdr_stream
> *xdr, uint32_t bitmap, struct c
>         WRITE32(1);
>         WRITE32(bitmap);
>         hdr->nops++;
> +       hdr->replen += decode_getattr_maxsz;
>  }
> 
>  static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0,
> uint32_t bm1, struct compound_hdr *hdr)
> @@ -831,6 +836,7 @@ static void encode_getattr_two(struct xdr_stream
> *xdr, uint32_t bm0, uint32_t bm
>         WRITE32(bm0);
>         WRITE32(bm1);
>         hdr->nops++;
> +       hdr->replen += decode_getattr_maxsz;
>  }

Hmm... Not always true, as I pointed out w.r.t. fs_locations. Perhaps we
should add an encode_getfattr() for the generic case, and keep
fs_locations as special.

>  static void encode_getfattr(struct xdr_stream *xdr, const u32*
> bitmask, struct compound_hdr *hdr)
> @@ -858,6 +864,7 @@ static void encode_getfh(struct xdr_stream *xdr,
> struct compound_hdr *hdr)
>         RESERVE_SPACE(4);
>         WRITE32(OP_GETFH);
>         hdr->nops++;
> +       hdr->replen += decode_getfh_maxsz;
>  }
> 
>  static void encode_link(struct xdr_stream *xdr, const struct qstr
> *name, struct compound_hdr *hdr)
> @@ -869,6 +876,7 @@ static void encode_link(struct xdr_stream *xdr,
> const struct qstr *name, struct
>         WRITE32(name->len);
>         WRITEMEM(name->name, name->len);
>         hdr->nops++;
> +       hdr->replen += decode_link_maxsz;
>  }
> 
>  static inline int nfs4_lock_type(struct file_lock *fl, int block)
> @@ -916,6 +924,7 @@ static void encode_lock(struct xdr_stream *xdr,
> const struct nfs_lock_args *args
>                 WRITE32(args->lock_seqid->sequence->counter);
>         }
>         hdr->nops++;
> +       hdr->replen += decode_lock_maxsz;
>  }
> 
>  static void encode_lockt(struct xdr_stream *xdr, const struct
> nfs_lockt_args *args, struct compound_hdr *hdr)
> @@ -932,6 +941,7 @@ static void encode_lockt(struct xdr_stream *xdr,
> const struct nfs_lockt_args *ar
>         WRITEMEM("lock id:", 8);
>         WRITE64(args->lock_owner.id);
>         hdr->nops++;
> +       hdr->replen += decode_lockt_maxsz;
>  }
> 
>  static void encode_locku(struct xdr_stream *xdr, const struct
> nfs_locku_args *args, struct compound_hdr *hdr)
> @@ -946,6 +956,7 @@ static void encode_locku(struct xdr_stream *xdr,
> const struct nfs_locku_args *ar
>         WRITE64(args->fl->fl_start);
>         WRITE64(nfs4_lock_length(args->fl));
>         hdr->nops++;
> +       hdr->replen += decode_locku_maxsz;
>  }
> 
>  static void encode_lookup(struct xdr_stream *xdr, const struct qstr
> *name, struct compound_hdr *hdr)
> @@ -958,6 +969,7 @@ static void encode_lookup(struct xdr_stream *xdr,
> const struct qstr *name, struc
>         WRITE32(len);
>         WRITEMEM(name->name, len);
>         hdr->nops++;
> +       hdr->replen += decode_lookup_maxsz;
>  }
> 
>  static void encode_share_access(struct xdr_stream *xdr, fmode_t
> fmode)
> @@ -1097,6 +1109,7 @@ static void encode_open(struct xdr_stream *xdr,
> const struct nfs_openargs *arg,
>                 BUG();
>         }
>         hdr->nops++;
> +       hdr->replen += decode_open_maxsz;
>  }
> 
>  static void encode_open_confirm(struct xdr_stream *xdr, const struct
> nfs_open_confirmargs *arg, struct compound_hdr *hdr)
> @@ -1108,6 +1121,7 @@ static void encode_open_confirm(struct
> xdr_stream *xdr, const struct nfs_open_co
>         WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE);
>         WRITE32(arg->seqid->sequence->counter);
>         hdr->nops++;
> +       hdr->replen += decode_open_confirm_maxsz;
>  }
> 
>  static void encode_open_downgrade(struct xdr_stream *xdr, const
> struct nfs_closeargs *arg, struct compound_hdr *hdr)
> @@ -1120,6 +1134,7 @@ static void encode_open_downgrade(struct
> xdr_stream *xdr, const struct nfs_close
>         WRITE32(arg->seqid->sequence->counter);
>         encode_share_access(xdr, arg->fmode);
>         hdr->nops++;
> +       hdr->replen += decode_open_downgrade_maxsz;
>  }
> 
>  static void
> @@ -1133,6 +1148,7 @@ encode_putfh(struct xdr_stream *xdr, const
> struct nfs_fh *fh, struct compound_hd
>         WRITE32(len);
>         WRITEMEM(fh->data, len);
>         hdr->nops++;
> +       hdr->replen += decode_putfh_maxsz;
>  }
> 
>  static void encode_putrootfh(struct xdr_stream *xdr, struct
> compound_hdr *hdr)
> @@ -1142,6 +1158,7 @@ static void encode_putrootfh(struct xdr_stream
> *xdr, struct compound_hdr *hdr)
>         RESERVE_SPACE(4);
>         WRITE32(OP_PUTROOTFH);
>         hdr->nops++;
> +       hdr->replen += decode_putrootfh_maxsz;
>  }
> 
>  static void encode_stateid(struct xdr_stream *xdr, const struct
> nfs_open_context *ctx)
> @@ -1170,6 +1187,7 @@ static void encode_read(struct xdr_stream *xdr,
> const struct nfs_readargs *args,
>         WRITE64(args->offset);
>         WRITE32(args->count);
>         hdr->nops++;
> +       hdr->replen += decode_read_maxsz;
>  }
> 
>  static void encode_readdir(struct xdr_stream *xdr, const struct
> nfs4_readdir_arg *readdir, struct rpc_rqst *req, struct compound_hdr
> *hdr)
> @@ -1195,6 +1213,7 @@ static void encode_readdir(struct xdr_stream
> *xdr, const struct nfs4_readdir_arg
>         WRITE32(attrs[0] & readdir->bitmask[0]);
>         WRITE32(attrs[1] & readdir->bitmask[1]);
>         hdr->nops++;
> +       hdr->replen += decode_readdir_maxsz;
>         dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %
> 08x:%08x\n",
>                         __func__,
>                         (unsigned long long)readdir->cookie,
> @@ -1211,6 +1230,7 @@ static void encode_readlink(struct xdr_stream
> *xdr, const struct nfs4_readlink *
>         RESERVE_SPACE(4);
>         WRITE32(OP_READLINK);
>         hdr->nops++;
> +       hdr->replen += decode_readlink_maxsz;
>  }
> 
>  static void encode_remove(struct xdr_stream *xdr, const struct qstr
> *name, struct compound_hdr *hdr)
> @@ -1222,6 +1242,7 @@ static void encode_remove(struct xdr_stream
> *xdr, const struct qstr *name, struc
>         WRITE32(name->len);
>         WRITEMEM(name->name, name->len);
>         hdr->nops++;
> +       hdr->replen += decode_remove_maxsz;
>  }
> 
>  static void encode_rename(struct xdr_stream *xdr, const struct qstr
> *oldname, const struct qstr *newname, struct compound_hdr *hdr)
> @@ -1237,6 +1258,7 @@ static void encode_rename(struct xdr_stream
> *xdr, const struct qstr *oldname, co
>         WRITE32(newname->len);
>         WRITEMEM(newname->name, newname->len);
>         hdr->nops++;
> +       hdr->replen += decode_rename_maxsz;
>  }
> 
>  static void encode_renew(struct xdr_stream *xdr, const struct
> nfs_client *client_stateid, struct compound_hdr *hdr)
> @@ -1247,6 +1269,7 @@ static void encode_renew(struct xdr_stream *xdr,
> const struct nfs_client *client
>         WRITE32(OP_RENEW);
>         WRITE64(client_stateid->cl_clientid);
>         hdr->nops++;
> +       hdr->replen += decode_renew_maxsz;
>  }
> 
>  static void
> @@ -1257,6 +1280,7 @@ encode_restorefh(struct xdr_stream *xdr, struct
> compound_hdr *hdr)
>         RESERVE_SPACE(4);
>         WRITE32(OP_RESTOREFH);
>         hdr->nops++;
> +       hdr->replen += decode_restorefh_maxsz;
>  }
> 
>  static int
> @@ -1276,6 +1300,7 @@ encode_setacl(struct xdr_stream *xdr, struct
> nfs_setaclargs *arg, struct compoun
>         WRITE32(arg->acl_len);
>         xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase,
> arg->acl_len);
>         hdr->nops++;
> +       hdr->replen += decode_setacl_maxsz;
>         return 0;
>  }
> 
> @@ -1287,6 +1312,7 @@ encode_savefh(struct xdr_stream *xdr, struct
> compound_hdr *hdr)
>         RESERVE_SPACE(4);
>         WRITE32(OP_SAVEFH);
>         hdr->nops++;
> +       hdr->replen += decode_savefh_maxsz;
>  }
> 
>  static void encode_setattr(struct xdr_stream *xdr, const struct
> nfs_setattrargs *arg, const struct nfs_server *server, struct
> compound_hdr *hdr)
> @@ -1297,6 +1323,7 @@ static void encode_setattr(struct xdr_stream
> *xdr, const struct nfs_setattrargs
>         WRITE32(OP_SETATTR);
>         WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE);
>         hdr->nops++;
> +       hdr->replen += decode_setattr_maxsz;
>         encode_attrs(xdr, arg->iap, server);
>  }
> 
> @@ -1316,6 +1343,7 @@ static void encode_setclientid(struct xdr_stream
> *xdr, const struct nfs4_setclie
>         RESERVE_SPACE(4);
>         WRITE32(setclientid->sc_cb_ident);
>         hdr->nops++;
> +       hdr->replen += decode_setclientid_maxsz;
>  }
> 
>  static void encode_setclientid_confirm(struct xdr_stream *xdr, const
> struct nfs_client *client_state, struct compound_hdr *hdr)
> @@ -1327,6 +1355,7 @@ static void encode_setclientid_confirm(struct
> xdr_stream *xdr, const struct nfs_
>         WRITE64(client_state->cl_clientid);
>         WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE);
>         hdr->nops++;
> +       hdr->replen += decode_setclientid_confirm_maxsz;
>  }
> 
>  static void encode_write(struct xdr_stream *xdr, const struct
> nfs_writeargs *args, struct compound_hdr *hdr)
> @@ -1345,6 +1374,7 @@ static void encode_write(struct xdr_stream *xdr,
> const struct nfs_writeargs *arg
> 
>         xdr_write_pages(xdr, args->pages, args->pgbase, args->count);
>         hdr->nops++;
> +       hdr->replen += decode_write_maxsz;
>  }
> 
>  static void encode_delegreturn(struct xdr_stream *xdr, const
> nfs4_stateid *stateid, struct compound_hdr *hdr)
> @@ -1356,6 +1386,7 @@ static void encode_delegreturn(struct xdr_stream
> *xdr, const nfs4_stateid *state
>         WRITE32(OP_DELEGRETURN);
>         WRITEMEM(stateid->data, NFS4_STATEID_SIZE);
>         hdr->nops++;
> +       hdr->replen += decode_delegreturn_maxsz;
>  }
>  /*
>   * END OF "GENERIC" ENCODE ROUTINES.
> --
> 1.6.1.3
> 
> 
> 
-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com

  reply	other threads:[~2009-03-29 17:56 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 [this message]
     [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   ` [pnfs] " Benny Halevy
2009-03-30 12:40   ` 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=1238348809.23986.4.camel@heimdal.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=bhalevy@panasas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).