From: Gao Xiang <gaoxiang25@xxxxxxxxxx> As Christoph said [1], " > + vi->datamode = __inode_data_mapping(advise); What is the deal with these magic underscores here and various other similar helpers? " Let avoid magic underscores now... [1] https://lore.kernel.org/lkml/20190829102426.GE20598@xxxxxxxxxxxxx/ Reported-by: Christoph Hellwig <hch@xxxxxxxxxxxxx> Signed-off-by: Gao Xiang <gaoxiang25@xxxxxxxxxx> --- fs/erofs/inode.c | 8 ++++---- fs/erofs/internal.h | 14 ++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 19a574ee690b..2ca4eda6e5bf 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -16,7 +16,7 @@ static int read_inode(struct inode *inode, void *data) const unsigned int advise = le16_to_cpu(v1->i_advise); erofs_blk_t nblks = 0; - vi->datamode = __inode_data_mapping(advise); + vi->datamode = erofs_inode_data_mapping(advise); if (vi->datamode >= EROFS_INODE_LAYOUT_MAX) { errln("unsupported data mapping %u of nid %llu", @@ -25,7 +25,7 @@ static int read_inode(struct inode *inode, void *data) return -EOPNOTSUPP; } - if (__inode_version(advise) == EROFS_INODE_LAYOUT_V2) { + if (erofs_inode_version(advise) == EROFS_INODE_LAYOUT_V2) { struct erofs_inode_v2 *v2 = data; vi->inode_isize = sizeof(struct erofs_inode_v2); @@ -58,7 +58,7 @@ static int read_inode(struct inode *inode, void *data) /* total blocks for compressed files */ 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) { + } else if (erofs_inode_version(advise) == EROFS_INODE_LAYOUT_V1) { struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb); vi->inode_isize = sizeof(struct erofs_inode_v1); @@ -91,7 +91,7 @@ static int read_inode(struct inode *inode, void *data) nblks = le32_to_cpu(v1->i_u.compressed_blocks); } else { errln("unsupported on-disk inode version %u of nid %llu", - __inode_version(advise), vi->nid); + erofs_inode_version(advise), vi->nid); DBG_BUGON(1); return -EOPNOTSUPP; } diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 15545959af92..4a35a31fd454 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -308,16 +308,14 @@ struct erofs_inode { #define EROFS_I(ptr) \ container_of(ptr, struct erofs_inode, vfs_inode) -#define __inode_advise(x, bit, bits) \ - (((x) >> (bit)) & ((1 << (bits)) - 1)) +#define erofs_bitrange(x, bit, bits) (((x) >> (bit)) & ((1 << (bits)) - 1)) -#define __inode_version(advise) \ - __inode_advise(advise, EROFS_I_VERSION_BIT, \ - EROFS_I_VERSION_BITS) +#define erofs_inode_version(advise) \ + erofs_bitrange(advise, EROFS_I_VERSION_BIT, EROFS_I_VERSION_BITS) -#define __inode_data_mapping(advise) \ - __inode_advise(advise, EROFS_I_DATA_MAPPING_BIT,\ - EROFS_I_DATA_MAPPING_BITS) +#define erofs_inode_data_mapping(advise) \ + erofs_bitrange(advise, EROFS_I_DATA_MAPPING_BIT, \ + EROFS_I_DATA_MAPPING_BITS) static inline unsigned long inode_datablocks(struct inode *inode) { -- 2.17.1