diff options
author | Gao Xiang <gaoxiang25@huawei.com> | 2019-09-04 10:08:54 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-05 20:10:07 +0200 |
commit | 8a76568225deae18cea1d1a21c2bade2f2ced2ba (patch) | |
tree | 1156c41d308d2a292b6c7ed5aa0fe916b10ec495 /fs/erofs/internal.h | |
parent | 426a930891cf17c5c16f12e8e2c8cb75c4cfff3c (diff) | |
download | lwn-8a76568225deae18cea1d1a21c2bade2f2ced2ba.tar.gz lwn-8a76568225deae18cea1d1a21c2bade2f2ced2ba.zip |
erofs: better naming for erofs inode related stuffs
updates inode naming
- kill is_inode_layout_compression [1]
- kill magic underscores [2] [3]
- better naming for datamode & data_mapping_mode [3]
- better naming erofs_inode_{compact, extended} [4]
[1] https://lore.kernel.org/r/20190829102426.GE20598@infradead.org/
[2] https://lore.kernel.org/r/20190829102426.GE20598@infradead.org/
[3] https://lore.kernel.org/r/20190902122627.GN15931@infradead.org/
[4] https://lore.kernel.org/r/20190902125438.GA17750@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-8-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/erofs/internal.h')
-rw-r--r-- | fs/erofs/internal.h | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 7ff36f404ec3..0f5cbf0a7570 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -285,7 +285,7 @@ struct erofs_vnode { /* atomic flags (including bitlocks) */ unsigned long flags; - unsigned char datamode; + unsigned char datalayout; unsigned char inode_isize; unsigned short xattr_isize; @@ -310,31 +310,30 @@ struct erofs_vnode { #define EROFS_V(ptr) \ container_of(ptr, struct erofs_vnode, vfs_inode) -#define __inode_advise(x, bit, bits) \ - (((x) >> (bit)) & ((1 << (bits)) - 1)) - -#define __inode_version(advise) \ - __inode_advise(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) - static inline unsigned long inode_datablocks(struct inode *inode) { /* since i_size cannot be changed */ return DIV_ROUND_UP(inode->i_size, EROFS_BLKSIZ); } -static inline bool is_inode_layout_compression(struct inode *inode) +static inline unsigned int erofs_bitrange(unsigned int value, unsigned int bit, + unsigned int bits) +{ + + return (value >> bit) & ((1 << bits) - 1); +} + + +static inline unsigned int erofs_inode_version(unsigned int value) { - return erofs_inode_is_data_compressed(EROFS_V(inode)->datamode); + return erofs_bitrange(value, EROFS_I_VERSION_BIT, + EROFS_I_VERSION_BITS); } -static inline bool is_inode_flat_inline(struct inode *inode) +static inline unsigned int erofs_inode_datalayout(unsigned int value) { - return EROFS_V(inode)->datamode == EROFS_INODE_FLAT_INLINE; + return erofs_bitrange(value, EROFS_I_DATALAYOUT_BIT, + EROFS_I_DATALAYOUT_BITS); } extern const struct super_operations erofs_sops; |