[10/21] erofs: kill is_inode_layout_compression()
diff mbox series

Message ID 20190901055130.30572-11-hsiangkao@aol.com
State New
Headers show
Series
  • erofs: patchset addressing Christoph's comments
Related show

Commit Message

Gao Xiang Sept. 1, 2019, 5:51 a.m. UTC
From: Gao Xiang <gaoxiang25@huawei.com>

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@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
---
 fs/erofs/data.c     | 2 +-
 fs/erofs/inode.c    | 8 ++++----
 fs/erofs/internal.h | 5 -----
 3 files changed, 5 insertions(+), 10 deletions(-)

Comments

Christoph Hellwig Sept. 2, 2019, 12:11 p.m. UTC | #1
Thanks,

this looks much better.

Patch
diff mbox series

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;