linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs: get rid of z_erofs_fill_inode()
@ 2023-04-11 10:10 Gao Xiang
  2023-04-13  9:22 ` [PATCH v2] " Gao Xiang
  0 siblings, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2023-04-11 10:10 UTC (permalink / raw)
  To: linux-erofs; +Cc: Gao Xiang, LKML

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>
---
 fs/erofs/inode.c    |  8 +++++---
 fs/erofs/internal.h |  2 --
 fs/erofs/zmap.c     | 18 ------------------
 3 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 7ca9aafb7471..4438ed5b08be 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -292,10 +292,12 @@ static int erofs_fill_inode(struct inode *inode)
 
 	if (erofs_inode_is_data_compressed(vi->datalayout)) {
 		if (!erofs_is_fscache_mode(inode->i_sb) &&
-		    inode->i_sb->s_blocksize_bits == PAGE_SHIFT)
-			err = z_erofs_fill_inode(inode);
-		else
+		    inode->i_sb->s_blocksize_bits == PAGE_SHIFT) {
+			inode->i_mapping->a_ops = &z_erofs_aops;
+			err = 0;
+		} else {
 			err = -EOPNOTSUPP;
+		}
 		goto out_unlock;
 	}
 	inode->i_mapping->a_ops = &erofs_raw_access_aops;
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index f675050af2bb..f1268cb6a37c 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -522,7 +522,6 @@ int erofs_try_to_free_cached_page(struct page *page);
 int z_erofs_load_lz4_config(struct super_block *sb,
 			    struct erofs_super_block *dsb,
 			    struct z_erofs_lz4_cfgs *lz4, int len);
-int z_erofs_fill_inode(struct inode *inode);
 int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map,
 			    int flags);
 #else
@@ -542,7 +541,6 @@ static inline int z_erofs_load_lz4_config(struct super_block *sb,
 	}
 	return 0;
 }
-static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP; }
 #endif	/* !CONFIG_EROFS_FS_ZIP */
 
 #ifdef CONFIG_EROFS_FS_ZIP_LZMA
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index 7ca108c3834c..14c21284d019 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -7,24 +7,6 @@
 #include <asm/unaligned.h>
 #include <trace/events/erofs.h>
 
-int z_erofs_fill_inode(struct inode *inode)
-{
-	struct erofs_inode *const vi = EROFS_I(inode);
-	struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
-
-	if (!erofs_sb_has_big_pcluster(sbi) &&
-	    !erofs_sb_has_ztailpacking(sbi) && !erofs_sb_has_fragments(sbi) &&
-	    vi->datalayout == EROFS_INODE_COMPRESSED_FULL) {
-		vi->z_advise = 0;
-		vi->z_algorithmtype[0] = 0;
-		vi->z_algorithmtype[1] = 0;
-		vi->z_logical_clusterbits = inode->i_sb->s_blocksize_bits;
-		set_bit(EROFS_I_Z_INITED_BIT, &vi->flags);
-	}
-	inode->i_mapping->a_ops = &z_erofs_aops;
-	return 0;
-}
-
 struct z_erofs_maprecorder {
 	struct inode *inode;
 	struct erofs_map_blocks *map;
-- 
2.24.4


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

* [PATCH v2] erofs: get rid of z_erofs_fill_inode()
  2023-04-11 10:10 [PATCH] erofs: get rid of z_erofs_fill_inode() Gao Xiang
@ 2023-04-13  9:22 ` Gao Xiang
  2023-04-14  2:11   ` Yue Hu
  2023-04-16 14:36   ` Chao Yu
  0 siblings, 2 replies; 4+ messages in thread
