[PATCH OLK-5.10] erofs: Fix erofs_bmap error
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ID6FYU -------------------------------- Currently, there is an issue with the bmap of erofs. When formatted as the chunk type, the bmap returns not the block granularity but the chunk granularity, which is inaccurate. Unify it with the bmap of other file systems, return the block granularity. Calculate the offset within the chunk to solve this problem. Fixes: 9da681e017a3 ("staging: erofs: support bmap") Signed-off-by: Zizhi Wo <wozizhi@huawei.com> --- fs/erofs/data.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index e228a2d52aaf..99c5da8e6338 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -458,6 +458,7 @@ static sector_t erofs_bmap(struct address_space *mapping, sector_t block) struct erofs_map_blocks map = { .m_la = blknr_to_addr(block), }; + erofs_off_t offset = map.m_la; if (EROFS_I(inode)->datalayout == EROFS_INODE_FLAT_INLINE) { erofs_blk_t blks = i_size_read(inode) >> LOG_BLOCK_SIZE; @@ -467,7 +468,7 @@ static sector_t erofs_bmap(struct address_space *mapping, sector_t block) } if (!erofs_map_blocks(inode, &map)) - return erofs_blknr(map.m_pa); + return erofs_blknr(map.m_pa + offset - map.m_la); return 0; } -- 2.39.2
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/18962 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/5BO... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/18962 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/5BO...
participants (2)
-
patchwork bot -
Zizhi Wo