Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1690825
| From | NeilBrown <neilb@suse.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 11/12] staging: lustre: ldlm: remove unnecessary 'ownlocks' variable. |
| Date | 2017-07-19 01:30 +0200 |
| Message-ID | <u4K6f-ns-35@gated-at.bofh.it> (permalink) |
| References | <u4K6d-ns-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 point to the head of the list if ownlocks is NULL.
The current code then tests ownlocks and sets 'lock' to exact the
value that it currently has.
So discard 'ownlocks'.
Also remove unnecessary initialization of 'lock'.
Signed-off-by: NeilBrown <neilb@suse.com>
---
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 58227728a002..4e8808103437 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))
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/12] Assorted lustre fixes and improvements NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
[PATCH 04/12] staging: lustre: ldlm: remove 'first_enq' arg from ldlm_process_flock_lock() NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
[PATCH 03/12] staging: lustre: llite: fix various issues with ll_splice_alias. NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
Re: [PATCH 03/12] staging: lustre: llite: fix various issues with ll_splice_alias. Oleg Drokin <oleg.drokin@intel.com> - 2017-07-19 05:00 +0200
Re: [PATCH 03/12] staging: lustre: llite: fix various issues with ll_splice_alias. NeilBrown <neilb@suse.com> - 2017-07-19 06:40 +0200
Re: [PATCH 03/12] staging: lustre: llite: fix various issues with ll_splice_alias. Oleg Drokin <oleg.drokin@intel.com> - 2017-07-19 08:20 +0200
[PATCH 02/12] staging: lustre: llite: fix incorrect DCACHE_DISCONNECTED test NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
[PATCH 08/12] staging: lustre: ldlm: remove unused 'overlaps' variable NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
[PATCH 11/12] staging: lustre: ldlm: remove unnecessary 'ownlocks' variable. NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
[PATCH 05/12] staging: lustre: ldlm: remove unused 'work_list' arg from ldlm_process_flock_lock() NeilBrown <neilb@suse.com> - 2017-07-19 01:30 +0200
csiph-web