Commit 4bd33b56 authored by Janosch Frank's avatar Janosch Frank Committed by Christian Borntraeger

KVM: Remove unnecessary debugfs dentry references

KVM creates debugfs files to export VM statistics to userland. To be
able to remove them on kvm exit it tracks the files' dentries.

Since their parent directory is also tracked and since each parent
direntry knows its children we can easily remove them by using
debugfs_remove_recursive(kvm_debugfs_dir). Therefore we don't
need the extra tracking in the kvm_stats_debugfs_item anymore.
Signed-off-by: default avatarJanosch Frank <frankja@linux.vnet.ibm.com>
Reviewed-By: default avatarSascha Silbe <silbe@linux.vnet.ibm.com>
Acked-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent c896939f
...@@ -1016,7 +1016,6 @@ struct kvm_stats_debugfs_item { ...@@ -1016,7 +1016,6 @@ struct kvm_stats_debugfs_item {
const char *name; const char *name;
int offset; int offset;
enum kvm_stat_kind kind; enum kvm_stat_kind kind;
struct dentry *dentry;
}; };
extern struct kvm_stats_debugfs_item debugfs_entries[]; extern struct kvm_stats_debugfs_item debugfs_entries[];
extern struct dentry *kvm_debugfs_dir; extern struct dentry *kvm_debugfs_dir;
......
...@@ -3447,10 +3447,9 @@ static int kvm_init_debug(void) ...@@ -3447,10 +3447,9 @@ static int kvm_init_debug(void)
goto out; goto out;
for (p = debugfs_entries; p->name; ++p) { for (p = debugfs_entries; p->name; ++p) {
p->dentry = debugfs_create_file(p->name, 0444, kvm_debugfs_dir, if (!debugfs_create_file(p->name, 0444, kvm_debugfs_dir,
(void *)(long)p->offset, (void *)(long)p->offset,
stat_fops[p->kind]); stat_fops[p->kind]))
if (p->dentry == NULL)
goto out_dir; goto out_dir;
} }
...@@ -3462,15 +3461,6 @@ static int kvm_init_debug(void) ...@@ -3462,15 +3461,6 @@ static int kvm_init_debug(void)
return r; return r;
} }
static void kvm_exit_debug(void)
{
struct kvm_stats_debugfs_item *p;
for (p = debugfs_entries; p->name; ++p)
debugfs_remove(p->dentry);
debugfs_remove(kvm_debugfs_dir);
}
static int kvm_suspend(void) static int kvm_suspend(void)
{ {
if (kvm_usage_count) if (kvm_usage_count)
...@@ -3628,7 +3618,7 @@ EXPORT_SYMBOL_GPL(kvm_init); ...@@ -3628,7 +3618,7 @@ EXPORT_SYMBOL_GPL(kvm_init);
void kvm_exit(void) void kvm_exit(void)
{ {
kvm_exit_debug(); debugfs_remove_recursive(kvm_debugfs_dir);
misc_deregister(&kvm_dev); misc_deregister(&kvm_dev);
kmem_cache_destroy(kvm_vcpu_cache); kmem_cache_destroy(kvm_vcpu_cache);
kvm_async_pf_deinit(); kvm_async_pf_deinit();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment