On Tue, Sep 11, 2018 at 12:14:47PM -0700, Omar Sandoval wrote: > > The unlikely can go away, sure. > > > > I would still like to remove the test_bit call when tests are compiled > > out. There are about 10 calls to btrfs_is_testing in various core > > functions, followed by further statements. This would have a > > (negligible) runtime penalty but generates effectively unused code on > > production builds. > > > > The static inline function returning 0 allows to optimize out the unused > > code, so smaller code, fewer inctructions, etc. > > Absolutely, I just mean that the CONFIG_BTRFS_FS_RUN_SANITY_TESTS > version can be cleaner: > > #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS > static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info) > { > return test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state); > } > #else > static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info) > { > return 0; > } > #endif > > I find `if (1) return 1; else return 0;` really icky.
I see what you mean, will fix it.