Skip to content

Commit 2c53462

Browse files
Hongzhen Luohsiangkao
authored andcommitted
erofs: get rid of check_layout_compatibility()
Simple enough to just open-code it. Signed-off-by: Hongzhen Luo <[email protected]> Reviewed-by: Sandeep Dhavale <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gao Xiang <[email protected]>
1 parent 5b5c96c commit 2c53462

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

fs/erofs/super.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,6 @@ static void erofs_free_inode(struct inode *inode)
108108
kmem_cache_free(erofs_inode_cachep, vi);
109109
}
110110

111-
static bool check_layout_compatibility(struct super_block *sb,
112-
struct erofs_super_block *dsb)
113-
{
114-
const unsigned int feature = le32_to_cpu(dsb->feature_incompat);
115-
116-
EROFS_SB(sb)->feature_incompat = feature;
117-
118-
/* check if current kernel meets all mandatory requirements */
119-
if (feature & (~EROFS_ALL_FEATURE_INCOMPAT)) {
120-
erofs_err(sb, "unidentified incompatible feature %x, please upgrade kernel",
121-
feature & ~EROFS_ALL_FEATURE_INCOMPAT);
122-
return false;
123-
}
124-
return true;
125-
}
126-
127111
/* read variable-sized metadata, offset will be aligned by 4-byte */
128112
void *erofs_read_metadata(struct super_block *sb, struct erofs_buf *buf,
129113
erofs_off_t *offset, int *lengthp)
@@ -279,7 +263,7 @@ static int erofs_scan_devices(struct super_block *sb,
279263

280264
static int erofs_read_superblock(struct super_block *sb)
281265
{
282-
struct erofs_sb_info *sbi;
266+
struct erofs_sb_info *sbi = EROFS_SB(sb);
283267
struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
284268
struct erofs_super_block *dsb;
285269
void *data;
@@ -291,9 +275,7 @@ static int erofs_read_superblock(struct super_block *sb)
291275
return PTR_ERR(data);
292276
}
293277

294-
sbi = EROFS_SB(sb);
295278
dsb = (struct erofs_super_block *)(data + EROFS_SUPER_OFFSET);
296-
297279
ret = -EINVAL;
298280
if (le32_to_cpu(dsb->magic) != EROFS_SUPER_MAGIC_V1) {
299281
erofs_err(sb, "cannot find valid erofs superblock");
@@ -318,8 +300,12 @@ static int erofs_read_superblock(struct super_block *sb)
318300
}
319301

320302
ret = -EINVAL;
321-
if (!check_layout_compatibility(sb, dsb))
303+
sbi->feature_incompat = le32_to_cpu(dsb->feature_incompat);
304+
if (sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT) {
305+
erofs_err(sb, "unidentified incompatible feature %x, please upgrade kernel",
306+
sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT);
322307
goto out;
308+
}
323309

324310
sbi->sb_size = 128 + dsb->sb_extslots * EROFS_SB_EXTSLOT_SIZE;
325311
if (sbi->sb_size > PAGE_SIZE - EROFS_SUPER_OFFSET) {

0 commit comments

Comments
 (0)