From: Benny Halevy Subject: Re: [PATCH 03/14] nfsd4: remove redundant "if" in nfs4_preprocess_stateid_op Date: Wed, 11 Mar 2009 20:05:31 +0200 Message-ID: <49B7FD6B.5060203@panasas.com> References: <1236731222-3294-1-git-send-email-bfields@fieldses.org> <1236731222-3294-2-git-send-email-bfields@fieldses.org> <1236731222-3294-3-git-send-email-bfields@fieldses.org> <1236731222-3294-4-git-send-email-bfields@fieldses.org> <49B7100E.2000209@cn.fujitsu.com> <20090311012346.GB4495@fieldses.org> <49B7133E.10804@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: linux-nfs@vger.kernel.org To: Yang Hongyang , "J. Bruce Fields" Return-path: Received: from gw-ca.panasas.com ([209.116.51.66]:11484 "EHLO laguna.int.panasas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751342AbZCKSFg (ORCPT ); Wed, 11 Mar 2009 14:05:36 -0400 In-Reply-To: <49B7133E.10804@cn.fujitsu.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: On Mar. 11, 2009, 3:26 +0200, Yang Hongyang wrote: > J. Bruce Fields wrote: >> On Wed, Mar 11, 2009 at 09:12:46AM +0800, Yang Hongyang wrote: >>> J. Bruce Fields wrote: >>>> From: J. Bruce Fields >>>> >>>> Note that we exit this first big "if" with stp == NULL iff we took the >>> ^^ typo >> The "iff"? That's short for "if and only if". I can try to get out of >> the "iff" habit if it's too obscure. > > Sorry for mis-understanding,My pool englishT_T Maybe "if and only if" > are more understandable. Although using this iffy math/cs school lingo does not seem too obscure to me (one can find it easily on the net, e.g. http://www.tfd.com/?Word=iff), as a non-native English speaker I'd be inclined to simplify commentary language as much as possible and refrain from using acronyms if they are not obvious to the linux developers community. Benny > >> --b. >> >>>> first branch; therefore, the second "if" is redundant, and we can just >>>> combine the two, simplifying the logic. >>>> >>>> Signed-off-by: J. Bruce Fields >>>> --- >>>> fs/nfsd/nfs4state.c | 19 ++++++++----------- >>>> 1 files changed, 8 insertions(+), 11 deletions(-) >>>> >>>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c >>>> index d6ca2be..16fcb65 100644 >>>> --- a/fs/nfsd/nfs4state.c >>>> +++ b/fs/nfsd/nfs4state.c >>>> @@ -2087,6 +2087,14 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl >>>> status = check_stateid_generation(stateid, stidp); >>>> if (status) >>>> goto out; >>>> + status = nfs4_check_delegmode(dp, flags); >>>> + if (status) >>>> + goto out; >>>> + renew_client(dp->dl_client); >>>> + if (flags & DELEG_RET) >>>> + unhash_delegation(dp); >>>> + if (filpp) >>>> + *filpp = dp->dl_vfs_file; >>>> } else { /* open or lock stateid */ >>>> stp = find_stateid(stateid, flags); >>>> if (!stp) { >>>> @@ -2101,23 +2109,12 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl >>>> status = check_stateid_generation(stateid, stidp); >>>> if (status) >>>> goto out; >>>> - } >>>> - if (stp) { >>>> status = nfs4_check_openmode(stp, flags); >>>> if (status) >>>> goto out; >>>> renew_client(stp->st_stateowner->so_client); >>>> if (filpp) >>>> *filpp = stp->st_vfs_file; >>>> - } else { >>>> - status = nfs4_check_delegmode(dp, flags); >>>> - if (status) >>>> - goto out; >>>> - renew_client(dp->dl_client); >>>> - if (flags & DELEG_RET) >>>> - unhash_delegation(dp); >>>> - if (filpp) >>>> - *filpp = dp->dl_vfs_file; >>>> } >>>> status = nfs_ok; >>>> out: >>> -- >>> Regards >>> Yang Hongyang >> > >