summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHongbo Li <lihongbo22@huawei.com>2024-10-29 20:54:08 +0800
committerKent Overstreet <kent.overstreet@linux.dev>2024-12-21 01:36:16 -0500
commit32e573c362db3d15b8046d10cd194c314adf7b82 (patch)
treebf898e57584ff58486cc761732d2c38ebd047228
parentd3d8ec90babcaf8b925cd63c668573abb423e715 (diff)
bcachefs: use attribute define helper for sysfs attribute
The sysfs attribute definition has been wrapped into macro: rw_attribute, read_attribute and write_attribute, we can use these helpers to uniform the attribute definition. Signed-off-by: Hongbo Li <lihongbo22@huawei.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/sysfs.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c
index 47ac8d5ab562..97733c766948 100644
--- a/fs/bcachefs/sysfs.c
+++ b/fs/bcachefs/sysfs.c
@@ -211,6 +211,7 @@ BCH_PERSISTENT_COUNTERS()
#undef x
rw_attribute(discard);
+read_attribute(state);
rw_attribute(label);
read_attribute(copy_gc_wait);
@@ -235,11 +236,6 @@ write_attribute(perf_test);
BCH_TIME_STATS()
#undef x
-static struct attribute sysfs_state_rw = {
- .name = "state",
- .mode = 0444,
-};
-
static size_t bch2_btree_cache_size(struct bch_fs *c)
{
struct btree_cache *bc = &c->btree_cache;
@@ -774,7 +770,7 @@ SHOW(bch2_dev)
prt_char(out, '\n');
}
- if (attr == &sysfs_state_rw) {
+ if (attr == &sysfs_state) {
prt_string_option(out, bch2_member_states, ca->mi.state);
prt_char(out, '\n');
}
@@ -854,7 +850,7 @@ struct attribute *bch2_dev_files[] = {
/* settings: */
&sysfs_discard,
- &sysfs_state_rw,
+ &sysfs_state,
&sysfs_label,
&sysfs_has_data,