Skip to contentSkip to conversation

kvm: Refactor handling of VM debugfs files

PATCH Superseded Milan Pandurov 1 participant 1 message Dec 12, 2019 KVM

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 kvm: Refactor handling of VM debugfs files

We can store reference to kvm_stats_debugfs_item instead of copying its values to kvm_stat_data.
This allows us to remove duplicated code and usage of temporary kvm_stat_data inside vm_stat_get et al.

---
v1 -> v2:
- fix compile issues
- address comments

v2 -> v3:
- address comments

---
 include/linux/kvm_host.h |   7 +-
 virt/kvm/kvm_main.c      | 142 +++++++++++++++++++--------------------
 2 files changed, 76 insertions(+), 73 deletions(-)
include/linux/kvm_host.h +5 -2
index 7ed1e2f8641e..d3f2c0eae857 100644
@@ -1109,9 +1109,8 @@ enum kvm_stat_kind {
 };
 
 struct kvm_stat_data {
-	int offset;
-	int mode;
 	struct kvm *kvm;
+	struct kvm_stats_debugfs_item *dbgfs_item;
 };
 
 struct kvm_stats_debugfs_item {
@@ -1120,6 +1119,10 @@ struct kvm_stats_debugfs_item {
 	enum kvm_stat_kind kind;
 	int mode;
 };
+
+#define KVM_DBGFS_GET_MODE(dbgfs_item)                                         \
+	((dbgfs_item)->mode ? (dbgfs_item)->mode : 0644)
+
 extern struct kvm_stats_debugfs_item debugfs_entries[];
 extern struct dentry *kvm_debugfs_dir;
 
virt/kvm/kvm_main.c +71 -71

255 lines not on this page · raw message

Signature · 12 lines
2.17.1




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879