From: NeilBrown <neilb@suse.com>
To: Oleg Drokin <oleg.drokin@intel.com>,
James Simmons <jsimmons@infradead.org>,
Andreas Dilger <andreas.dilger@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, lustre-devel@lists.lustre.org
Subject: [PATCH 04/12] staging: lustre: ldlm: minor list_entry improvements in ldlm_request.c
Date: Wed, 13 Dec 2017 14:15:54 +1100 [thread overview]
Message-ID: <151313495488.27582.6910804861419753279.stgit@noble> (raw)
In-Reply-To: <151313493380.27582.16490205348451477393.stgit@noble>
Small clarify improvements, and one local variable avoided.
Signed-off-by: NeilBrown <neilb@suse.com>
---
drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
index a9a1551cc9bc..a1b909004de8 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
@@ -1653,7 +1653,7 @@ int ldlm_cli_cancel_list(struct list_head *cancels, int count,
*/
while (count > 0) {
LASSERT(!list_empty(cancels));
- lock = list_entry(cancels->next, struct ldlm_lock, l_bl_ast);
+ lock = list_first_entry(cancels, struct ldlm_lock, l_bl_ast);
LASSERT(lock->l_conn_export);
if (exp_connect_cancelset(lock->l_conn_export)) {
@@ -1777,7 +1777,7 @@ EXPORT_SYMBOL(ldlm_cli_cancel_unused);
static int ldlm_resource_foreach(struct ldlm_resource *res,
ldlm_iterator_t iter, void *closure)
{
- struct list_head *tmp, *next;
+ struct ldlm_lock *tmp;
struct ldlm_lock *lock;
int rc = LDLM_ITER_CONTINUE;
@@ -1785,18 +1785,14 @@ static int ldlm_resource_foreach(struct ldlm_resource *res,
return LDLM_ITER_CONTINUE;
lock_res(res);
- list_for_each_safe(tmp, next, &res->lr_granted) {
- lock = list_entry(tmp, struct ldlm_lock, l_res_link);
-
+ list_for_each_entry_safe(lock, tmp, &res->lr_granted, l_res_link) {
if (iter(lock, closure) == LDLM_ITER_STOP) {
rc = LDLM_ITER_STOP;
goto out;
}
}
- list_for_each_safe(tmp, next, &res->lr_waiting) {
- lock = list_entry(tmp, struct ldlm_lock, l_res_link);
-
+ list_for_each_entry_safe(lock, tmp, &res->lr_waiting, l_res_link) {
if (iter(lock, closure) == LDLM_ITER_STOP) {
rc = LDLM_ITER_STOP;
goto out;
next prev parent reply other threads:[~2017-12-13 3:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 3:15 [PATCH 00/13] Assorted lustre clean-ups NeilBrown
2017-12-13 3:15 ` [PATCH 03/12] staging: lustre: ldlm: use list_first_entry in ldlm_lockd.c NeilBrown
2017-12-13 3:15 ` [PATCH 05/12] staging: lustre: ldlm: use list_for_each_entry in ldlm_resource.c NeilBrown
2017-12-13 3:15 ` [PATCH 06/12] staging: lustre: lov: use list_for_each_entry in lov_obd.c NeilBrown
2017-12-13 3:15 ` [PATCH 02/12] staging: lustre: ldlm: use list_for_each_entry in ldlm_extent_shift_kms() NeilBrown
2017-12-13 3:15 ` [PATCH 01/12] staging: lustre: use list_last_entry to simplify fld_cache_shrink NeilBrown
2017-12-13 3:15 ` NeilBrown [this message]
2017-12-13 3:15 ` [PATCH 08/12] staging: lustre: libcfs: remove unused rounding functions NeilBrown
2017-12-13 3:15 ` [PATCH 11/12] staging: lustre: libcfs: discard KLASSERT() NeilBrown
2017-12-13 3:15 ` [PATCH 12/12] staging: lustre: libcfs: discard LASSERT_CHECKED NeilBrown
[not found] ` <BN6PR1101MB21324C5DC6B6CF85ACD8EF00CB350@BN6PR1101MB2132.namprd11.prod.outlook.com>
2017-12-13 10:22 ` [lustre-devel] " Luis de Bethencourt
2017-12-13 3:15 ` [PATCH 10/12] staging: lustre: libcfs: discard MAX_NUMERIC_VALUE NeilBrown
2017-12-13 3:15 ` [PATCH 09/12] staging: lustre: libcfs: discard MKSTR() macro NeilBrown
2017-12-13 3:15 ` [PATCH 07/12] staging: lustre: libcfs: simplify memory allocation NeilBrown
2017-12-14 0:00 ` NeilBrown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=151313495488.27582.6910804861419753279.stgit@noble \
--to=neilb@suse.com \
--cc=andreas.dilger@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jsimmons@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®