diff mbox series

[f2fs-dev,v2] f2fs: alloc new section if curseg is not the first seg in its zone

Message ID 20240530100158.762954-1-shengyong@oppo.com (mailing list archive)
State Accepted
Commit 76da333f4b935af65c9465277032a1e24405375c
Headers show
Series [f2fs-dev,v2] f2fs: alloc new section if curseg is not the first seg in its zone | expand

Commit Message

Sheng Yong May 30, 2024, 10:01 a.m. UTC
If curseg is not the first segment in its zone, the zone is not empty.
A new section should be allocated and avoid resetting the old zone.

Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Sheng Yong <shengyong@oppo.com>
---
v2: remove and update inaccurate commit msg
---
 fs/f2fs/segment.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

patchwork-bot+f2fs@kernel.org June 12, 2024, 3:55 p.m. UTC | #1
Hello:

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

On Thu, 30 May 2024 18:01:58 +0800 you wrote:
> If curseg is not the first segment in its zone, the zone is not empty.
> A new section should be allocated and avoid resetting the old zone.
> 
> Reviewed-by: Chao Yu <chao@kernel.org>
> Signed-off-by: Sheng Yong <shengyong@oppo.com>
> ---
> v2: remove and update inaccurate commit msg
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v2] f2fs: alloc new section if curseg is not the first seg in its zone
    https://git.kernel.org/jaegeuk/f2fs/c/76da333f4b93

You are awesome, thank you!
diff mbox series

Patch

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 4c8836ded90fc..50b38cbe33401 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -5004,7 +5004,8 @@  static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type)
 	}
 
 	/* Allocate a new section if it's not new. */
-	if (cs->next_blkoff) {
+	if (cs->next_blkoff ||
+	    cs->segno != GET_SEG_FROM_SEC(sbi, GET_ZONE_FROM_SEC(sbi, cs_section))) {
 		unsigned int old_segno = cs->segno, old_blkoff = cs->next_blkoff;
 
 		f2fs_allocate_new_section(sbi, type, true);