f2fs: clean up the force parameter in __submit_merged_write_cond()
PATCH v2 1/2 f2fs: clean up the force parameter in __submit_merged_write_cond()
From: Yongpeng Yang <[email protected]>
The force parameter in __submit_merged_write_cond is redundant, where force == true implies inode == NULL && folio == NULL && ino == 0 is true, and force == false implies inode != NULL || folio != NULL || ino != 0 is true. Thus, this patch replaces the force parameter with a stack variable force.
---
v2:
- Clean up force parameter in __submit_merged_write_cond() as separated patch.
- Add writeback parameter to __submit_merged_write_cond() for waitting writeback case.
--- fs/f2fs/data.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/f2fs/data.c +4 -3
@@ -664,10 +664,11 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,static void __submit_merged_write_cond (struct f2fs_sb_info *sbi,struct inode *inode,struct folio *folio, -nid_t ino,enum page_type type,bool force) +nid_t ino,enum page_type type) {enum temp_type temp;bool ret = true; +bool force = !inode && !folio && !ino;for (temp =HOT ; temp <NR_TEMP_TYPE ; temp++) {if (!force) {
@@ -689,14 +690,14 @@ static void __submit_merged_write_cond(struct f2fs_sb_info *sbi,void f2fs_submit_merged_write (struct f2fs_sb_info *sbi,enum page_type type) { -__submit_merged_write_cond (sbi,NULL ,NULL ,0 , type, true); +__submit_merged_write_cond (sbi,NULL ,NULL ,0 , type); }void f2fs_submit_merged_write_cond (struct f2fs_sb_info *sbi,struct inode *inode,struct folio *folio,nid_t ino,enum page_type type) { -__submit_merged_write_cond (sbi, inode, folio, ino, type, false); +__submit_merged_write_cond (sbi, inode, folio, ino, type); }void f2fs_flush_merged_writes (struct f2fs_sb_info *sbi)
Signature · 8 lines
2.43.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
PATCH v2 2/2 f2fs: return immediately after submitting the specified folio in __submit_merged_write_cond
From: Yongpeng Yang <[email protected]>
f2fs_folio_wait_writeback ensures the folio write is submitted to the block layer via __submit_merged_write_cond, then waits for the folio to complete. Other I/O submissions are irrelevant to f2fs_folio_wait_writeback. Thus, if the folio write bio is already submitted, the function can return immediately. This patch adds a writeback parameter to __submit_merged_write_cond(), which signals an immediate return after submitting the target folio, and waitting writeback can use this parameter.
--- fs/f2fs/data.c | 22 ++++++++++++++++++---- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/segment.c | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-)
fs/f2fs/data.c +18 -4
@@ -664,7 +664,7 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,static void __submit_merged_write_cond (struct f2fs_sb_info *sbi,struct inode *inode,struct folio *folio, -nid_t ino,enum page_type type) +nid_t ino,enum page_type type,bool writeback) {enum temp_type temp;bool ret = true;
@@ -679,8 +679,16 @@ static void __submit_merged_write_cond(struct f2fs_sb_info *sbi, ret =__has_merged_page (io->bio, inode, folio, ino);f2fs_up_read (&io->io_rwsem); } -if (ret) +if (ret) {__f2fs_submit_merged_write (sbi, type, temp); +/* +* For waitting writebck case, if the bio owned by the +* folio is already submitted, we do not need to submit +* other types of bios. +*/ +if (writeback) +break ; + }/* TODO: use HOT temp only for meta pages now. */ if (type >=META )
@@ -690,14 +698,20 @@ static void __submit_merged_write_cond(struct f2fs_sb_info *sbi,void f2fs_submit_merged_write (struct f2fs_sb_info *sbi,enum page_type type) { -__submit_merged_write_cond (sbi,NULL ,NULL ,0 , type); +__submit_merged_write_cond (sbi,NULL ,NULL ,0 , type, false); }void f2fs_submit_merged_write_cond (struct f2fs_sb_info *sbi,struct inode *inode,struct folio *folio,nid_t ino,enum page_type type) { -__submit_merged_write_cond (sbi, inode, folio, ino, type); +__submit_merged_write_cond (sbi, inode, folio, ino, type, false); +} + +void f2fs_submit_merged_write_folio (struct f2fs_sb_info *sbi, +struct folio *folio,enum page_type type) +{ +__submit_merged_write_cond (sbi,NULL , folio,0 , type, true); }void f2fs_flush_merged_writes (struct f2fs_sb_info *sbi)
fs/f2fs/f2fs.h +2 -0
@@ -4052,6 +4052,8 @@ void f2fs_submit_merged_write(struct f2fs_sb_info *sbi, enum page_type type);void f2fs_submit_merged_write_cond (struct f2fs_sb_info *sbi,struct inode *inode,struct folio *folio,nid_t ino,enum page_type type); +void f2fs_submit_merged_write_folio (struct f2fs_sb_info *sbi, +struct folio *folio,enum page_type type);void f2fs_submit_merged_ipu_write (struct f2fs_sb_info *sbi,struct bio **bio,struct folio *folio);void f2fs_flush_merged_writes (struct f2fs_sb_info *sbi);
fs/f2fs/segment.c +1 -1
@@ -4240,7 +4240,7 @@ void f2fs_folio_wait_writeback(struct folio *folio, enum page_type type,struct f2fs_sb_info *sbi =F2FS_F_SB (folio);/* submit cached LFS IO */ -f2fs_submit_merged_write_cond (sbi,NULL , folio,0 , type); +f2fs_submit_merged_write_folio (sbi, folio, type);/* submit cached IPU IO */ f2fs_submit_merged_ipu_write (sbi,NULL , folio);if (ordered) {
Signature · 8 lines
2.43.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH v2 2/2] f2fs: return immediately after submitting the specified folio in __submit_merged_write_cond
Quoted 12 lines · Yongpeng Yang
From: Yongpeng Yang <[email protected]>
f2fs_folio_wait_writebackensures the folio write is submitted to the block layer via__submit_merged_write_cond, then waits for the folio to complete. Other I/O submissions are irrelevant tof2fs_folio_wait_writeback. Thus, if the folio write bio is already submitted, the function can return immediately. This patch adds a writeback parameter to__submit_merged_write_cond(), which signals an immediate return after submitting the target folio, and waitting writeback can use this parameter.
Quoted 1 line
Signed-off-by Yongpeng Yang <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 9 lines · Yongpeng Yang
From: Yongpeng Yang <[email protected]>
The force parameter in
__submit_merged_write_condis redundant, whereforce == trueimpliesinode == NULL && folio == NULL && ino == 0is true, andforce == falseimpliesinode != NULL || folio != NULL || ino != 0is true. Thus, this patch replaces the force parameter with a stack variable force.Signed-off-by Yongpeng Yang <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hello:
This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
Quoted 9 lines · On Sat, 27 Dec 2025 17:19:06 +0800 you wrote:
From: Yongpeng Yang <[email protected]>
The force parameter in
__submit_merged_write_condis redundant, whereforce == trueimpliesinode == NULL && folio == NULL && ino == 0is true, andforce == falseimpliesinode != NULL || folio != NULL || ino != 0is true. Thus, this patch replaces the force parameter with a stack variable force.[...]
Here is the summary with links:
- [f2fs-dev,v2,1/2] f2fs: clean up the force parameter in __submit_merged_write_cond()
https://git.kernel.org/jaegeuk/f2fs/c/86c1cf0578c5 - [f2fs-dev,v2,2/2] f2fs: return immediately after submitting the specified folio in __submit_merged_write_cond https://git.kernel.org/jaegeuk/f2fs/c/db1a8a7813f7
You are awesome, thank you!
Signature · 10 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel