Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcache: use default_groups in kobj_type

There are currently 2 ways to create a set of sysfs files for a
kobj_type, through the default_attrs field, and the default_groups
field. Move the bcache sysfs code to use default_groups field which has
been the preferred way since aa30f47cf666 ("kobject: Add support for
default attribute groups to kobj_type") so that we can soon get rid of
the obsolete default_attrs field.

Cc: Kent Overstreet <kent.overstreet@gmail.com>
Cc: linux-bcache@vger.kernel.org
Acked-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20220106100004.3277439-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+13 -7
+2 -1
drivers/md/bcache/stats.c
··· 78 78 { 79 79 } 80 80 81 - static struct attribute *bch_stats_files[] = { 81 + static struct attribute *bch_stats_attrs[] = { 82 82 &sysfs_cache_hits, 83 83 &sysfs_cache_misses, 84 84 &sysfs_cache_bypass_hits, ··· 88 88 &sysfs_bypassed, 89 89 NULL 90 90 }; 91 + ATTRIBUTE_GROUPS(bch_stats); 91 92 static KTYPE(bch_stats); 92 93 93 94 int bch_cache_accounting_add_kobjs(struct cache_accounting *acc,
+10 -5
drivers/md/bcache/sysfs.c
··· 500 500 return size; 501 501 } 502 502 503 - static struct attribute *bch_cached_dev_files[] = { 503 + static struct attribute *bch_cached_dev_attrs[] = { 504 504 &sysfs_attach, 505 505 &sysfs_detach, 506 506 &sysfs_stop, ··· 543 543 &sysfs_backing_dev_uuid, 544 544 NULL 545 545 }; 546 + ATTRIBUTE_GROUPS(bch_cached_dev); 546 547 KTYPE(bch_cached_dev); 547 548 548 549 SHOW(bch_flash_dev) ··· 601 600 } 602 601 STORE_LOCKED(bch_flash_dev) 603 602 604 - static struct attribute *bch_flash_dev_files[] = { 603 + static struct attribute *bch_flash_dev_attrs[] = { 605 604 &sysfs_unregister, 606 605 #if 0 607 606 &sysfs_data_csum, ··· 610 609 &sysfs_size, 611 610 NULL 612 611 }; 612 + ATTRIBUTE_GROUPS(bch_flash_dev); 613 613 KTYPE(bch_flash_dev); 614 614 615 615 struct bset_stats_op { ··· 957 955 { 958 956 } 959 957 960 - static struct attribute *bch_cache_set_files[] = { 958 + static struct attribute *bch_cache_set_attrs[] = { 961 959 &sysfs_unregister, 962 960 &sysfs_stop, 963 961 &sysfs_synchronous, ··· 982 980 &sysfs_clear_stats, 983 981 NULL 984 982 }; 983 + ATTRIBUTE_GROUPS(bch_cache_set); 985 984 KTYPE(bch_cache_set); 986 985 987 - static struct attribute *bch_cache_set_internal_files[] = { 986 + static struct attribute *bch_cache_set_internal_attrs[] = { 988 987 &sysfs_active_journal_entries, 989 988 990 989 sysfs_time_stats_attribute_list(btree_gc, sec, ms) ··· 1025 1022 &sysfs_feature_incompat, 1026 1023 NULL 1027 1024 }; 1025 + ATTRIBUTE_GROUPS(bch_cache_set_internal); 1028 1026 KTYPE(bch_cache_set_internal); 1029 1027 1030 1028 static int __bch_cache_cmp(const void *l, const void *r) ··· 1186 1182 } 1187 1183 STORE_LOCKED(bch_cache) 1188 1184 1189 - static struct attribute *bch_cache_files[] = { 1185 + static struct attribute *bch_cache_attrs[] = { 1190 1186 &sysfs_bucket_size, 1191 1187 &sysfs_block_size, 1192 1188 &sysfs_nbuckets, ··· 1200 1196 &sysfs_cache_replacement_policy, 1201 1197 NULL 1202 1198 }; 1199 + ATTRIBUTE_GROUPS(bch_cache); 1203 1200 KTYPE(bch_cache);
+1 -1
drivers/md/bcache/sysfs.h
··· 9 9 .show = type ## _show, \ 10 10 .store = type ## _store \ 11 11 }), \ 12 - .default_attrs = type ## _files \ 12 + .default_groups = type ## _groups \ 13 13 } 14 14 15 15 #define SHOW(fn) \