linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH 1/3] f2fs: clean up w/ dotdot_name
@ 2023-11-16  6:25 Chao Yu
  2023-11-16  6:25 ` [f2fs-dev] [PATCH 2/3] f2fs: use shared inode lock during f2fs_fiemap() Chao Yu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chao Yu @ 2023-11-16  6:25 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

Just cleanup, no logic changes.

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fs/f2fs/namei.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index d0053b0284d8..a9360ee02da1 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -459,7 +459,6 @@ static int __recover_dot_dentries(struct inode *dir, nid_t pino)
 {
 	struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
 	struct qstr dot = QSTR_INIT(".", 1);
-	struct qstr dotdot = QSTR_INIT("..", 2);
 	struct f2fs_dir_entry *de;
 	struct page *page;
 	int err = 0;
@@ -497,13 +496,13 @@ static int __recover_dot_dentries(struct inode *dir, nid_t pino)
 			goto out;
 	}
 
-	de = f2fs_find_entry(dir, &dotdot, &page);
+	de = f2fs_find_entry(dir, &dotdot_name, &page);
 	if (de)
 		f2fs_put_page(page, 0);
 	else if (IS_ERR(page))
 		err = PTR_ERR(page);
 	else
-		err = f2fs_do_add_link(dir, &dotdot, NULL, pino, S_IFDIR);
+		err = f2fs_do_add_link(dir, &dotdot_name, NULL, pino, S_IFDIR);
 out:
 	if (!err)
 		clear_inode_flag(dir, FI_INLINE_DOTS);
-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [f2fs-dev] [PATCH 2/3] f2fs: use shared inode lock during f2fs_fiemap()
  2023-11-16  6:25 [f2fs-dev] [PATCH 1/3] f2fs: clean up w/ dotdot_name Chao Yu
@ 2023-11-16  6:25 ` Chao Yu
  2023-11-16  6:25 ` [f2fs-dev] [PATCH 3/3] f2fs: fix to check return value of f2fs_reserve_new_block() Chao Yu
  2023-11-30 18:30 ` [f2fs-dev] [PATCH 1/3] f2fs: clean up w/ dotdot_name patchwork-bot+f2fs
  2 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2023-11-16  6:25 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

f2fs_fiemap() will only traverse metadata of inode, let's use shared
inode lock for it to avoid unnecessary race on inode lock.

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fs/f2fs/data.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 4e42b5f24deb..42f0f6184f73 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1992,7 +1992,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 	if (ret)
 		return ret;
 
-	inode_lock(inode);
+	inode_lock_shared(inode);
 
 	maxbytes = max_file_blocks(inode) << F2FS_BLKSIZE_BITS;
 	if (start > maxbytes) {
@@ -2112,7 +2112,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 	if (ret == 1)
 		ret = 0;
 
-	inode_unlock(inode);
+	inode_unlock_shared(inode);
 	return ret;
 }
 
-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [f2fs-dev] [PATCH 3/3] f2fs: fix to check return value of f2fs_reserve_new_block()
  2023-11-16  6:25 [f2fs-dev] [PATCH 1/3] f2fs: clean up w/ dotdot_name Chao Yu
  2023-11-16  6:25 ` [f2fs-dev] [PATCH 2/3] f2fs: use shared inode lock during f2fs_fiemap() Chao Yu
@ 2023-11-16  6:25 ` Chao Yu
  2023-11-30 18:30 ` [f2fs-dev] [PATCH 1/3] f2fs: clean up w/ dotdot_name patchwork-bot+f2fs
  2 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2023-11-16  6:25 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

Let's check return value of f2fs_reserve_new_block() in do_recover_data()
rather than letting it fails silently.

Also refactoring check condition on return value of f2fs_reserve_new_block()
as below:
- trigger f2fs_bug_on() only for ENOSPC case;
- use do-while statement to avoid redundant codes;

Signed-off-by: Chao Yu <chao@kernel.org>
---
 fs/f2fs/recovery.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index b56d0f1078a7..16415c770b45 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -712,7 +712,16 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,
 		 */
 		if (dest == NEW_ADDR) {
 			f2fs_truncate_data_blocks_range(&dn, 1);
-			f2fs_reserve_new_block(&dn);
+			do {
+				err = f2fs_reserve_new_block(&dn);
+				if (err == -ENOSPC) {
+					f2fs_bug_on(sbi, 1);
+					break;
+				}
+			} while (err &&
+				IS_ENABLED(CONFIG_F2FS_FAULT_INJECTION));
+			if (err)
+				goto err;
 			continue;
 		}
 
@@ -720,12 +729,14 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,
 		if (f2fs_is_valid_blkaddr(sbi, dest, META_POR)) {
 
 			if (src == NULL_ADDR) {
-				err = f2fs_reserve_new_block(&dn);
-				while (err &&
-				       IS_ENABLED(CONFIG_F2FS_FAULT_INJECTION))
+				do {
 					err = f2fs_reserve_new_block(&dn);
-				/* We should not get -ENOSPC */
-				f2fs_bug_on(sbi, err);
+					if (err == -ENOSPC) {
+						f2fs_bug_on(sbi, 1);
+						break;
+					}
+				} while (err &&
+					IS_ENABLED(CONFIG_F2FS_FAULT_INJECTION));
 				if (err)
 					goto err;
 			}
-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [f2fs-dev] [PATCH 1/3] f2fs: clean up w/ dotdot_name
  2023-11-16  6:25 [f2fs-dev] [PATCH 1/3] f2fs: clean up w/ dotdot_name Chao Yu
  2023-11-16  6:25 ` [f2fs-dev] [PATCH 2/3] f2fs: use shared inode lock during f2fs_fiemap() Chao Yu
  2023-11-16  6:25 ` [f2fs-dev] [PATCH 3/3] f2fs: fix to check return value of f2fs_reserve_new_block() Chao Yu
@ 2023-11-30 18:30 ` patchwork-bot+f2fs
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+f2fs @ 2023-11-30 18:30 UTC (permalink / raw)
  To: Chao Yu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel

Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Thu, 16 Nov 2023 14:25:54 +0800 you wrote:
> Just cleanup, no logic changes.
> 
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  fs/f2fs/namei.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [f2fs-dev,1/3] f2fs: clean up w/ dotdot_name
    https://git.kernel.org/jaegeuk/f2fs/c/ff6584ac2c4b
  - [f2fs-dev,2/3] f2fs: use shared inode lock during f2fs_fiemap()
    https://git.kernel.org/jaegeuk/f2fs/c/9458915036dd
  - [f2fs-dev,3/3] f2fs: fix to check return value of f2fs_reserve_new_block()
    https://git.kernel.org/jaegeuk/f2fs/c/956fa1ddc132

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-30 18:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-16  6:25 [f2fs-dev] [PATCH 1/3] f2fs: clean up w/ dotdot_name Chao Yu
2023-11-16  6:25 ` [f2fs-dev] [PATCH 2/3] f2fs: use shared inode lock during f2fs_fiemap() Chao Yu
2023-11-16  6:25 ` [f2fs-dev] [PATCH 3/3] f2fs: fix to check return value of f2fs_reserve_new_block() Chao Yu
2023-11-30 18:30 ` [f2fs-dev] [PATCH 1/3] f2fs: clean up w/ dotdot_name patchwork-bot+f2fs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).