From: Gao Xiang @ 2023-04-13  9:22 UTC (permalink / raw)
  To: linux-erofs; +Cc: Gao Xiang, LKML

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>
---
changes since v1:
 - fix up build errors without compression.

 fs/erofs/inode.c    | 12 ++++++++----
 fs/erofs/internal.h |  2 --
 fs/erofs/zmap.c     | 18 ------------------
 3 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 7ca9aafb7471..e196d453291b 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -291,11 +291,15 @@ static int erofs_fill_inode(struct inode *inode)
 	}
 
 	if (erofs_inode_is_data_compressed(vi->datalayout)) {
+#ifdef CONFIG_EROFS_FS_ZIP
 		if (!erofs_is_fscache_mode(inode->i_sb) &&
-		    inode->i_sb->s_blocksize_bits == PAGE_SHIFT)
-			err = z_erofs_fill_inode(inode);
-		else
-			err = -EOPNOTSUPP;
+		    inode->i_sb->s_blocksize_bits == PAGE_SHIFT) {
+			inode->i_mapping->a_ops = &z_erofs_aops;
+			err = 0;
+			goto out_unlock;
+		}
+#endif
+		err = -EOPNOTSUPP;
 		goto out_unlock;
 	}
 	inode->i_mapping->a_ops = &erofs_raw_access_aops;
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index f675050af2bb..f1268cb6a37c 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -522,7 +522,6 @@ int erofs_try_to_free_cached_page(struct page *page);
 int z_erofs_load_lz4_config(struct super_block *sb,
 			    struct erofs_super_block *dsb,
 			    struct z_erofs_lz4_cfgs *lz4, int len);
-int z_erofs_fill_inode(struct inode *inode);
 int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map,
 			    int flags);
 #else
@@ -542,7 +541,6 @@ static inline int z_erofs_load_lz4_config(struct super_block *sb,
 	}
 	return 0;
 }
-static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP; }
 #endif	/* !CONFIG_EROFS_FS_ZIP */
 
 #ifdef CONFIG_EROFS_FS_ZIP_LZMA
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index 7ca108c3834c..14c21284d019 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -7,24 +7,6 @@
 #include <asm/unaligned.h>
 #include <trace/events/erofs.h>
 
-int z_erofs_fill_inode(struct inode *inode)
-{
-	struct erofs_inode *const vi = EROFS_I(inode);
-	struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
-
-	if (!erofs_sb_has_big_pcluster(sbi) &&
-	    !erofs_sb_has_ztailpacking(sbi) && !erofs_sb_has_fragments(sbi) &&
-	    vi->datalayout == EROFS_INODE_COMPRESSED_FULL) {
-		vi->z_advise = 0;
-		vi->z_algorithmtype[0] = 0;
-		vi->z_algorithmtype[1] = 0;
-		vi->z_logical_clusterbits = inode->i_sb->s_blocksize_bits;
-		set_bit(EROFS_I_Z_INITED_BIT, &vi->flags);
-	}
-	inode->i_mapping->a_ops = &z_erofs_aops;
-	return 0;
-}
-
 struct z_erofs_maprecorder {
 	struct inode *inode;
 	struct erofs_map_blocks *map;
-- 
2.24.4


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

* Re: [PATCH v2] erofs: get rid of z_erofs_fill_inode()
  2023-04-13  9:22 ` [PATCH v2] " Gao Xiang
@ 2023-04-14  2:11   ` Yue Hu
  2023-04-16 14:36   ` Chao Yu
  1 sibling, 0 replies; 4+ messages in thread
From: Yue Hu @ 2023-04-14  2:11 UTC (permalink / raw)
  To: Gao Xiang; +Cc: huyue2, linux-erofs, LKML, zhangwen

On Thu, 13 Apr 2023 17:22:41 +0800
Gao Xiang <hsiangkao@linux.alibaba.com> wrote:

> 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>


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

* Re: [PATCH v2] erofs: get rid of z_erofs_fill_inode()
  2023-04-13  9:22 ` [PATCH v2] " Gao Xiang
  2023-04-14  2:11   ` Yue Hu
@ 2023-04-16 14:36   ` Chao Yu
  1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu @ 2023-04-16 14:36 UTC (permalink / raw)
  To: Gao Xiang, linux-erofs; +Cc: LKML

On 2023/4/13 17:22, Gao Xiang wrote:
> 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: Chao Yu <chao@kernel.org>

Thanks,

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

end of thread, other threads:[~2023-04-16 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-11 10:10 [PATCH] erofs: get rid of z_erofs_fill_inode() Gao Xiang
2023-04-13  9:22 ` [PATCH v2] " Gao Xiang
2023-04-14  2:11   ` Yue Hu
2023-04-16 14:36   ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).