aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/xenfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-11-23 18:23:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-11-23 18:23:18 -0500
commita4ec046c98283d9f36817589081e14850570739f (patch)
tree0f0b573bf74ab0eef28c9050c453de9427d328de /drivers/xen/xenfs
parent3cbaa0f7a78d3b970b566629ee298c310780b919 (diff)
parent9b8321531a90c400e9c561d903926eee79639dcf (diff)
Merge branch 'upstream/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen
* 'upstream/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen: (23 commits) xen/events: Use PIRQ instead of GSI value when unmapping MSI/MSI-X irqs. xen: set IO permission early (before early_cpu_init()) xen: re-enable boot-time ballooning xen/balloon: make sure we only include remaining extra ram xen/balloon: the balloon_lock is useless xen: add extra pages to balloon xen: make evtchn's name less generic xen/evtchn: the evtchn device is non-seekable Revert "xen/privcmd: create address space to allow writable mmaps" xen/events: use locked set|clear_bit() for cpu_evtchn_mask xen/evtchn: clear secondary CPUs' cpu_evtchn_mask[] after restore xen/xenfs: update xenfs_mount for new prototype xen: fix header export to userspace xen: implement XENMEM_machphys_mapping xen: set vma flag VM_PFNMAP in the privcmd mmap file_op xen: xenfs: privcmd: check put_user() return code xen/evtchn: add missing static xen/evtchn: Fix name of Xen event-channel device xen/evtchn: don't do unbind_from_irqhandler under spinlock xen/evtchn: remove spurious barrier ...
Diffstat (limited to 'drivers/xen/xenfs')
-rw-r--r--drivers/xen/xenfs/privcmd.c13
-rw-r--r--drivers/xen/xenfs/super.c46
2 files changed, 12 insertions, 47 deletions
diff --git a/drivers/xen/xenfs/privcmd.c b/drivers/xen/xenfs/privcmd.c
index 0f5d4162b22d..dbd3b16fd131 100644
--- a/drivers/xen/xenfs/privcmd.c
+++ b/drivers/xen/xenfs/privcmd.c
@@ -265,9 +265,7 @@ static int mmap_return_errors(void *data, void *state)
265 xen_pfn_t *mfnp = data; 265 xen_pfn_t *mfnp = data;
266 struct mmap_batch_state *st = state; 266 struct mmap_batch_state *st = state;
267 267
268 put_user(*mfnp, st->user++); 268 return put_user(*mfnp, st->user++);
269
270 return 0;
271} 269}
272 270
273static struct vm_operations_struct privcmd_vm_ops; 271static struct vm_operations_struct privcmd_vm_ops;
@@ -322,10 +320,8 @@ static long privcmd_ioctl_mmap_batch(void __user *udata)
322 up_write(&mm->mmap_sem); 320 up_write(&mm->mmap_sem);
323 321
324 if (state.err > 0) { 322 if (state.err > 0) {
325 ret = 0;
326
327 state.user = m.arr; 323 state.user = m.arr;
328 traverse_pages(m.num, sizeof(xen_pfn_t), 324 ret = traverse_pages(m.num, sizeof(xen_pfn_t),
329 &pagelist, 325 &pagelist,
330 mmap_return_errors, &state); 326 mmap_return_errors, &state);
331 } 327 }
@@ -383,8 +379,9 @@ static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
383 if (xen_feature(XENFEAT_auto_translated_physmap)) 379 if (xen_feature(XENFEAT_auto_translated_physmap))
384 return -ENOSYS; 380 return -ENOSYS;
385 381
386 /* DONTCOPY is essential for Xen as copy_page_range is broken. */ 382 /* DONTCOPY is essential for Xen because copy_page_range doesn't know
387 vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY; 383 * how to recreate these mappings */
384 vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_PFNMAP;
388 vma->vm_ops = &privcmd_vm_ops; 385 vma->vm_ops = &privcmd_vm_ops;
389 vma->vm_private_data = NULL; 386 vma->vm_private_data = NULL;
390 387
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
index f6339d11d59c..1aa389719846 100644
--- a/drivers/xen/xenfs/super.c
+++ b/drivers/xen/xenfs/super.c
@@ -12,8 +12,6 @@
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>
17 15
18#include <xen/xen.h> 16#include <xen/xen.h>
19 17
@@ -24,28 +22,12 @@
24MODULE_DESCRIPTION("Xen filesystem"); 22MODULE_DESCRIPTION("Xen filesystem");
25MODULE_LICENSE("GPL"); 23MODULE_LICENSE("GPL");
26 24
27static int xenfs_set_page_dirty(struct page *page)
28{
29 return !TestSetPageDirty(page);
30}
31
32static const struct address_space_operations xenfs_aops = {
33 .set_page_dirty = xenfs_set_page_dirty,
34};
35
36static struct backing_dev_info xenfs_backing_dev_info = {
37 .ra_pages = 0, /* No readahead */
38 .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK,
39};
40
41static struct inode *xenfs_make_inode(struct super_block *sb, int mode) 25static struct inode *xenfs_make_inode(struct super_block *sb, int mode)
42{ 26{
43 struct inode *ret = new_inode(sb); 27 struct inode *ret = new_inode(sb);
44 28
45 if (ret) { 29 if (ret) {
46 ret->i_mode = mode; 30 ret->i_mode = mode;
47 ret->i_mapping->a_ops = &xenfs_aops;
48 ret->i_mapping->backing_dev_info = &xenfs_backing_dev_info;
49 ret->i_uid = ret->i_gid = 0; 31 ret->i_uid = ret->i_gid = 0;
50 ret->i_blocks = 0; 32 ret->i_blocks = 0;
51 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; 33 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
@@ -121,9 +103,9 @@ static int xenfs_fill_super(struct super_block *sb, void *data, int silent)
121 return rc; 103 return rc;
122} 104}
123 105
124static int xenfs_mount(struct file_system_type *fs_type, 106static struct dentry *xenfs_mount(struct file_system_type *fs_type,
125 int flags, const char *dev_name, 107 int flags, const char *dev_name,
126 void *data) 108 void *data)
127{ 109{
128 return mount_single(fs_type, flags, data, xenfs_fill_super); 110 return mount_single(fs_type, flags, data, xenfs_fill_super);
129} 111}
@@ -137,25 +119,11 @@ static struct file_system_type xenfs_type = {
137 119
138static int __init xenfs_init(void) 120static int __init xenfs_init(void)
139{ 121{
140 int err; 122 if (xen_domain())
141 if (!xen_domain()) { 123 return register_filesystem(&xenfs_type);
142 printk(KERN_INFO "xenfs: not registering filesystem on non-xen platform\n");
143 return 0;
144 }
145
146 err = register_filesystem(&xenfs_type);
147 if (err) {
148 printk(KERN_ERR "xenfs: Unable to register filesystem!\n");
149 goto out;
150 }
151
152 err = bdi_init(&xenfs_backing_dev_info);
153 if (err)
154 unregister_filesystem(&xenfs_type);
155
156 out:
157 124
158 return err; 125 printk(KERN_INFO "XENFS: not registering filesystem on non-xen platform\n");
126 return 0;
159} 127}
160 128
161static void __exit xenfs_exit(void) 129static void __exit xenfs_exit(void)