From: qiwuchen55@gmail.com
To: dwmw2@infradead.org, richard@nod.at
Cc: chenqiwu <chenqiwu@xiaomi.com>, linux-mtd@lists.infradead.org
Subject: [PATCH] jffs2: deubg: list_for_each() -> list_for_each_entry()
Date: Sun, 23 Feb 2020 13:46:15 +0800 [thread overview]
Message-ID: <1582436775-14367-1-git-send-email-qiwuchen55@gmail.com> (raw)
From: chenqiwu <chenqiwu@xiaomi.com>
Use list_for_each_entry() instead of list_for_each() to
simplify code.
Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
fs/jffs2/debug.c | 65 +++++++++++++++++++-------------------------------------
1 file changed, 22 insertions(+), 43 deletions(-)
diff --git a/fs/jffs2/debug.c b/fs/jffs2/debug.c
index 9d26b1b9..6bef692 100644
--- a/fs/jffs2/debug.c
+++ b/fs/jffs2/debug.c
@@ -498,12 +498,11 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->clean_list)) {
printk(JFFS2_DBG "clean_list: empty\n");
} else {
- struct list_head *this;
int numblocks = 0;
uint32_t dirty = 0;
+ struct jffs2_eraseblock *jeb;
- list_for_each(this, &c->clean_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
+ list_for_each_entry(jeb, &c->clean_list, list) {
numblocks ++;
dirty += jeb->wasted_size;
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
@@ -520,13 +519,11 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->very_dirty_list)) {
printk(JFFS2_DBG "very_dirty_list: empty\n");
} else {
- struct list_head *this;
int numblocks = 0;
uint32_t dirty = 0;
+ struct jffs2_eraseblock *jeb;
- list_for_each(this, &c->very_dirty_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
-
+ list_for_each_entry(jeb, &c->very_dirty_list, list) {
numblocks ++;
dirty += jeb->dirty_size;
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
@@ -543,13 +540,11 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->dirty_list)) {
printk(JFFS2_DBG "dirty_list: empty\n");
} else {
- struct list_head *this;
int numblocks = 0;
uint32_t dirty = 0;
+ struct jffs2_eraseblock *jeb;
- list_for_each(this, &c->dirty_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
-
+ list_for_each_entry(jeb, &c->dirty_list, list) {
numblocks ++;
dirty += jeb->dirty_size;
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
@@ -566,11 +561,9 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->erasable_list)) {
printk(JFFS2_DBG "erasable_list: empty\n");
} else {
- struct list_head *this;
-
- list_for_each(this, &c->erasable_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
+ struct jffs2_eraseblock *jeb;
+ list_for_each_entry(jeb, &c->erasable_list, list) {
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
printk(JFFS2_DBG "erasable_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
@@ -582,11 +575,9 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->erasing_list)) {
printk(JFFS2_DBG "erasing_list: empty\n");
} else {
- struct list_head *this;
-
- list_for_each(this, &c->erasing_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
+ struct jffs2_eraseblock *jeb;
+ list_for_each_entry(jeb, &c->erasing_list, list) {
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
printk(JFFS2_DBG "erasing_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
@@ -597,11 +588,9 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->erase_checking_list)) {
printk(JFFS2_DBG "erase_checking_list: empty\n");
} else {
- struct list_head *this;
-
- list_for_each(this, &c->erase_checking_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
+ struct jffs2_eraseblock *jeb;
+ list_for_each_entry(jeb, &c->erase_checking_list, list) {
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
printk(JFFS2_DBG "erase_checking_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
@@ -613,11 +602,9 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->erase_pending_list)) {
printk(JFFS2_DBG "erase_pending_list: empty\n");
} else {
- struct list_head *this;
-
- list_for_each(this, &c->erase_pending_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
+ struct jffs2_eraseblock *jeb;
+ list_for_each_entry(jeb, &c->erase_pending_list, list) {
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
printk(JFFS2_DBG "erase_pending_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
@@ -629,11 +616,9 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->erasable_pending_wbuf_list)) {
printk(JFFS2_DBG "erasable_pending_wbuf_list: empty\n");
} else {
- struct list_head *this;
-
- list_for_each(this, &c->erasable_pending_wbuf_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
+ struct jffs2_eraseblock *jeb;
+ list_for_each_entry(jeb, &c->erasable_pending_wbuf_list, list) {
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
printk(JFFS2_DBG "erasable_pending_wbuf_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
@@ -645,11 +630,9 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->free_list)) {
printk(JFFS2_DBG "free_list: empty\n");
} else {
- struct list_head *this;
-
- list_for_each(this, &c->free_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
+ struct jffs2_eraseblock *jeb;
+ list_for_each_entry(jeb, &c->free_list, list) {
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
printk(JFFS2_DBG "free_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
@@ -661,11 +644,9 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->bad_list)) {
printk(JFFS2_DBG "bad_list: empty\n");
} else {
- struct list_head *this;
-
- list_for_each(this, &c->bad_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
+ struct jffs2_eraseblock *jeb;
+ list_for_each_entry(jeb, &c->bad_list, list) {
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
printk(JFFS2_DBG "bad_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
@@ -677,11 +658,9 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
if (list_empty(&c->bad_used_list)) {
printk(JFFS2_DBG "bad_used_list: empty\n");
} else {
- struct list_head *this;
-
- list_for_each(this, &c->bad_used_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
+ struct jffs2_eraseblock *jeb;
+ list_for_each_entry(jeb, &c->bad_used_list, list) {
if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
printk(JFFS2_DBG "bad_used_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
--
1.9.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
reply other threads:[~2020-02-23 5:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1582436775-14367-1-git-send-email-qiwuchen55@gmail.com \
--to=qiwuchen55@gmail.com \
--cc=chenqiwu@xiaomi.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
/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;
as well as URLs for NNTP newsgroup(s).