Skip to content

Commit 4fdadd5

Browse files
committed
erofs: get rid of z_erofs_fill_inode()
Prior to big pclusters, non-compact compression indexes could have empty headers. Let's just avoid the legacy path since it can be handled properly as a specific compression header with z_erofs_fill_inode_lazy() too. Tested with erofs-utils exist versions. Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> Reviewed-by: Yue Hu <huyue2@coolpad.com> Reviewed-by: Chao Yu <chao@kernel.org> Link: https://lore.kernel.org/r/20230413092241.73829-1-hsiangkao@linux.alibaba.com
1 parent 6a318cc commit 4fdadd5

3 files changed

Lines changed: 8 additions & 24 deletions

File tree

fs/erofs/inode.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,15 @@ static int erofs_fill_inode(struct inode *inode)
291291
}
292292

293293
if (erofs_inode_is_data_compressed(vi->datalayout)) {
294+
#ifdef CONFIG_EROFS_FS_ZIP
294295
if (!erofs_is_fscache_mode(inode->i_sb) &&
295-
inode->i_sb->s_blocksize_bits == PAGE_SHIFT)
296-
err = z_erofs_fill_inode(inode);
297-
else
298-
err = -EOPNOTSUPP;
296+
inode->i_sb->s_blocksize_bits == PAGE_SHIFT) {
297+
inode->i_mapping->a_ops = &z_erofs_aops;
298+
err = 0;
299+
goto out_unlock;
300+
}
301+
#endif
302+
err = -EOPNOTSUPP;
299303
goto out_unlock;
300304
}
301305
inode->i_mapping->a_ops = &erofs_raw_access_aops;

fs/erofs/internal.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,6 @@ int erofs_try_to_free_cached_page(struct page *page);
522522
int z_erofs_load_lz4_config(struct super_block *sb,
523523
struct erofs_super_block *dsb,
524524
struct z_erofs_lz4_cfgs *lz4, int len);
525-
int z_erofs_fill_inode(struct inode *inode);
526525
int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map,
527526
int flags);
528527
#else
@@ -542,7 +541,6 @@ static inline int z_erofs_load_lz4_config(struct super_block *sb,
542541
}
543542
return 0;
544543
}
545-
static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP; }
546544
#endif /* !CONFIG_EROFS_FS_ZIP */
547545

548546
#ifdef CONFIG_EROFS_FS_ZIP_LZMA

fs/erofs/zmap.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,6 @@
77
#include <asm/unaligned.h>
88
#include <trace/events/erofs.h>
99

10-
int z_erofs_fill_inode(struct inode *inode)
11-
{
12-
struct erofs_inode *const vi = EROFS_I(inode);
13-
struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
14-
15-
if (!erofs_sb_has_big_pcluster(sbi) &&
16-
!erofs_sb_has_ztailpacking(sbi) && !erofs_sb_has_fragments(sbi) &&
17-
vi->datalayout == EROFS_INODE_COMPRESSED_FULL) {
18-
vi->z_advise = 0;
19-
vi->z_algorithmtype[0] = 0;
20-
vi->z_algorithmtype[1] = 0;
21-
vi->z_logical_clusterbits = inode->i_sb->s_blocksize_bits;
22-
set_bit(EROFS_I_Z_INITED_BIT, &vi->flags);
23-
}
24-
inode->i_mapping->a_ops = &z_erofs_aops;
25-
return 0;
26-
}
27-
2810
struct z_erofs_maprecorder {
2911
struct inode *inode;
3012
struct erofs_map_blocks *map;

0 commit comments

Comments
 (0)