From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752532AbdJ0JeB convert rfc822-to-8bit (ORCPT ); Fri, 27 Oct 2017 05:34:01 -0400 Received: from mga07.intel.com ([134.134.136.100]:1784 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752129AbdJ0Jd7 (ORCPT ); Fri, 27 Oct 2017 05:33:59 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,304,1505804400"; d="scan'208";a="165684361" From: "Dilger, Andreas" To: NeilBrown CC: "Drokin, Oleg" , James Simmons , Greg Kroah-Hartman , "lustre-devel@lists.lustre.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 8/9] staging: lustre: ldlm: remove unnecessary 'ownlocks' variable. Thread-Topic: [PATCH 8/9] staging: lustre: ldlm: remove unnecessary 'ownlocks' variable. Thread-Index: AQHTS5mvRZkMc301I0GbOY9vA2caRaL365AA Date: Fri, 27 Oct 2017 09:33:56 +0000 Message-ID: References: <150871988297.3340.4522589460981284121.stgit@noble> <150872002983.3340.10585764760968162389.stgit@noble> In-Reply-To: <150872002983.3340.10585764760968162389.stgit@noble> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.7.56] Content-Type: text/plain; charset="us-ascii" Content-ID: <0891B3EA3CA6F540871F54F34E37C4BD@intel.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Oct 22, 2017, at 18:53, NeilBrown wrote: > > Now that the code has been simplified, 'ownlocks' is not > necessary. > > The loop which sets it exits with 'lock' having the same value as > 'ownlocks', or pointing to the head of the list if ownlocks is NULL. > > The current code then tests ownlocks and sets 'lock' to exactly the > value that it currently has. > > So discard 'ownlocks'. > > Also remove unnecessary initialization of 'lock'. > > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 15 +++------------ > 1 file changed, 3 insertions(+), 12 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c > index 0bf6dce1c5b1..774d8667769a 100644 > --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c > +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c > @@ -115,8 +115,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req) > struct ldlm_resource *res = req->l_resource; > struct ldlm_namespace *ns = ldlm_res_to_ns(res); > struct ldlm_lock *tmp; > - struct ldlm_lock *ownlocks = NULL; > - struct ldlm_lock *lock = NULL; > + struct ldlm_lock *lock; > struct ldlm_lock *new = req; > struct ldlm_lock *new2 = NULL; > enum ldlm_mode mode = req->l_req_mode; > @@ -140,22 +139,14 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req) > /* This loop determines where this processes locks start > * in the resource lr_granted list. > */ > - list_for_each_entry(lock, &res->lr_granted, l_res_link) { > - if (ldlm_same_flock_owner(lock, req)) { > - ownlocks = lock; > + list_for_each_entry(lock, &res->lr_granted, l_res_link) > + if (ldlm_same_flock_owner(lock, req)) > break; > - } > - } > > /* Scan the locks owned by this process to find the insertion point > * (as locks are ordered), and to handle overlaps. > * We may have to merge or split existing locks. > */ > - if (ownlocks) > - lock = ownlocks; > - else > - lock = list_entry(&res->lr_granted, > - struct ldlm_lock, l_res_link); > list_for_each_entry_safe_from(lock, tmp, &res->lr_granted, l_res_link) { > > if (!ldlm_same_flock_owner(lock, new)) > > Cheers, Andreas -- Andreas Dilger Lustre Principal Architect Intel Corporation