Message ID | 20190901055130.30572-6-hsiangkao@aol.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | erofs: patchset addressing Christoph's comments | expand |
On Sun, Sep 01, 2019 at 01:51:14PM +0800, Gao Xiang wrote: > From: Gao Xiang <gaoxiang25@huawei.com> > > As Christoph said, "This looks like a really obsfucated > way to write: > return datamode == EROFS_INODE_FLAT_COMPRESSION || > datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY; " > > Although I had my own consideration, it's the right way for now. Well, if you do check one field for two values it really helps to do the same style of check for both. All your choice how you do the check, but don't mix multiple styles.. So this looks good.
diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h index 59dcc2e8cb02..87d7ae82339a 100644 --- a/fs/erofs/erofs_fs.h +++ b/fs/erofs/erofs_fs.h @@ -62,9 +62,8 @@ enum { static inline bool erofs_inode_is_data_compressed(unsigned int datamode) { - if (datamode == EROFS_INODE_FLAT_COMPRESSION) - return true; - return datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY; + return datamode == EROFS_INODE_FLAT_COMPRESSION || + datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY; } /* bit definitions of inode i_advise */