bcache: use default_groups in kobj_type
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Jan 2022 10:00:04 +0000 (11:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Jan 2022 14:56:18 +0000 (15:56 +0100)
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>
drivers/md/bcache/stats.c
drivers/md/bcache/sysfs.c
drivers/md/bcache/sysfs.h

index 4c7ee5fedb9dcb47033a55301d4aba9f04df6408..68b02216033d039b76be143ced490f65f9dc6565 100644 (file)
@@ -78,7 +78,7 @@ static void bch_stats_release(struct kobject *k)
 {
 }
 
-static struct attribute *bch_stats_files[] = {
+static struct attribute *bch_stats_attrs[] = {
        &sysfs_cache_hits,
        &sysfs_cache_misses,
        &sysfs_cache_bypass_hits,
@@ -88,6 +88,7 @@ static struct attribute *bch_stats_files[] = {
        &sysfs_bypassed,
        NULL
 };
+ATTRIBUTE_GROUPS(bch_stats);
 static KTYPE(bch_stats);
 
 int bch_cache_accounting_add_kobjs(struct cache_accounting *acc,
index 1f0dce30fa759e02048d5890112a303b7b83ddf0..d1029d71ff3bc26d64518addbb20b39a8d3fc6ed 100644 (file)
@@ -500,7 +500,7 @@ STORE(bch_cached_dev)
        return size;
 }
 
-static struct attribute *bch_cached_dev_files[] = {
+static struct attribute *bch_cached_dev_attrs[] = {
        &sysfs_attach,
        &sysfs_detach,
        &sysfs_stop,
@@ -543,6 +543,7 @@ static struct attribute *bch_cached_dev_files[] = {
        &sysfs_backing_dev_uuid,
        NULL
 };
+ATTRIBUTE_GROUPS(bch_cached_dev);
 KTYPE(bch_cached_dev);
 
 SHOW(bch_flash_dev)
@@ -600,7 +601,7 @@ STORE(__bch_flash_dev)
 }
 STORE_LOCKED(bch_flash_dev)
 
-static struct attribute *bch_flash_dev_files[] = {
+static struct attribute *bch_flash_dev_attrs[] = {
        &sysfs_unregister,
 #if 0
        &sysfs_data_csum,
@@ -609,6 +610,7 @@ static struct attribute *bch_flash_dev_files[] = {
        &sysfs_size,
        NULL
 };
+ATTRIBUTE_GROUPS(bch_flash_dev);
 KTYPE(bch_flash_dev);
 
 struct bset_stats_op {
@@ -955,7 +957,7 @@ static void bch_cache_set_internal_release(struct kobject *k)
 {
 }
 
-static struct attribute *bch_cache_set_files[] = {
+static struct attribute *bch_cache_set_attrs[] = {
        &sysfs_unregister,
        &sysfs_stop,
        &sysfs_synchronous,
@@ -980,9 +982,10 @@ static struct attribute *bch_cache_set_files[] = {
        &sysfs_clear_stats,
        NULL
 };
+ATTRIBUTE_GROUPS(bch_cache_set);
 KTYPE(bch_cache_set);
 
-static struct attribute *bch_cache_set_internal_files[] = {
+static struct attribute *bch_cache_set_internal_attrs[] = {
        &sysfs_active_journal_entries,
 
        sysfs_time_stats_attribute_list(btree_gc, sec, ms)
@@ -1022,6 +1025,7 @@ static struct attribute *bch_cache_set_internal_files[] = {
        &sysfs_feature_incompat,
        NULL
 };
+ATTRIBUTE_GROUPS(bch_cache_set_internal);
 KTYPE(bch_cache_set_internal);
 
 static int __bch_cache_cmp(const void *l, const void *r)
@@ -1182,7 +1186,7 @@ STORE(__bch_cache)
 }
 STORE_LOCKED(bch_cache)
 
-static struct attribute *bch_cache_files[] = {
+static struct attribute *bch_cache_attrs[] = {
        &sysfs_bucket_size,
        &sysfs_block_size,
        &sysfs_nbuckets,
@@ -1196,4 +1200,5 @@ static struct attribute *bch_cache_files[] = {
        &sysfs_cache_replacement_policy,
        NULL
 };
+ATTRIBUTE_GROUPS(bch_cache);
 KTYPE(bch_cache);
index c1752ba2e05b50ef1789587677876ef64d1b4027..a2ff6447b699f595f6b7a1b0e1fe2504972b067c 100644 (file)
@@ -9,7 +9,7 @@ struct kobj_type type ## _ktype = {                                     \
                .show   = type ## _show,                                \
                .store  = type ## _store                                \
        }),                                                             \
-       .default_attrs  = type ## _files                                \
+       .default_groups = type ## _groups                               \
 }
 
 #define SHOW(fn)                                                       \