aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r--fs/btrfs/sysfs.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index e0ac85949067..539e7b5e3f86 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -202,6 +202,7 @@ BTRFS_FEAT_ATTR_INCOMPAT(extended_iref, EXTENDED_IREF);
202BTRFS_FEAT_ATTR_INCOMPAT(raid56, RAID56); 202BTRFS_FEAT_ATTR_INCOMPAT(raid56, RAID56);
203BTRFS_FEAT_ATTR_INCOMPAT(skinny_metadata, SKINNY_METADATA); 203BTRFS_FEAT_ATTR_INCOMPAT(skinny_metadata, SKINNY_METADATA);
204BTRFS_FEAT_ATTR_INCOMPAT(no_holes, NO_HOLES); 204BTRFS_FEAT_ATTR_INCOMPAT(no_holes, NO_HOLES);
205BTRFS_FEAT_ATTR_COMPAT_RO(free_space_tree, FREE_SPACE_TREE);
205 206
206static struct attribute *btrfs_supported_feature_attrs[] = { 207static struct attribute *btrfs_supported_feature_attrs[] = {
207 BTRFS_FEAT_ATTR_PTR(mixed_backref), 208 BTRFS_FEAT_ATTR_PTR(mixed_backref),
@@ -213,6 +214,7 @@ static struct attribute *btrfs_supported_feature_attrs[] = {
213 BTRFS_FEAT_ATTR_PTR(raid56), 214 BTRFS_FEAT_ATTR_PTR(raid56),
214 BTRFS_FEAT_ATTR_PTR(skinny_metadata), 215 BTRFS_FEAT_ATTR_PTR(skinny_metadata),
215 BTRFS_FEAT_ATTR_PTR(no_holes), 216 BTRFS_FEAT_ATTR_PTR(no_holes),
217 BTRFS_FEAT_ATTR_PTR(free_space_tree),
216 NULL 218 NULL
217}; 219};
218 220
@@ -780,6 +782,39 @@ failure:
780 return error; 782 return error;
781} 783}
782 784
785
786/*
787 * Change per-fs features in /sys/fs/btrfs/UUID/features to match current
788 * values in superblock. Call after any changes to incompat/compat_ro flags
789 */
790void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
791 u64 bit, enum btrfs_feature_set set)
792{
793 struct btrfs_fs_devices *fs_devs;
794 struct kobject *fsid_kobj;
795 u64 features;
796 int ret;
797
798 if (!fs_info)
799 return;
800
801 features = get_features(fs_info, set);
802 ASSERT(bit & supported_feature_masks[set]);
803
804 fs_devs = fs_info->fs_devices;
805 fsid_kobj = &fs_devs->fsid_kobj;
806
807 if (!fsid_kobj->state_initialized)
808 return;
809
810 /*
811 * FIXME: this is too heavy to update just one value, ideally we'd like
812 * to use sysfs_update_group but some refactoring is needed first.
813 */
814 sysfs_remove_group(fsid_kobj, &btrfs_feature_attr_group);
815 ret = sysfs_create_group(fsid_kobj, &btrfs_feature_attr_group);
816}
817
783static int btrfs_init_debugfs(void) 818static int btrfs_init_debugfs(void)
784{ 819{
785#ifdef CONFIG_DEBUG_FS 820#ifdef CONFIG_DEBUG_FS