aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/xenfs
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2009-02-09 15:05:49 -0500
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2010-10-20 19:22:30 -0400
commit24a89b5be4cf2b7f1b49b56b6cb4a7b71fccf241 (patch)
treecb19b4d662cce8e2f0a62e467bc83848863bccb6 /drivers/xen/xenfs
parent1c5de1939c204bde9cce87f4eb3d26e9f9eb732b (diff)
xen/privcmd: create address space to allow writable mmaps
These are necessary to allow writeable mmap of the privcmd node to succeed without being marked read-only for writenotify purposes. Which in turn is necessary to allow mappings of foreign guest pages [ Impact: bugfix: allow writable mappings ] Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'drivers/xen/xenfs')
-rw-r--r--drivers/xen/xenfs/super.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
index 8c7462866e90..23f1cca5a2e9 100644
--- a/drivers/xen/xenfs/super.c
+++ b/drivers/xen/xenfs/super.c
@@ -12,6 +12,8 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/magic.h> 14#include <linux/magic.h>
15#include <linux/mm.h>
16#include <linux/backing-dev.h>
15 17
16#include <xen/xen.h> 18#include <xen/xen.h>
17 19
@@ -22,12 +24,30 @@
22MODULE_DESCRIPTION("Xen filesystem"); 24MODULE_DESCRIPTION("Xen filesystem");
23MODULE_LICENSE("GPL"); 25MODULE_LICENSE("GPL");
24 26
27static int xenfs_set_page_dirty(struct page *page)
28{
29 if (!PageDirty(page))
30 SetPageDirty(page);
31 return 0;
32}
33
34static const struct address_space_operations xenfs_aops = {
35 .set_page_dirty = xenfs_set_page_dirty,
36};
37
38static struct backing_dev_info xenfs_backing_dev_info = {
39 .ra_pages = 0, /* No readahead */
40 .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK,
41};
42
25static struct inode *xenfs_make_inode(struct super_block *sb, int mode) 43static struct inode *xenfs_make_inode(struct super_block *sb, int mode)
26{ 44{
27 struct inode *ret = new_inode(sb); 45 struct inode *ret = new_inode(sb);
28 46
29 if (ret) { 47 if (ret) {
30 ret->i_mode = mode; 48 ret->i_mode = mode;
49 ret->i_mapping->a_ops = &xenfs_aops;
50 ret->i_mapping->backing_dev_info = &xenfs_backing_dev_info;
31 ret->i_uid = ret->i_gid = 0; 51 ret->i_uid = ret->i_gid = 0;
32 ret->i_blocks = 0; 52 ret->i_blocks = 0;
33 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; 53 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
@@ -119,11 +139,25 @@ static struct file_system_type xenfs_type = {
119 139
120static int __init xenfs_init(void) 140static int __init xenfs_init(void)
121{ 141{
122 if (xen_domain()) 142 int err;
123 return register_filesystem(&xenfs_type); 143 if (!xen_domain()) {
144 printk(KERN_INFO "xenfs: not registering filesystem on non-xen platform\n");
145 return 0;
146 }
124 147
125 printk(KERN_INFO "XENFS: not registering filesystem on non-xen platform\n"); 148 err = register_filesystem(&xenfs_type);
126 return 0; 149 if (err) {
150 printk(KERN_ERR "xenfs: Unable to register filesystem!\n");
151 goto out;
152 }
153
154 err = bdi_init(&xenfs_backing_dev_info);
155 if (err)
156 unregister_filesystem(&xenfs_type);
157
158 out:
159
160 return err;
127} 161}
128 162
129static void __exit xenfs_exit(void) 163static void __exit xenfs_exit(void)