Skip to contentSkip to conversation

f2fs: Use list_for_each_entry rather than list_for_each_entry_safe.

PATCH In review majianpeng 2 participants 3 messages May 14, 2013 – May 15, 2013

Subsystems (2)
lore
Share & tools
lore

majianpeng

author
#0 lore raw

PATCH 1/1 f2fs: Use list_for_each_entry rather than list_for_each_entry_safe.

---
 fs/f2fs/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/debug.c +2 -2
index 8d99437..0d6c6aa 100644
@@ -175,12 +175,12 @@ get_cache:
 
 static int stat_show(struct seq_file *s, void *v)
 {
-    struct f2fs_stat_info *si, *next;
+    struct f2fs_stat_info *si;
     int i = 0;
     int j;
 
     mutex_lock(&f2fs_stat_mutex);
-    list_for_each_entry_safe(si, next, &f2fs_stat_list, stat_list) {
+    list_for_each_entry(si, &f2fs_stat_list, stat_list) {
         char devname[BDEVNAME_SIZE];
 
         update_general_status(si->sbi);
Signature · 1 line
1.8.3.rc1.44.gb387c77
#1 lore raw

Hi Jianpeng,

Could you explain why this *should* be changed?
Thanks,

2013-05-14 (화), 20:06 +0800, majianpeng:

Quoted 24 lines
---
 fs/f2fs/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/debug.c +2 -2
index 8d99437..0d6c6aa 100644
@@ -175,12 +175,12 @@ get_cache:
 
 static int stat_show(struct seq_file *s, void *v)
 {
-    struct f2fs_stat_info *si, *next;
+    struct f2fs_stat_info *si;
     int i = 0;
     int j;
 
     mutex_lock(&f2fs_stat_mutex);
-    list_for_each_entry_safe(si, next, &f2fs_stat_list, stat_list) {
+    list_for_each_entry(si, &f2fs_stat_list, stat_list) {
         char devname[BDEVNAME_SIZE];
 
         update_general_status(si->sbi);
Signature · 2 lines
Jaegeuk Kim
Samsung
author
#2 lore raw
Quoted 24 lines · Jaegeuk Kim

Hi Jianpeng,

Could you explain why this *should* be changed?
Thanks,

2013-05-14 (화), 20:06 +0800, majianpeng:

Quoted 18 lines
---
 fs/f2fs/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/debug.c +1 -1
index 8d99437..0d6c6aa 100644
@@ -175,12 +175,12 @@ get_cache:
 
 static int stat_show(struct seq_file *s, void *v)
 {
-    struct f2fs_stat_info *si, *next;
+    struct f2fs_stat_info *si;
     int i = 0;
     int j;
 
Quoted 6 lines

fs/f2fs/debug.c get_cache: · line 186

Quoted 6 lines
fs/f2fs/debug.c +1 -1
     mutex_lock(&f2fs_stat_mutex);
-    list_for_each_entry_safe(si, next, &f2fs_stat_list, stat_list) {
+    list_for_each_entry(si, &f2fs_stat_list, stat_list) {
         char devname[BDEVNAME_SIZE];
 
         update_general_status(si->sbi);

Hi,
In general, if we want to do delete operation like list_delete(&si->stat_list) ,we can use list_for_each_entry_safe. Otherwise, we used list_for_each_entry.

Thanks!
Jianpeng Ma
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html