Hi Johannes, I love your patch! Yet something to improve:
[auto build test ERROR on linus/master] [cannot apply to v5.3-rc6 next-20190830] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Johannes-Thumshirn/btrfs-turn-checksum-type-define-into-a-enum/20190831-103832 config: i386-randconfig-a003-201934 (attached as .config) compiler: gcc-6 (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 reproduce: # save the attached .config to linux build tree make ARCH=i386 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <l...@intel.com> All errors (new ones prefixed by >>): In file included from arch/x86/include/asm/percpu.h:45:0, from arch/x86/include/asm/current.h:6, from include/linux/sched.h:12, from fs/btrfs/sysfs.c:6: fs/btrfs/sysfs.c: In function 'btrfs_supported_checksums_show': >> fs/btrfs/sysfs.c:192:29: error: 'btrfs_csums' undeclared (first use in this >> function) for (i = 0; i < ARRAY_SIZE(btrfs_csums); i++) { ^ include/linux/kernel.h:47:33: note: in definition of macro 'ARRAY_SIZE' #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ^~~ fs/btrfs/sysfs.c:192:29: note: each undeclared identifier is reported only once for each function it appears in for (i = 0; i < ARRAY_SIZE(btrfs_csums); i++) { ^ include/linux/kernel.h:47:33: note: in definition of macro 'ARRAY_SIZE' #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ^~~ In file included from include/linux/kernel.h:16:0, from arch/x86/include/asm/percpu.h:45, from arch/x86/include/asm/current.h:6, from include/linux/sched.h:12, from fs/btrfs/sysfs.c:6: include/linux/build_bug.h:16:45: error: bit-field '<anonymous>' width not an integer constant #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); })) ^ include/linux/compiler.h:357:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO' #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) ^~~~~~~~~~~~~~~~~ include/linux/kernel.h:47:59: note: in expansion of macro '__must_be_array' #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ^~~~~~~~~~~~~~~ fs/btrfs/sysfs.c:192:18: note: in expansion of macro 'ARRAY_SIZE' for (i = 0; i < ARRAY_SIZE(btrfs_csums); i++) { ^~~~~~~~~~ vim +/btrfs_csums +192 fs/btrfs/sysfs.c > 6 #include <linux/sched.h> 7 #include <linux/slab.h> 8 #include <linux/spinlock.h> 9 #include <linux/completion.h> 10 #include <linux/kobject.h> 11 #include <linux/bug.h> 12 #include <linux/debugfs.h> 13 14 #include "ctree.h" 15 #include "disk-io.h" 16 #include "transaction.h" 17 #include "sysfs.h" 18 #include "volumes.h" 19 #include "space-info.h" 20 21 static inline struct btrfs_fs_info *to_fs_info(struct kobject *kobj); 22 static inline struct btrfs_fs_devices *to_fs_devs(struct kobject *kobj); 23 24 static u64 get_features(struct btrfs_fs_info *fs_info, 25 enum btrfs_feature_set set) 26 { 27 struct btrfs_super_block *disk_super = fs_info->super_copy; 28 if (set == FEAT_COMPAT) 29 return btrfs_super_compat_flags(disk_super); 30 else if (set == FEAT_COMPAT_RO) 31 return btrfs_super_compat_ro_flags(disk_super); 32 else 33 return btrfs_super_incompat_flags(disk_super); 34 } 35 36 static void set_features(struct btrfs_fs_info *fs_info, 37 enum btrfs_feature_set set, u64 features) 38 { 39 struct btrfs_super_block *disk_super = fs_info->super_copy; 40 if (set == FEAT_COMPAT) 41 btrfs_set_super_compat_flags(disk_super, features); 42 else if (set == FEAT_COMPAT_RO) 43 btrfs_set_super_compat_ro_flags(disk_super, features); 44 else 45 btrfs_set_super_incompat_flags(disk_super, features); 46 } 47 48 static int can_modify_feature(struct btrfs_feature_attr *fa) 49 { 50 int val = 0; 51 u64 set, clear; 52 switch (fa->feature_set) { 53 case FEAT_COMPAT: 54 set = BTRFS_FEATURE_COMPAT_SAFE_SET; 55 clear = BTRFS_FEATURE_COMPAT_SAFE_CLEAR; 56 break; 57 case FEAT_COMPAT_RO: 58 set = BTRFS_FEATURE_COMPAT_RO_SAFE_SET; 59 clear = BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR; 60 break; 61 case FEAT_INCOMPAT: 62 set = BTRFS_FEATURE_INCOMPAT_SAFE_SET; 63 clear = BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR; 64 break; 65 default: 66 pr_warn("btrfs: sysfs: unknown feature set %d\n", 67 fa->feature_set); 68 return 0; 69 } 70 71 if (set & fa->feature_bit) 72 val |= 1; 73 if (clear & fa->feature_bit) 74 val |= 2; 75 76 return val; 77 } 78 79 static ssize_t btrfs_feature_attr_show(struct kobject *kobj, 80 struct kobj_attribute *a, char *buf) 81 { 82 int val = 0; 83 struct btrfs_fs_info *fs_info = to_fs_info(kobj); 84 struct btrfs_feature_attr *fa = to_btrfs_feature_attr(a); 85 if (fs_info) { 86 u64 features = get_features(fs_info, fa->feature_set); 87 if (features & fa->feature_bit) 88 val = 1; 89 } else 90 val = can_modify_feature(fa); 91 92 return snprintf(buf, PAGE_SIZE, "%d\n", val); 93 } 94 95 static ssize_t btrfs_feature_attr_store(struct kobject *kobj, 96 struct kobj_attribute *a, 97 const char *buf, size_t count) 98 { 99 struct btrfs_fs_info *fs_info; 100 struct btrfs_feature_attr *fa = to_btrfs_feature_attr(a); 101 u64 features, set, clear; 102 unsigned long val; 103 int ret; 104 105 fs_info = to_fs_info(kobj); 106 if (!fs_info) 107 return -EPERM; 108 109 if (sb_rdonly(fs_info->sb)) 110 return -EROFS; 111 112 ret = kstrtoul(skip_spaces(buf), 0, &val); 113 if (ret) 114 return ret; 115 116 if (fa->feature_set == FEAT_COMPAT) { 117 set = BTRFS_FEATURE_COMPAT_SAFE_SET; 118 clear = BTRFS_FEATURE_COMPAT_SAFE_CLEAR; 119 } else if (fa->feature_set == FEAT_COMPAT_RO) { 120 set = BTRFS_FEATURE_COMPAT_RO_SAFE_SET; 121 clear = BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR; 122 } else { 123 set = BTRFS_FEATURE_INCOMPAT_SAFE_SET; 124 clear = BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR; 125 } 126 127 features = get_features(fs_info, fa->feature_set); 128 129 /* Nothing to do */ 130 if ((val && (features & fa->feature_bit)) || 131 (!val && !(features & fa->feature_bit))) 132 return count; 133 134 if ((val && !(set & fa->feature_bit)) || 135 (!val && !(clear & fa->feature_bit))) { 136 btrfs_info(fs_info, 137 "%sabling feature %s on mounted fs is not supported.", 138 val ? "En" : "Dis", fa->kobj_attr.attr.name); 139 return -EPERM; 140 } 141 142 btrfs_info(fs_info, "%s %s feature flag", 143 val ? "Setting" : "Clearing", fa->kobj_attr.attr.name); 144 145 spin_lock(&fs_info->super_lock); 146 features = get_features(fs_info, fa->feature_set); 147 if (val) 148 features |= fa->feature_bit; 149 else 150 features &= ~fa->feature_bit; 151 set_features(fs_info, fa->feature_set, features); 152 spin_unlock(&fs_info->super_lock); 153 154 /* 155 * We don't want to do full transaction commit from inside sysfs 156 */ 157 btrfs_set_pending(fs_info, COMMIT); 158 wake_up_process(fs_info->transaction_kthread); 159 160 return count; 161 } 162 163 static umode_t btrfs_feature_visible(struct kobject *kobj, 164 struct attribute *attr, int unused) 165 { 166 struct btrfs_fs_info *fs_info = to_fs_info(kobj); 167 umode_t mode = attr->mode; 168 169 if (fs_info) { 170 struct btrfs_feature_attr *fa; 171 u64 features; 172 173 fa = attr_to_btrfs_feature_attr(attr); 174 features = get_features(fs_info, fa->feature_set); 175 176 if (can_modify_feature(fa)) 177 mode |= S_IWUSR; 178 else if (!(features & fa->feature_bit)) 179 mode = 0; 180 } 181 182 return mode; 183 } 184 185 static ssize_t btrfs_supported_checksums_show(struct kobject *kobj, 186 struct kobj_attribute *a, 187 char *buf) 188 { 189 ssize_t ret = 0; 190 int i; 191 > 192 for (i = 0; i < ARRAY_SIZE(btrfs_csums); i++) { 193 ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s%s", 194 (i == 0 ? "" : ", "), 195 btrfs_csums[i].name); 196 197 } 198 199 ret += snprintf(buf + ret, PAGE_SIZE - ret, "\n"); 200 return ret; 201 } 202 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
.config.gz
Description: application/gzip