fuse: ioctl cleanup
authorMiklos Szeredi <mszeredi@suse.cz>
Tue, 7 Dec 2010 19:16:56 +0000 (20:16 +0100)
committerMiklos Szeredi <mszeredi@suse.cz>
Tue, 7 Dec 2010 19:16:56 +0000 (20:16 +0100)
Get rid of unnecessary page_address()-es.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
CC: Tejun Heo <tj@kernel.org>
fs/fuse/file.c

index 8b984a2..ca3b6bb 100644 (file)
@@ -1740,7 +1740,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
        struct fuse_ioctl_out outarg;
        struct fuse_req *req = NULL;
        struct page **pages = NULL;
-       struct page *iov_page = NULL;
+       struct iovec *iov_page = NULL;
        struct iovec *in_iov = NULL, *out_iov = NULL;
        unsigned int in_iovs = 0, out_iovs = 0, num_pages = 0, max_pages;
        size_t in_size, out_size, transferred;
@@ -1751,7 +1751,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
 
        err = -ENOMEM;
        pages = kzalloc(sizeof(pages[0]) * FUSE_MAX_PAGES_PER_REQ, GFP_KERNEL);
-       iov_page = alloc_page(GFP_KERNEL);
+       iov_page = (struct iovec *) __get_free_page(GFP_KERNEL);
        if (!pages || !iov_page)
                goto out;
 
@@ -1760,7 +1760,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
         * RETRY from server is not allowed.
         */
        if (!(flags & FUSE_IOCTL_UNRESTRICTED)) {
-               struct iovec *iov = page_address(iov_page);
+               struct iovec *iov = iov_page;
 
                iov->iov_base = (void __user *)arg;
                iov->iov_len = _IOC_SIZE(cmd);
@@ -1841,7 +1841,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
 
        /* did it ask for retry? */
        if (outarg.flags & FUSE_IOCTL_RETRY) {
-               char *vaddr;
+               void *vaddr;
 
                /* no retry if in restricted mode */
                err = -EIO;
@@ -1862,14 +1862,14 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
                        goto out;
 
                vaddr = kmap_atomic(pages[0], KM_USER0);
-               err = fuse_copy_ioctl_iovec(page_address(iov_page), vaddr,
+               err = fuse_copy_ioctl_iovec(iov_page, vaddr,
                                            transferred, in_iovs + out_iovs,
                                            (flags & FUSE_IOCTL_COMPAT) != 0);
                kunmap_atomic(vaddr, KM_USER0);
                if (err)
                        goto out;
 
-               in_iov = page_address(iov_page);
+               in_iov = iov_page;
                out_iov = in_iov + in_iovs;
 
                err = fuse_verify_ioctl_iov(in_iov, in_iovs);
@@ -1891,8 +1891,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
  out:
        if (req)
                fuse_put_request(fc, req);
-       if (iov_page)
-               __free_page(iov_page);
+       free_page((unsigned long) iov_page);
        while (num_pages)
                __free_page(pages[--num_pages]);
        kfree(pages);