mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-23 10:10:00 +00:00
f2fs-tools: determine cp_addr by sbi->cur_cp
We don't guarantee cp_addr is fixed by cp_ver due to sload. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
f3341c3976
commit
2d7d4ffdd4
13
fsck/f2fs.h
13
fsck/f2fs.h
@ -280,19 +280,10 @@ static inline bool is_set_ckpt_flags(struct f2fs_checkpoint *cp, unsigned int f)
|
||||
|
||||
static inline block_t __start_cp_addr(struct f2fs_sb_info *sbi)
|
||||
{
|
||||
block_t start_addr;
|
||||
struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
|
||||
unsigned long long ckpt_version = le64_to_cpu(ckpt->checkpoint_ver);
|
||||
block_t start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr);
|
||||
|
||||
start_addr = le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_blkaddr);
|
||||
|
||||
/*
|
||||
* odd numbered checkpoint should at cp segment 0
|
||||
* and even segent must be at cp segment 1
|
||||
*/
|
||||
if (!(ckpt_version & 1))
|
||||
if (sbi->cur_cp == 2)
|
||||
start_addr += sbi->blocks_per_seg;
|
||||
|
||||
return start_addr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user