diff options
author | NeilBrown <neilb@suse.com> | 2017-10-23 11:53:49 +1100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-03 15:00:34 +0100 |
commit | 4a8d3fb10dd758af27984ef92a44e619d598c3e0 (patch) | |
tree | 2ffef76b4a4c937c0128a69cdb5bf762ba06c5fd | |
parent | 3ac5a675caf4dde2788a7a1ac32b95986bffe901 (diff) |
staging: lustre: ldlm: remove unnecessary 'ownlocks' variable.
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 <neilb@suse.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 15 |
1 files 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 7b90f8ef89d7..10e6dcb59950 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 @@ reprocess: /* 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)) |