mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-04 01:24:12 +08:00
btrfs: sysfs: add UUID/debug/discard directory
Setup base sysfs directory for discard stats + tunables. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Dennis Zhou <dennis@kernel.org> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
93945cb43e
commit
e4faab844a
@ -930,6 +930,7 @@ struct btrfs_fs_info {
|
||||
|
||||
#ifdef CONFIG_BTRFS_DEBUG
|
||||
struct kobject *debug_kobj;
|
||||
struct kobject *discard_debug_kobj;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -338,6 +338,13 @@ static const struct attribute_group btrfs_static_feature_attr_group = {
|
||||
|
||||
#ifdef CONFIG_BTRFS_DEBUG
|
||||
|
||||
/*
|
||||
* Discard statistics and tunables
|
||||
*/
|
||||
static const struct attribute *discard_debug_attrs[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
/*
|
||||
* Runtime debugging exported via sysfs
|
||||
*
|
||||
@ -776,6 +783,12 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info)
|
||||
kobject_put(fs_info->space_info_kobj);
|
||||
}
|
||||
#ifdef CONFIG_BTRFS_DEBUG
|
||||
if (fs_info->discard_debug_kobj) {
|
||||
sysfs_remove_files(fs_info->discard_debug_kobj,
|
||||
discard_debug_attrs);
|
||||
kobject_del(fs_info->discard_debug_kobj);
|
||||
kobject_put(fs_info->discard_debug_kobj);
|
||||
}
|
||||
if (fs_info->debug_kobj) {
|
||||
sysfs_remove_files(fs_info->debug_kobj, btrfs_debug_mount_attrs);
|
||||
kobject_del(fs_info->debug_kobj);
|
||||
@ -1127,6 +1140,19 @@ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
|
||||
error = sysfs_create_files(fs_info->debug_kobj, btrfs_debug_mount_attrs);
|
||||
if (error)
|
||||
goto failure;
|
||||
|
||||
/* Discard directory */
|
||||
fs_info->discard_debug_kobj = kobject_create_and_add("discard",
|
||||
fs_info->debug_kobj);
|
||||
if (!fs_info->discard_debug_kobj) {
|
||||
error = -ENOMEM;
|
||||
goto failure;
|
||||
}
|
||||
|
||||
error = sysfs_create_files(fs_info->discard_debug_kobj,
|
||||
discard_debug_attrs);
|
||||
if (error)
|
||||
goto failure;
|
||||
#endif
|
||||
|
||||
error = addrm_unknown_feature_attrs(fs_info, true);
|
||||
|
Loading…
Reference in New Issue
Block a user