Skip to contentSkip to conversation

f2fs: remove unnecessary f2fs_put_page in f2fs_rename

PATCH Applied Jaegeuk Kim 3 participants 3 messages Jan 12, 2024 – Jan 29, 2024 F2FS file system

lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: remove unnecessary f2fs_put_page in f2fs_rename

[1] changed the below condition, which made f2fs_put_page() voided. This patch reapplies the AL's resolution in -next from [2].

- if (S_ISDIR(old_inode->i_mode)) {

+       if (old_is_dir && old_dir != new_dir) {
                old_dir_entry = f2fs_parent_dir(old_inode, &old_dir_page);
                if (!old_dir_entry) {
                        if (IS_ERR(old_dir_page))

[1] 7deee77b993a ("f2fs: Avoid reading renamed directory if parent does not change")
[2] https://lore.kernel.org/all/20231220013402.GW1674809@ZenIV/

---
 fs/f2fs/namei.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
fs/f2fs/namei.c +4 -7
index b3bb815fc6aa..ba11298b7837 100644
@@ -1105,14 +1105,11 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
 		iput(whiteout);
 	}
 
-	if (old_is_dir) {
-		if (old_dir_entry)
-			f2fs_set_link(old_inode, old_dir_entry,
-						old_dir_page, new_dir);
-		else
-			f2fs_put_page(old_dir_page, 0);
+	if (old_dir_entry)
+		f2fs_set_link(old_inode, old_dir_entry, old_dir_page, new_dir);
+	if (old_is_dir)
 		f2fs_i_links_write(old_dir, false);
-	}
+
 	if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) {
 		f2fs_add_ino_entry(sbi, new_dir->i_ino, TRANS_DIR_INO);
 		if (S_ISDIR(old_inode->i_mode))
Signature · 1 line
2.43.0.275.g3460e3d667-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jaegeuk Kim

[1] changed the below condition, which made f2fs_put_page() voided. This patch reapplies the AL's resolution in -next from [2].

(quoted diff) +1 -1
-       if (S_ISDIR(old_inode->i_mode)) {
+       if (old_is_dir && old_dir != new_dir) {
                 old_dir_entry = f2fs_parent_dir(old_inode, &old_dir_page);
                 if (!old_dir_entry) {
                         if (IS_ERR(old_dir_page))
Quoted 5 lines

[1] 7deee77b993a ("f2fs: Avoid reading renamed directory if parent does not change")
[2] https://lore.kernel.org/all/20231220013402.GW1674809@ZenIV/

Thanks,

#2 lore raw
In reply to Jaegeuk Kim
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

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

Review

Quoted 10 lines · On Fri, 12 Jan 2024 09:16:45 -0800 you wrote:

[1] changed the below condition, which made f2fs_put_page() voided. This patch reapplies the AL's resolution in -next from [2].

(quoted diff) +1 -1
-       if (S_ISDIR(old_inode->i_mode)) {
+       if (old_is_dir && old_dir != new_dir) {
                old_dir_entry = f2fs_parent_dir(old_inode, &old_dir_page);
                if (!old_dir_entry) {
                        if (IS_ERR(old_dir_page))
 
[...]

Here is the summary with links:
- [f2fs-dev] f2fs: remove unnecessary f2fs_put_page in f2fs_rename

    https://git.kernel.org/jaegeuk/f2fs/c/fb09ad63d798

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html