[PATCH 10/21] erofs: kill is_inode_layout_compression()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Gao Xiang <gaoxiang25@xxxxxxxxxx>

As Christoph suggested [1], "The name of this helper
is a little odd.  But I think just opencoding it seems
generally cleaner anyway. "

[1] https://lore.kernel.org/r/20190829102426.GE20598@xxxxxxxxxxxxx/
Reported-by: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Signed-off-by: Gao Xiang <gaoxiang25@xxxxxxxxxx>
---
 fs/erofs/data.c     | 2 +-
 fs/erofs/inode.c    | 8 ++++----
 fs/erofs/internal.h | 5 -----
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index d736d2e551a1..e2e40ec2bfd1 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -169,7 +169,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
 int erofs_map_blocks(struct inode *inode,
 		     struct erofs_map_blocks *map, int flags)
 {
-	if (is_inode_layout_compression(inode)) {
+	if (erofs_inode_is_data_compressed(EROFS_I(inode)->datamode)) {
 		int err = z_erofs_map_blocks_iter(inode, map, flags);
 
 		if (map->mpage) {
diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 29a52138fa9d..d501ceb62c29 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -56,7 +56,7 @@ static int read_inode(struct inode *inode, void *data)
 		inode->i_size = le64_to_cpu(v2->i_size);
 
 		/* total blocks for compressed files */
-		if (is_inode_layout_compression(inode))
+		if (erofs_inode_is_data_compressed(vi->datamode))
 			nblks = le32_to_cpu(v2->i_u.compressed_blocks);
 	} else if (__inode_version(advise) == EROFS_INODE_LAYOUT_V1) {
 		struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
@@ -87,7 +87,7 @@ static int read_inode(struct inode *inode, void *data)
 			sbi->build_time_nsec;
 
 		inode->i_size = le32_to_cpu(v1->i_size);
-		if (is_inode_layout_compression(inode))
+		if (erofs_inode_is_data_compressed(vi->datamode))
 			nblks = le32_to_cpu(v1->i_u.compressed_blocks);
 	} else {
 		errln("unsupported on-disk inode version %u of nid %llu",
@@ -204,7 +204,7 @@ static int fill_inode(struct inode *inode, int isdir)
 			goto out_unlock;
 		}
 
-		if (is_inode_layout_compression(inode)) {
+		if (erofs_inode_is_data_compressed(vi->datamode)) {
 			err = z_erofs_fill_inode(inode);
 			goto out_unlock;
 		}
@@ -283,7 +283,7 @@ int erofs_getattr(const struct path *path, struct kstat *stat,
 {
 	struct inode *const inode = d_inode(path->dentry);
 
-	if (is_inode_layout_compression(inode))
+	if (erofs_inode_is_data_compressed(EROFS_I(inode)->datamode))
 		stat->attributes |= STATX_ATTR_COMPRESSED;
 
 	stat->attributes |= STATX_ATTR_IMMUTABLE;
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 4442a6622504..6bd82a82b11f 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -327,11 +327,6 @@ static inline unsigned long inode_datablocks(struct inode *inode)
 	return DIV_ROUND_UP(inode->i_size, EROFS_BLKSIZ);
 }
 
-static inline bool is_inode_layout_compression(struct inode *inode)
-{
-	return erofs_inode_is_data_compressed(EROFS_I(inode)->datamode);
-}
-
 static inline bool is_inode_flat_inline(struct inode *inode)
 {
 	return EROFS_I(inode)->datamode == EROFS_INODE_FLAT_INLINE;
-- 
2.17.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux