mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] erofs: get rid of check_layout_compatibility()
@ 2024-08-06 11:22 Hongzhen Luo
  2024-08-07  1:37 ` Gao Xiang
  2024-08-07  1:59 ` Sandeep Dhavale
  0 siblings, 2 replies; 3+ messages in thread
From: Hongzhen Luo @ 2024-08-06 11:22 UTC (permalink / raw)
  To: linux-erofs; +Cc: linux-kernel, Hongzhen Luo

Simple enough to just open-code it.

Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
---
 fs/erofs/super.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 32ce5b35e1df..6cb5c8916174 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -108,22 +108,6 @@ static void erofs_free_inode(struct inode *inode)
 	kmem_cache_free(erofs_inode_cachep, vi);
 }
 
-static bool check_layout_compatibility(struct super_block *sb,
-				       struct erofs_super_block *dsb)
-{
-	const unsigned int feature = le32_to_cpu(dsb->feature_incompat);
-
-	EROFS_SB(sb)->feature_incompat = feature;
-
-	/* check if current kernel meets all mandatory requirements */
-	if (feature & (~EROFS_ALL_FEATURE_INCOMPAT)) {
-		erofs_err(sb, "unidentified incompatible feature %x, please upgrade kernel",
-			   feature & ~EROFS_ALL_FEATURE_INCOMPAT);
-		return false;
-	}
-	return true;
-}
-
 /* read variable-sized metadata, offset will be aligned by 4-byte */
 void *erofs_read_metadata(struct super_block *sb, struct erofs_buf *buf,
 			  erofs_off_t *offset, int *lengthp)
@@ -279,7 +263,7 @@ static int erofs_scan_devices(struct super_block *sb,
 
 static int erofs_read_superblock(struct super_block *sb)
 {
-	struct erofs_sb_info *sbi;
+	struct erofs_sb_info *sbi = EROFS_SB(sb);
 	struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
 	struct erofs_super_block *dsb;
 	void *data;
@@ -291,9 +275,7 @@ static int erofs_read_superblock(struct super_block *sb)
 		return PTR_ERR(data);
 	}
 
-	sbi = EROFS_SB(sb);
 	dsb = (struct erofs_super_block *)(data + EROFS_SUPER_OFFSET);
-
 	ret = -EINVAL;
 	if (le32_to_cpu(dsb->magic) != EROFS_SUPER_MAGIC_V1) {
 		erofs_err(sb, "cannot find valid erofs superblock");
@@ -318,8 +300,12 @@ static int erofs_read_superblock(struct super_block *sb)
 	}
 
 	ret = -EINVAL;
-	if (!check_layout_compatibility(sb, dsb))
+	sbi->feature_incompat = le32_to_cpu(dsb->feature_incompat);
+	if (sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT) {
+		erofs_err(sb, "unidentified incompatible feature %x, please upgrade kernel",
+			  sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT);
 		goto out;
+	}
 
 	sbi->sb_size = 128 + dsb->sb_extslots * EROFS_SB_EXTSLOT_SIZE;
 	if (sbi->sb_size > PAGE_SIZE - EROFS_SUPER_OFFSET) {
-- 
2.43.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] erofs: get rid of check_layout_compatibility()
  2024-08-06 11:22 [PATCH] erofs: get rid of check_layout_compatibility() Hongzhen Luo
@ 2024-08-07  1:37 ` Gao Xiang
  2024-08-07  1:59 ` Sandeep Dhavale
  1 sibling, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2024-08-07  1:37 UTC (permalink / raw)
  To: Hongzhen Luo, linux-erofs; +Cc: linux-kernel



On 2024/8/6 19:22, Hongzhen Luo wrote:
> Simple enough to just open-code it.
> 
> Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>

Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] erofs: get rid of check_layout_compatibility()
  2024-08-06 11:22 [PATCH] erofs: get rid of check_layout_compatibility() Hongzhen Luo
  2024-08-07  1:37 ` Gao Xiang
@ 2024-08-07  1:59 ` Sandeep Dhavale
  1 sibling, 0 replies; 3+ messages in thread
From: Sandeep Dhavale @ 2024-08-07  1:59 UTC (permalink / raw)
  To: Hongzhen Luo; +Cc: linux-erofs, linux-kernel

LGTM,

Reviewed-by: Sandeep Dhavale <dhavale@google.com>

Thanks,
Sandeep.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-07  1:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-06 11:22 [PATCH] erofs: get rid of check_layout_compatibility() Hongzhen Luo
2024-08-07  1:37 ` Gao Xiang
2024-08-07  1:59 ` Sandeep Dhavale

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®