• Misono Tomohiro's avatar
    btrfs: sysfs: Add entry which shows if rmdir can work on subvolumes · f902bd3a
    Misono Tomohiro authored
    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: default avatarTomohiro Misono <misono.tomohiro@jp.fujitsu.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    f902bd3a
sysfs.c 24.3 KB