Skip to content

Commit 20ee082

Browse files
asjChris Mason
authored andcommitted
btrfs: code optimize: BTRFS_ATTR_RW could set the mode
BTRFS_ATTR_RW could set the mode and be inline with BTRFS_ATTR Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Chris Mason <clm@fb.com>
1 parent 98b3d38 commit 20ee082

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎fs/btrfs/sysfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static ssize_t btrfs_label_store(struct kobject *kobj,
401401

402402
return ret;
403403
}
404-
BTRFS_ATTR_RW(label, 0644, btrfs_label_show, btrfs_label_store);
404+
BTRFS_ATTR_RW(label, btrfs_label_show, btrfs_label_store);
405405

406406
static ssize_t btrfs_nodesize_show(struct kobject *kobj,
407407
struct kobj_attribute *a, char *buf)

‎fs/btrfs/sysfs.h‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ enum btrfs_feature_set {
2020
.store = _store, \
2121
}
2222

23-
#define BTRFS_ATTR_RW(_name, _mode, _show, _store) \
23+
#define BTRFS_ATTR_RW(_name, _show, _store) \
2424
static struct kobj_attribute btrfs_attr_##_name = \
25-
__INIT_KOBJ_ATTR(_name, _mode, _show, _store)
25+
__INIT_KOBJ_ATTR(_name, 0644, _show, _store)
2626

2727
#define BTRFS_ATTR(_name, _show) \
28-
BTRFS_ATTR_RW(_name, 0444, _show, NULL)
28+
static struct kobj_attribute btrfs_attr_##_name = \
29+
__INIT_KOBJ_ATTR(_name, 0444, _show, NULL)
2930

3031
#define BTRFS_ATTR_PTR(_name) (&btrfs_attr_##_name.attr)
3132

0 commit comments

Comments
 (0)