Skip to contentSkip to conversation

f2fs: change the unlock parameter of f2fs_put_page to bool

PATCH Applied Yongpeng Yang 2 participants 3 messages Oct 27, 2025 – Nov 11, 2025 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 f2fs: change the unlock parameter of f2fs_put_page to bool

From: Yongpeng Yang <[email protected]>

Change the type of the unlock parameter of f2fs_put_page to bool. All callers should consistently pass true or false. No logical change.

---
v2:
- Avoid calling f2fs_folio_put() when folio->mapping is NULL.

---
 fs/f2fs/compress.c | 8 ++++----
 fs/f2fs/data.c     | 6 ++----
 fs/f2fs/f2fs.h     | 2 +-
 fs/f2fs/gc.c       | 6 +++---
 fs/f2fs/inline.c   | 4 ++--
 fs/f2fs/namei.c    | 4 ++--
 6 files changed, 14 insertions(+), 16 deletions(-)
fs/f2fs/compress.c +4 -4
index 811bfe38e5c0..716004ba44dc 100644
@@ -120,7 +120,7 @@ static void f2fs_unlock_rpages(struct compress_ctx *cc, int len)
 }
 
 static void f2fs_put_rpages_wbc(struct compress_ctx *cc,
-		struct writeback_control *wbc, bool redirty, int unlock)
+		struct writeback_control *wbc, bool redirty, bool unlock)
 {
 	unsigned int i;
 
@@ -1202,7 +1202,7 @@ bool f2fs_compress_write_end(struct inode *inode, void *fsdata,
 	if (copied)
 		set_cluster_dirty(&cc);
 
-	f2fs_put_rpages_wbc(&cc, NULL, false, 1);
+	f2fs_put_rpages_wbc(&cc, NULL, false, true);
 	f2fs_destroy_compress_ctx(&cc, false);
 
 	return first_index;
@@ -1605,7 +1605,7 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
 			add_compr_block_stat(cc->inode, cc->cluster_size);
 			goto write;
 		} else if (err) {
-			f2fs_put_rpages_wbc(cc, wbc, true, 1);
+			f2fs_put_rpages_wbc(cc, wbc, true, true);
 			goto destroy_out;
 		}
 
@@ -1619,7 +1619,7 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
 	f2fs_bug_on(F2FS_I_SB(cc->inode), *submitted);
 
 	err = f2fs_write_raw_pages(cc, submitted, wbc, io_type);
-	f2fs_put_rpages_wbc(cc, wbc, false, 0);
+	f2fs_put_rpages_wbc(cc, wbc, false, false);
 destroy_out:
 	f2fs_destroy_compress_ctx(cc, false);
 	return err;
fs/f2fs/data.c +2 -4
index 1f090c018f1b..047230379680 100644
@@ -3665,8 +3665,7 @@ static int f2fs_write_begin(const struct kiocb *iocb,
 	return 0;
 
 put_folio:
-	folio_unlock(folio);
-	folio_put(folio);
+	f2fs_folio_put(folio, true);
 fail:
 	f2fs_write_failed(inode, pos + len);
 	return err;
@@ -3722,8 +3721,7 @@ static int f2fs_write_end(const struct kiocb *iocb,
 					pos + copied);
 	}
 unlock_out:
-	folio_unlock(folio);
-	folio_put(folio);
+	f2fs_folio_put(folio, true);
 	f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
 	return copied;
 }
fs/f2fs/f2fs.h +1 -1
index 94eb9a2d3a73..32fb2e7338b7 100644
@@ -2979,7 +2979,7 @@ static inline void f2fs_folio_put(struct folio *folio, bool unlock)
 	folio_put(folio);
 }
 
-static inline void f2fs_put_page(struct page *page, int unlock)
+static inline void f2fs_put_page(struct page *page, bool unlock)
 {
 	if (!page)
 		return;
fs/f2fs/gc.c +3 -3
index 22fe6e2c6d5c..fd8bb0424bf3 100644
@@ -1278,7 +1278,7 @@ static int ra_data_block(struct inode *inode, pgoff_t index)
 	err = f2fs_submit_page_bio(&fio);
 	if (err)
 		goto put_encrypted_page;
-	f2fs_put_page(fio.encrypted_page, 0);
+	f2fs_put_page(fio.encrypted_page, false);
 	f2fs_folio_put(folio, true);
 
 	f2fs_update_iostat(sbi, inode, FS_DATA_READ_IO, F2FS_BLKSIZE);
@@ -1286,7 +1286,7 @@ static int ra_data_block(struct inode *inode, pgoff_t index)
 
 	return 0;
 put_encrypted_page:
-	f2fs_put_page(fio.encrypted_page, 1);
+	f2fs_put_page(fio.encrypted_page, true);
 put_folio:
 	f2fs_folio_put(folio, true);
 	return err;
@@ -1442,7 +1442,7 @@ static int move_data_block(struct inode *inode, block_t bidx,
 	f2fs_update_data_blkaddr(&dn, newaddr);
 	set_inode_flag(inode, FI_APPEND_WRITE);
 
-	f2fs_put_page(fio.encrypted_page, 1);
+	f2fs_put_page(fio.encrypted_page, true);
 recover_block:
 	if (err)
 		f2fs_do_replace_block(fio.sbi, &sum, newaddr, fio.old_blkaddr,
fs/f2fs/inline.c +2 -2
index 58ac831ef704..e5c6a08b7e4f 100644
@@ -287,7 +287,7 @@ int f2fs_write_inline_data(struct inode *inode, struct folio *folio)
 	set_inode_flag(inode, FI_DATA_EXIST);
 
 	folio_clear_f2fs_inline(ifolio);
-	f2fs_folio_put(ifolio, 1);
+	f2fs_folio_put(ifolio, true);
 	return 0;
 }
 
@@ -577,7 +577,7 @@ static int f2fs_move_rehashed_dirents(struct inode *dir, struct folio *ifolio,
 	f2fs_i_depth_write(dir, 0);
 	f2fs_i_size_write(dir, MAX_INLINE_DATA(dir));
 	folio_mark_dirty(ifolio);
-	f2fs_folio_put(ifolio, 1);
+	f2fs_folio_put(ifolio, true);
 
 	kfree(backup_dentry);
 	return err;
fs/f2fs/namei.c +2 -2
index 68b33e8089b0..07ceed173ffe 100644
@@ -1259,11 +1259,11 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 	return 0;
 out_new_dir:
 	if (new_dir_entry) {
-		f2fs_folio_put(new_dir_folio, 0);
+		f2fs_folio_put(new_dir_folio, false);
 	}
 out_old_dir:
 	if (old_dir_entry) {
-		f2fs_folio_put(old_dir_folio, 0);
+		f2fs_folio_put(old_dir_folio, false);
 	}
 out_new:
 	f2fs_folio_put(new_folio, false);
Signature · 8 lines
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by Chao Yu on v2 1/1
#1 lore raw
Quoted 6 lines · Yongpeng Yang

From: Yongpeng Yang <[email protected]>

Change the type of the unlock parameter of f2fs_put_page to bool. All callers should consistently pass true or false. No logical change.

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#2 lore raw
In reply to Yongpeng Yang

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 8 lines · On Mon, 27 Oct 2025 20:55:43 +0800 you wrote:

From: Yongpeng Yang <[email protected]>

Change the type of the unlock parameter of f2fs_put_page to bool. All callers should consistently pass true or false. No logical change.

[...]

Here is the summary with links:
- [f2fs-dev,v2] f2fs: change the unlock parameter of f2fs_put_page to bool

    https://git.kernel.org/jaegeuk/f2fs/c/096c6cf89318

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