From: simran singhal <singhalsimran0@gmail.com>
To: oleg.drokin@intel.com
Cc: andreas.dilger@intel.com, jsimmons@infradead.org,
gregkh@linuxfoundation.org, lustre-devel@lists.lustre.org,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
outreachy-kernel@googlegroups.com
Subject: [PATCH 4/5] staging: lustre: llite: Use list_for_each_entry_safe
Date: Sun, 5 Mar 2017 22:36:49 +0530 [thread overview]
Message-ID: <1488733610-22289-5-git-send-email-singhalsimran0@gmail.com> (raw)
In-Reply-To: <1488733610-22289-1-git-send-email-singhalsimran0@gmail.com>
Doubly linked lists which are iterated using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.
This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.
This was done with Coccinelle.
@@
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@
T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}
Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
drivers/staging/lustre/lustre/llite/statahead.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index fb7c315..d1287b2 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -860,6 +860,7 @@ static int ll_agl_thread(void *arg)
struct inode *dir = d_inode(parent);
struct ll_inode_info *plli = ll_i2info(dir);
struct ll_inode_info *clli;
+ struct ll_inode_info *tmp;
struct ll_sb_info *sbi = ll_i2sbi(dir);
struct ll_statahead_info *sai;
struct ptlrpc_thread *thread;
@@ -909,9 +910,7 @@ static int ll_agl_thread(void *arg)
spin_lock(&plli->lli_agl_lock);
sai->sai_agl_valid = 0;
- while (!list_empty(&sai->sai_agls)) {
- clli = list_entry(sai->sai_agls.next,
- struct ll_inode_info, lli_agl_list);
+ list_for_each_entry_safe(clli, tmp, &sai->sai_agls, lli_agl_list) {
list_del_init(&clli->lli_agl_list);
spin_unlock(&plli->lli_agl_lock);
clli->lli_agl_index = 0;
--
2.7.4
next prev parent reply other threads:[~2017-03-05 17:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-05 17:06 [PATCH 0/5] " simran singhal
2017-03-05 17:06 ` [PATCH 1/5] staging: lustre: " simran singhal
2017-03-05 17:34 ` [Outreachy kernel] " Julia Lawall
2017-03-05 17:06 ` [PATCH 2/5] staging: lustre: ptlrpc: " simran singhal
2017-03-05 17:39 ` [Outreachy kernel] " Julia Lawall
2017-03-05 17:42 ` SIMRAN SINGHAL
2017-03-05 17:43 ` Julia Lawall
2017-03-05 17:06 ` [PATCH 3/5] staging: lustre: osc: " simran singhal
2017-03-05 17:06 ` simran singhal [this message]
2017-03-05 17:06 ` [PATCH 5/5] staging: lustre: osc_page.c: " simran singhal
2017-03-05 17:15 ` [Outreachy kernel] " Julia Lawall
2017-03-05 17:20 ` Julia Lawall
2017-03-05 17:17 ` Julia Lawall
2017-03-05 17:44 ` SIMRAN SINGHAL
2017-03-05 17:48 ` Julia Lawall
2017-03-05 17:51 ` SIMRAN SINGHAL
2017-03-05 17:52 ` Julia Lawall
2017-03-06 15:20 ` James Simmons
2017-03-06 19:13 ` SIMRAN SINGHAL
2017-03-07 10:20 ` Dilger, Andreas
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=1488733610-22289-5-git-send-email-singhalsimran0@gmail.com \
--to=singhalsimran0@gmail.com \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--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 \
--cc=outreachy-kernel@googlegroups.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®