btrfs: code optimize: BTRFS_ATTR_RW could set the mode
authorAnand Jain <Anand.Jain@oracle.com>
Wed, 30 Jul 2014 12:04:09 +0000 (20:04 +0800)
committerChris Mason <clm@fb.com>
Wed, 17 Sep 2014 20:37:59 +0000 (13:37 -0700)
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>
fs/btrfs/sysfs.c
fs/btrfs/sysfs.h

index a1c10886d9f29043f57236feaad887c382ee434c..e6a5e7d82f4286da251e6b00b4ccb4a936b6c055 100644 (file)
@@ -401,7 +401,7 @@ static ssize_t btrfs_label_store(struct kobject *kobj,
 
        return ret;
 }
-BTRFS_ATTR_RW(label, 0644, btrfs_label_show, btrfs_label_store);
+BTRFS_ATTR_RW(label, btrfs_label_show, btrfs_label_store);
 
 static ssize_t btrfs_nodesize_show(struct kobject *kobj,
                                struct kobj_attribute *a, char *buf)
index 531b11ee9124e74f39de5ee73ff5c9c9373a1c47..f7dd298b3cf6ecbb080924ffd083af7bb68a4e1f 100644 (file)
@@ -20,12 +20,13 @@ enum btrfs_feature_set {
        .store  = _store,                                               \
 }
 
-#define BTRFS_ATTR_RW(_name, _mode, _show, _store)                     \
+#define BTRFS_ATTR_RW(_name, _show, _store)                    \
        static struct kobj_attribute btrfs_attr_##_name =               \
-                       __INIT_KOBJ_ATTR(_name, _mode, _show, _store)
+                       __INIT_KOBJ_ATTR(_name, 0644, _show, _store)
 
 #define BTRFS_ATTR(_name, _show)                                       \
-                       BTRFS_ATTR_RW(_name, 0444, _show, NULL)
+       static struct kobj_attribute btrfs_attr_##_name =               \
+                       __INIT_KOBJ_ATTR(_name, 0444, _show, NULL)
 
 #define BTRFS_ATTR_PTR(_name)    (&btrfs_attr_##_name.attr)