btrfs: sysfs: Add entry which shows if rmdir can work on subvolumes
authorMisono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Thu, 17 May 2018 05:24:51 +0000 (14:24 +0900)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:23:41 +0000 (18:23 +0200)
commitf902bd3a5e19284698ce6d70209d316df15116c6
tree77f138364506df9239eb71f990d9cdc37739ee17
parent6c52157fa9378efc0ff24c5f2602d500997f59db
btrfs: sysfs: Add entry which shows if rmdir can work on subvolumes

Deletion of a subvolume by rmdir(2) has become allowed by the
'commit cd2decf640b1 ("btrfs: Allow rmdir(2) to delete an empty
subvolume")'.

It is a kind of new feature and this commits add a sysfs entry

  /sys/fs/btrfs/features/rmdir_subvol

to indicate the availability of the feature so that a user program
(e.g. fstests) can detect it.

Prior to this commit, all entries in /sys/fs/btrfs/features are feature
which depend on feature bits of superblock (i.e. each feature affects
on-disk format) and managed by attribute_group "btrfs_feature_attr_group".
For each fs, entries in /sys/fs/btrfs/UUID/features indicate which
features are enabled (or can be changed online) for the fs.

However, rmdir_subvol feature only depends on kernel module. Therefore
new attribute_group "btrfs_static_feature_attr_group" is introduced and
sysfs_merge_group() is used to share /sys/fs/btrfs/features directory.
Features in "btrfs_static_feature_attr_group" won't be listed in each
/sys/fs/btrfs/UUID/features.

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/sysfs.c