[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <150933956737.22133.10532579319852492812.stgit@noble>
Date: Mon, 30 Oct 2017 15:59:27 +1100
From: NeilBrown <neilb@...e.com>
To: Oleg Drokin <oleg.drokin@...el.com>,
Andreas Dilger <andreas.dilger@...el.com>,
James Simmons <jsimmons@...radead.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, lustre-devel@...ts.lustre.org
Subject: [PATCH 10/10] staging: lustre: obdclass: simplify cl_lock_fini()
Using list_first_entry_or_null() makes this (slightly)
simpler.
Signed-off-by: NeilBrown <neilb@...e.com>
---
drivers/staging/lustre/lustre/obdclass/cl_lock.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c
index 20e64051d2d6..fa97f4b39bd1 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c
@@ -78,13 +78,12 @@ EXPORT_SYMBOL(cl_lock_slice_add);
void cl_lock_fini(const struct lu_env *env, struct cl_lock *lock)
{
+ struct cl_lock_slice *slice;
cl_lock_trace(D_DLMTRACE, env, "destroy lock", lock);
- while (!list_empty(&lock->cll_layers)) {
- struct cl_lock_slice *slice;
-
- slice = list_entry(lock->cll_layers.next,
- struct cl_lock_slice, cls_linkage);
+ while ((slice = list_first_entry_or_null(&lock->cll_layers,
+ struct cl_lock_slice,
+ cls_linkage)) != NULL) {
list_del_init(lock->cll_layers.next);
slice->cls_ops->clo_fini(env, slice);
}
Powered by blists - more mailing lists