Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=37e29d906c6eb1ece907e509160518b2edc2c083
Commit:     37e29d906c6eb1ece907e509160518b2edc2c083
Parent:     19d1408dfd683daf1c158bb8fbf54324eb4bf568
Author:     Avi Kivity <[EMAIL PROTECTED]>
AuthorDate: Tue Feb 20 14:07:37 2007 +0200
Committer:  Avi Kivity <[EMAIL PROTECTED]>
CommitDate: Sun Mar 4 11:12:41 2007 +0200

    KVM: Add internal filesystem for generating inodes
    
    The kvmfs inodes will represent virtual machines and vcpus, as necessary,
    reducing cacheline bouncing due to inodes and filps being shared.
    
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
---
 drivers/kvm/kvm_main.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 0df0eeb..c01252e 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -36,6 +36,8 @@
 #include <asm/desc.h>
 #include <linux/sysdev.h>
 #include <linux/cpu.h>
+#include <linux/fs.h>
+#include <linux/mount.h>
 
 #include "x86_emulate.h"
 #include "segment_descriptor.h"
@@ -72,6 +74,9 @@ static struct kvm_stats_debugfs_item {
 
 static struct dentry *debugfs_dir;
 
+#define KVMFS_MAGIC 0x19700426
+struct vfsmount *kvmfs_mnt;
+
 #define MAX_IO_MSRS 256
 
 #define CR0_RESEVED_BITS 0xffffffff1ffaffc0ULL
@@ -2252,6 +2257,18 @@ static struct sys_device kvm_sysdev = {
 
 hpa_t bad_page_address;
 
+static int kvmfs_get_sb(struct file_system_type *fs_type, int flags,
+                       const char *dev_name, void *data, struct vfsmount *mnt)
+{
+       return get_sb_pseudo(fs_type, "kvm:", NULL, KVMFS_MAGIC, mnt);
+}
+
+static struct file_system_type kvm_fs_type = {
+       .name           = "kvmfs",
+       .get_sb         = kvmfs_get_sb,
+       .kill_sb        = kill_anon_super,
+};
+
 int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module)
 {
        int r;
@@ -2328,8 +2345,16 @@ void kvm_exit_arch(void)
 static __init int kvm_init(void)
 {
        static struct page *bad_page;
-       int r = 0;
+       int r;
+
+       r = register_filesystem(&kvm_fs_type);
+       if (r)
+               goto out3;
 
+       kvmfs_mnt = kern_mount(&kvm_fs_type);
+       r = PTR_ERR(kvmfs_mnt);
+       if (IS_ERR(kvmfs_mnt))
+               goto out2;
        kvm_init_debug();
 
        kvm_init_msr_list();
@@ -2346,6 +2371,10 @@ static __init int kvm_init(void)
 
 out:
        kvm_exit_debug();
+       mntput(kvmfs_mnt);
+out2:
+       unregister_filesystem(&kvm_fs_type);
+out3:
        return r;
 }
 
@@ -2353,6 +2382,8 @@ static __exit void kvm_exit(void)
 {
        kvm_exit_debug();
        __free_page(pfn_to_page(bad_page_address >> PAGE_SHIFT));
+       mntput(kvmfs_mnt);
+       unregister_filesystem(&kvm_fs_type);
 }
 
 module_init(kvm_init)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to