summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSheng Yong <shengyong@oppo.com>2024-07-08 20:04:07 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-19 05:41:03 +0200
commitff2387553f6aedb657ad3b77be92b3489e30b4c2 (patch)
tree9fcb77e9637b5e66fc52bd68d656c4d107d864b2
parent721190921a87f035d9a2b79bdab4ed3e83e0f6a2 (diff)
downloadlinux-stable-ff2387553f6aedb657ad3b77be92b3489e30b4c2.tar.gz
linux-stable-ff2387553f6aedb657ad3b77be92b3489e30b4c2.tar.bz2
linux-stable-ff2387553f6aedb657ad3b77be92b3489e30b4c2.zip
f2fs: fix start segno of large section
[ Upstream commit 8c409989678e92e4a737e7cd2bb04f3efb81071a ] get_ckpt_valid_blocks() checks valid ckpt blocks in current section. It counts all vblocks from the first to the last segment in the large section. However, START_SEGNO() is used to get the first segno in an SIT block. This patch fixes that to get the correct start segno. Fixes: 61461fc921b7 ("f2fs: fix to avoid touching checkpointed data in get_victim()") Signed-off-by: Sheng Yong <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/f2fs/segment.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 979296b835b5..665e0e186687 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -371,7 +371,8 @@ static inline unsigned int get_ckpt_valid_blocks(struct f2fs_sb_info *sbi,
unsigned int segno, bool use_section)
{
if (use_section && __is_large_section(sbi)) {
- unsigned int start_segno = START_SEGNO(segno);
+ unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
+ unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno);
unsigned int blocks = 0;
int i;