f2fs: replace blk_finish_plug() with blk_flush_plug()
PATCH v2 1/1 f2fs: replace blk_finish_plug() with blk_flush_plug()
The commit 344150999b7f ("f2fs: fix to avoid potential deadlock") only requires unplugging current->plug. Using blk_finish_plug() is unnecessary as it sets current->plug as NULL and prevents wb_writeback() from using plug in subsequent loops. Instead, use blk_flush_plug() as a replacement.
--- fs/f2fs/data.c | 3 +-- fs/f2fs/node.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
fs/f2fs/data.c +1 -2
@@ -3346,8 +3346,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,atomic_inc (&sbi->wb_sync_req[DATA ]); else if (atomic_read(&sbi->wb_sync_req[DATA])) {/* to avoid potential deadlock */ -if (current->plug) -blk_finish_plug (current->plug); +blk_flush_plug (current->plug, false); goto skip_write; }
fs/f2fs/node.c +1 -2
@@ -2126,8 +2126,7 @@ static int f2fs_write_node_pages(struct address_space *mapping,atomic_inc (&sbi->wb_sync_req[NODE ]); else if (atomic_read(&sbi->wb_sync_req[NODE])) {/* to avoid potential deadlock */ -if (current->plug) -blk_finish_plug (current->plug); +blk_flush_plug (current->plug, false); goto skip_write; }
Signature · 8 lines
2.25.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 6 lines · Chunhai Guo
The commit
344150999b7f("f2fs: fix to avoid potential deadlock") only requires unpluggingcurrent->plug. Usingblk_finish_plug()is unnecessary as it setscurrent->plugas NULL and preventswb_writeback()from using plug in subsequent loops. Instead, useblk_flush_plug()as a replacement.Signed-off-by Chunhai Guo <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 16 lines · Chunhai Guo
The commit
344150999b7f("f2fs: fix to avoid potential deadlock") only requires unpluggingcurrent->plug. Usingblk_finish_plug()is unnecessary as it setscurrent->plugas NULL and preventswb_writeback()from using plug in subsequent loops. Instead, useblk_flush_plug()as a replacement.Signed-off-by Chunhai Guo <[email protected]>--- fs/f2fs/data.c | 3 +-- fs/f2fs/node.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)fs/f2fs/data.c +0
-0
fs/f2fs/data.c static int __f2fs_write_data_pages(struct address_space *mapping, · line 3350
Quoted 5 lines
fs/f2fs/data.c +0
-2@@ -3346,8 +3346,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,atomic_inc (&sbi->wb_sync_req[DATA ]); else if (atomic_read(&sbi->wb_sync_req[DATA])) {/* to avoid potential deadlock */ -if (current->plug) -blk_finish_plug (current->plug);
What about?
if (current->plug) {
struct blk_plug *plug = current->plug;
blk_finish_plug(plug);
blk_start_plug(plug);
}Jaegeuk, thoughts?
Thanks,
Quoted 9 lines
fs/f2fs/data.c +1
-0+blk_flush_plug (current->plug, false); goto skip_write; }fs/f2fs/node.c +0
-0
fs/f2fs/node.c static int f2fs_write_node_pages(struct address_space *mapping, · line 2132
Quoted 9 lines
fs/f2fs/node.c +1
-2@@ -2126,8 +2126,7 @@ static int f2fs_write_node_pages(struct address_space *mapping,atomic_inc (&sbi->wb_sync_req[NODE ]); else if (atomic_read(&sbi->wb_sync_req[NODE])) {/* to avoid potential deadlock */ -if (current->plug) -blk_finish_plug (current->plug); +blk_flush_plug (current->plug, false); goto skip_write; }
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerQuoted 25 lines · Chao Yu
Quoted 16 lines · Chunhai Guo
The commit
344150999b7f("f2fs: fix to avoid potential deadlock") only requires unpluggingcurrent->plug. Usingblk_finish_plug()is unnecessary as it setscurrent->plugas NULL and preventswb_writeback()from using plug in subsequent loops. Instead, useblk_flush_plug()as a replacement.Signed-off-by Chunhai Guo <[email protected]>--- fs/f2fs/data.c | 3 +-- fs/f2fs/node.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)fs/f2fs/data.c +0
-0fs/f2fs/data.c static int __f2fs_write_data_pages(struct address_space *mapping, · line 3350
Quoted 5 lines
fs/f2fs/data.c +0
-2@@ -3346,8 +3346,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,atomic_inc (&sbi->wb_sync_req[DATA ]); else if (atomic_read(&sbi->wb_sync_req[DATA])) {/* to avoid potential deadlock */ -if (current->plug) -blk_finish_plug (current->plug);What about?
Quoted 8 lines
if (current->plug) { struct blk_plug *plug = current->plug; blk_finish_plug(plug); blk_start_plug(plug); }Jaegeuk, thoughts?
By the way, do we really need to reuse current->plug again? After checkpoint being done, we can use the plug in __f2fs_write_data_pages. Are there some numbers to show the benefit?
Quoted 19 lines
Thanks,
Quoted 8 lines
fs/f2fs/data.c +1
-0+blk_flush_plug (current->plug, false); goto skip_write; }fs/f2fs/node.c +0
-0fs/f2fs/node.c static int f2fs_write_node_pages(struct address_space *mapping, · line 2131
Quoted 8 lines
fs/f2fs/node.c +1
-2@@ -2126,8 +2126,7 @@ static int f2fs_write_node_pages(struct address_space *mapping,atomic_inc (&sbi->wb_sync_req[NODE ]); else if (atomic_read(&sbi->wb_sync_req[NODE])) {/* to avoid potential deadlock */ -if (current->plug) -blk_finish_plug (current->plug); +blk_flush_plug (current->plug, false); goto skip_write; }
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 33 lines · Jaegeuk Kim
Quoted 32 lines · Chao Yu
Quoted 16 lines · Chunhai Guo
The commit
344150999b7f("f2fs: fix to avoid potential deadlock") only requires unpluggingcurrent->plug. Usingblk_finish_plug()is unnecessary as it setscurrent->plugas NULL and preventswb_writeback()from using plug in subsequent loops. Instead, useblk_flush_plug()as a replacement.Signed-off-by Chunhai Guo <[email protected]>--- fs/f2fs/data.c | 3 +-- fs/f2fs/node.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)fs/f2fs/data.c +0
-0fs/f2fs/data.c static int __f2fs_write_data_pages(struct address_space *mapping, · line 3350
Quoted 5 lines
fs/f2fs/data.c +0
-2@@ -3346,8 +3346,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,atomic_inc (&sbi->wb_sync_req[DATA ]); else if (atomic_read(&sbi->wb_sync_req[DATA])) {/* to avoid potential deadlock */ -if (current->plug) -blk_finish_plug (current->plug);What about?
if (current->plug) { struct blk_plug *plug = current->plug; blk_finish_plug(plug); blk_start_plug(plug); }
Quoted 6 lines
Quoted 1 line
Jaegeuk, thoughts?
By the way, do we really need to reuse
current->plugagain? After checkpoint being done, we can use the plug in__f2fs_write_data_pages. Are there some numbers to show the benefit?
I don't have a number on this, but I think that reusing current->plug can help maintain the original intention of wb_writeback(). Nevertheless, it can be a viable alternative to use the plug in __f2fs_write_data_pages().
Thanks.
Quoted 19 lines
Quoted 19 lines
Thanks,
Quoted 8 lines
fs/f2fs/data.c +1
-0+blk_flush_plug (current->plug, false); goto skip_write; }fs/f2fs/node.c +0
-0fs/f2fs/node.c static int f2fs_write_node_pages(struct address_space *mapping, · line 2131
Quoted 8 lines
fs/f2fs/node.c +1
-2@@ -2126,8 +2126,7 @@ static int f2fs_write_node_pages(struct address_space *mapping,atomic_inc (&sbi->wb_sync_req[NODE ]); else if (atomic_read(&sbi->wb_sync_req[NODE])) {/* to avoid potential deadlock */ -if (current->plug) -blk_finish_plug (current->plug); +blk_flush_plug (current->plug, false); goto skip_write; }
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 43 lines · Chunhai Guo
Quoted 33 lines · Jaegeuk Kim
Quoted 32 lines · Chao Yu
Quoted 16 lines · Chunhai Guo
The commit
344150999b7f("f2fs: fix to avoid potential deadlock") only requires unpluggingcurrent->plug. Usingblk_finish_plug()is unnecessary as it setscurrent->plugas NULL and preventswb_writeback()from using plug in subsequent loops. Instead, useblk_flush_plug()as a replacement.Signed-off-by Chunhai Guo <[email protected]>--- fs/f2fs/data.c | 3 +-- fs/f2fs/node.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)fs/f2fs/data.c +0
-0fs/f2fs/data.c static int __f2fs_write_data_pages(struct address_space *mapping, · line 3350
Quoted 5 lines
fs/f2fs/data.c +0
-2@@ -3346,8 +3346,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,atomic_inc (&sbi->wb_sync_req[DATA ]); else if (atomic_read(&sbi->wb_sync_req[DATA])) {/* to avoid potential deadlock */ -if (current->plug) -blk_finish_plug (current->plug);What about?
if (current->plug) { struct blk_plug *plug = current->plug; blk_finish_plug(plug); blk_start_plug(plug); }Quoted 6 lines
Quoted 1 line
Jaegeuk, thoughts?
By the way, do we really need to reuse
current->plugagain? After checkpoint being done, we can use the plug in__f2fs_write_data_pages. Are there some numbers to show the benefit?
Quoted 4 lines
I don't have a number on this, but I think that reusing
current->plugcan help maintain the original intention ofwb_writeback(). Nevertheless, it can be a viable alternative to use the plug in__f2fs_write_data_pages().
I don't have numbers as well, but it can avoid break the intention of per-writeback-work plug, which tries to merge IOs from all dirty inode.
Thanks,
Quoted 5 lines
Thanks.
Quoted 3 lines
Quoted 3 lines
Thanks,
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/data.c +1
-0+blk_flush_plug (current->plug, false); goto skip_write; }fs/f2fs/node.c +0
-0@@ -2126,8 +2126,7 @@ static int f2fs_write_node_pages(struct address_space *mapping,Quoted 8 lines
Quoted 8 lines
fs/f2fs/node.c static int f2fs_write_node_pages(struct address_space *mapping, · line 2131
Quoted 8 lines
fs/f2fs/node.c +1
-2atomic_inc (&sbi->wb_sync_req[NODE ]); else if (atomic_read(&sbi->wb_sync_req[NODE])) {/* to avoid potential deadlock */ -if (current->plug) -blk_finish_plug (current->plug); +blk_flush_plug (current->plug, false); goto skip_write; }
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel