summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSheng Yong <shengyong@oppo.com>2024-05-30 18:01:58 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2024-06-12 15:46:02 +0000
commit76da333f4b935af65c9465277032a1e24405375c (patch)
treeafae4dce0fbb4afab793359fa21c54bd86a3711d
parentcc260b66c4cd21a370b39f73c9034a420baf8f79 (diff)
f2fs: alloc new section if curseg is not the first seg in its zone
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> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/segment.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index a0ce3d080f80..c4d951ed54ff 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -5187,7 +5187,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);