mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-26 19:51:32 +00:00
fsck.f2fs: fix wrong addrs_per_{inode,block}
generic/339 reports below assertion on image w/ compression feature enabled. [ASSERT] (f2fs_check_dirent_position:1366) --> Wrong position of dirent pino:4521, name:"....", level:9, dir_level:0, pgofs:1880, correct range:[1882, 1883] The root cause is we calculate blkaddr number in direct node incorrectly for directory inode, since during calculation, we only need align blkaddr number to cluster size for regular inode rather than directory inode, let's fix it. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
a64fbe53c3
commit
88d1bd9615
@ -504,14 +504,16 @@ unsigned int addrs_per_inode(struct f2fs_inode *i)
|
||||
{
|
||||
unsigned int addrs = CUR_ADDRS_PER_INODE(i) - get_inline_xattr_addrs(i);
|
||||
|
||||
if (!(le32_to_cpu(i->i_flags) & F2FS_COMPR_FL))
|
||||
if (!S_ISREG(le16_to_cpu(i->i_mode)) ||
|
||||
!(le32_to_cpu(i->i_flags) & F2FS_COMPR_FL))
|
||||
return addrs;
|
||||
return ALIGN_DOWN(addrs, 1 << i->i_log_cluster_size);
|
||||
}
|
||||
|
||||
unsigned int addrs_per_block(struct f2fs_inode *i)
|
||||
{
|
||||
if (!(le32_to_cpu(i->i_flags) & F2FS_COMPR_FL))
|
||||
if (!S_ISREG(le16_to_cpu(i->i_mode)) ||
|
||||
!(le32_to_cpu(i->i_flags) & F2FS_COMPR_FL))
|
||||
return DEF_ADDRS_PER_BLOCK;
|
||||
return ALIGN_DOWN(DEF_ADDRS_PER_BLOCK, 1 << i->i_log_cluster_size);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user