summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Xiaojun <wangxiaojun11@huawei.com>2021-03-25 10:19:20 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2021-03-26 10:27:45 -0700
commit753a8ed0ae9c196a7d09a17aae1e354cabd1233d (patch)
tree40d71e35ab4b7554fe4ccd0a1b77dee66f8c9b35
parente8bf1f522aee3b3e1e7658e8f224dca1d88c3338 (diff)
downloadlinux-stable-753a8ed0ae9c196a7d09a17aae1e354cabd1233d.tar.gz
linux-stable-753a8ed0ae9c196a7d09a17aae1e354cabd1233d.tar.bz2
linux-stable-753a8ed0ae9c196a7d09a17aae1e354cabd1233d.zip
f2fs: fix wrong alloc_type in f2fs_do_replace_block
If the alloc_type of the original curseg is LFS, when we change_curseg and then do recover curseg, the alloc_type becomes SSR. Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/segment.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index ad48f1f16387..c19114be554c 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3572,6 +3572,7 @@ void f2fs_do_replace_block(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
struct seg_entry *se;
int type;
unsigned short old_blkoff;
+ unsigned char old_alloc_type;
segno = GET_SEGNO(sbi, new_blkaddr);
se = get_seg_entry(sbi, segno);
@@ -3605,6 +3606,7 @@ void f2fs_do_replace_block(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
old_cursegno = curseg->segno;
old_blkoff = curseg->next_blkoff;
+ old_alloc_type = curseg->alloc_type;
/* change the current segment */
if (segno != curseg->segno) {
@@ -3639,6 +3641,7 @@ void f2fs_do_replace_block(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
change_curseg(sbi, type, true);
}
curseg->next_blkoff = old_blkoff;
+ curseg->alloc_type = old_alloc_type;
}
up_write(&sit_i->sentry_lock);