From: Benny Halevy <bhalevy@tonian.com>
To: Tigran Mkrtchyan <kofemann@googlemail.com>
Cc: linux-nfs@vger.kernel.org, Tigran Mkrtchyan <kofemann@gmail.com>
Subject: Re: [PATH v3 5/5] nfsd41: use pinter to current stateid to avoid extra copy
Date: Mon, 12 Dec 2011 17:55:46 +0200 [thread overview]
Message-ID: <4EE62402.6050008@tonian.com> (raw)
In-Reply-To: <1323621708-25138-6-git-send-email-tigran.mkrtchyan@desy.de>
On 2011-12-11 18:41, Tigran Mkrtchyan wrote:
> From: Tigran Mkrtchyan <kofemann@gmail.com>
>
>
> Signed-off-by: Tigran Mkrtchyan <kofemann@gmail.com>
> ---
> fs/nfsd/nfs4proc.c | 6 +-----
> fs/nfsd/nfs4state.c | 7 +++----
> fs/nfsd/xdr4.h | 3 +--
> 3 files changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index f2f7dfa..b7d1a7b 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1126,10 +1126,7 @@ static bool need_wrongsec_check(struct svc_rqst *rqstp)
> static void
> nfsd4_clear_currentstateid(struct nfsd4_compound_state *cstate)
> {
> - if (cstate->has_stateid) {
> - memset(&cstate->current_stateid, 0, sizeof(stateid_t));
> - cstate->has_stateid = false;
> - }
> + cstate->current_stateid = NULL;
> }
> /*
> * COMPOUND call.
> @@ -1244,7 +1241,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
> if (!op->status) {
> if (opdesc->op_flags & PROVIDES_CURRENT_STATEID) {
> opdesc->op_set_currentstateid(cstate, &op->u);
> - cstate->has_stateid = true;
> }
>
> if (opdesc->op_flags & CLEARS_CURRENT_STATEID)
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index d7b8f25..be77cd3 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4553,16 +4553,15 @@ nfs4_state_shutdown(void)
> static void
> get_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid)
> {
> - if (cstate->has_stateid && CURRENT_STATEID(stateid))
> - memcpy(stateid, &cstate->current_stateid, sizeof(stateid_t));
> + if (cstate->current_stateid && CURRENT_STATEID(stateid))
> + memcpy(stateid, cstate->current_stateid, sizeof(stateid_t));
> }
>
> static void
> put_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid)
> {
> if (cstate->minorversion) {
> - memcpy(&cstate->current_stateid, stateid, sizeof(stateid_t));
> - cstate->has_stateid = true;
> + cstate->current_stateid = stateid;
> }
> }
>
> diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
> index b8435d20..0ad0846 100644
> --- a/fs/nfsd/xdr4.h
> +++ b/fs/nfsd/xdr4.h
> @@ -54,8 +54,7 @@ struct nfsd4_compound_state {
> size_t iovlen;
> u32 minorversion;
> u32 status;
> - stateid_t current_stateid;
> - bool has_stateid;
> + stateid_t *current_stateid;
Certainly looks neat. I'm all for squashing this part of the patchset,
or just all of it...
Better be defined as const stateid_t * so its contents would be read only
for its consumers.
Benny
> };
>
> static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
next prev parent reply other threads:[~2011-12-12 19:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-11 16:41 [PATH v3 0/5] nfsd41: current state id processing Tigran Mkrtchyan
2011-12-11 16:41 ` [PATH v3 1/5] nfsd41: handle current stateid in open and close Tigran Mkrtchyan
2011-12-12 15:21 ` Benny Halevy
2011-12-12 16:04 ` J. Bruce Fields
2011-12-12 16:42 ` Tigran Mkrtchyan
2011-12-12 16:42 ` Tigran Mkrtchyan
2011-12-11 16:41 ` [PATH v3 2/5] nfsd41: handle current stateid on lock and locku Tigran Mkrtchyan
2011-12-11 16:41 ` [PATH v3 3/5] nfsd41: update operations's stateid iff current stateid is set Tigran Mkrtchyan
2011-12-11 16:41 ` [PATH v3 4/5] nfsd41: consume current stateid on read and write Tigran Mkrtchyan
2011-12-11 16:41 ` [PATH v3 5/5] nfsd41: use pinter to current stateid to avoid extra copy Tigran Mkrtchyan
2011-12-12 15:55 ` Benny Halevy [this message]
2011-12-12 20:59 ` Tiramisu Mokka
2011-12-12 19:44 ` [PATH v3 0/5] nfsd41: current state id processing 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=4EE62402.6050008@tonian.com \
--to=bhalevy@tonian.com \
--cc=kofemann@gmail.com \
--cc=kofemann@googlemail.com \
--cc=linux-nfs@vger.kernel.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.