Commit 557d001a authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

staging: lustre: ldlm: use list_for_each_entry in ldlm_lock.c

This makes some slightly-confusing code a bit clearer, and
avoids the need for 'tmp'.
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef7e70ae
...@@ -886,17 +886,15 @@ static void search_granted_lock(struct list_head *queue, ...@@ -886,17 +886,15 @@ static void search_granted_lock(struct list_head *queue,
struct ldlm_lock *req, struct ldlm_lock *req,
struct sl_insert_point *prev) struct sl_insert_point *prev)
{ {
struct list_head *tmp;
struct ldlm_lock *lock, *mode_end, *policy_end; struct ldlm_lock *lock, *mode_end, *policy_end;
list_for_each(tmp, queue) { list_for_each_entry(lock, queue, l_res_link) {
lock = list_entry(tmp, struct ldlm_lock, l_res_link);
mode_end = list_prev_entry(lock, l_sl_mode); mode_end = list_prev_entry(lock, l_sl_mode);
if (lock->l_req_mode != req->l_req_mode) { if (lock->l_req_mode != req->l_req_mode) {
/* jump to last lock of mode group */ /* jump to last lock of mode group */
tmp = &mode_end->l_res_link; lock = mode_end;
continue; continue;
} }
...@@ -933,9 +931,7 @@ static void search_granted_lock(struct list_head *queue, ...@@ -933,9 +931,7 @@ static void search_granted_lock(struct list_head *queue,
break; break;
/* go to next policy group within mode group */ /* go to next policy group within mode group */
tmp = policy_end->l_res_link.next; lock = list_next_entry(policy_end, l_res_link);
lock = list_entry(tmp, struct ldlm_lock,
l_res_link);
} /* loop over policy groups within the mode group */ } /* loop over policy groups within the mode group */
/* insert point is last lock of the mode group, /* insert point is last lock of the mode group,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment