lkml.org 
[lkml]   [2017]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
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@suse.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);
}

\
 
 \ /
  Last update: 2017-10-30 06:01    [W:0.662 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site