Re: [PATCH] fs: ufs: Remove switch statement from ufs_set_de_type function
From: Phillip Potter
Date: Mon Oct 22 2018 - 04:20:11 EST
On Sun, Oct 21, 2018 at 02:02:57PM +0300, Amir Goldstein wrote:
> Yes. If you are looking for a cleanup task, you can
> apply relevant patches from my series, starting with:
> (Leave the xfs patch [11/11] out)
> But besides verifying that patches still apply and build,
> you will need to address the concerns of fs maintainers.
> Take for example the btrfs patch:
> It says:
> + *
> + * Values 0..7 should match common file type values in file_type.h.
> #define BTRFS_FT_UNKNOWN 0
> #define BTRFS_FT_REG_FILE 1
> But that is not enough.
> When converting code to use the generic defines FT_*, instead of
> filesystem defined we need to leave in the code build time assertions
> that will catch an attempt to change fs contancts in the future, e.g.:
> static inline u8 btrfs_inode_type(struct inode *inode)
> - return btrfs_type_by_mode[(inode->i_mode & S_IFMT) >> S_SHIFT];
> + BUILD_BUG_ON(BTRFS_FT_UNKNOWN != FT_UNKNOWN);
> + BUILD_BUG_ON(BTRFS_FT_REG_FILE != FT_REG_FILE);
> + return fs_umode_to_ftype(inode->i_mode);
> Same should be done for all relevant filesystems.
> Then you need to hope that fs maintainers will like this cleanup and
> want to take the patches ;-)
I will give it a go and see how far I get :-)