fuse: use get_user_pages_fast()
Miklos Szeredi [Tue, 25 May 2010 13:06:06 +0000 (15:06 +0200)]
Replace uses of get_user_pages() with get_user_pages_fast().  It looks
nicer and should be faster in most cases.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>

fs/fuse/dev.c
fs/fuse/file.c

index eb7e942..4623018 100644 (file)
@@ -551,10 +551,7 @@ static int fuse_copy_fill(struct fuse_copy_state *cs)
                cs->iov++;
                cs->nr_segs--;
        }
-       down_read(&current->mm->mmap_sem);
-       err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0,
-                            &cs->pg, NULL);
-       up_read(&current->mm->mmap_sem);
+       err = get_user_pages_fast(cs->addr, 1, cs->write, &cs->pg);
        if (err < 0)
                return err;
        BUG_ON(err != 1);
index 4172bfe..29bda05 100644 (file)
@@ -994,10 +994,7 @@ static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf,
        nbytes = min_t(size_t, nbytes, FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT);
        npages = (nbytes + offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
        npages = clamp(npages, 1, FUSE_MAX_PAGES_PER_REQ);
-       down_read(&current->mm->mmap_sem);
-       npages = get_user_pages(current, current->mm, user_addr, npages, !write,
-                               0, req->pages, NULL);
-       up_read(&current->mm->mmap_sem);
+       npages = get_user_pages_fast(user_addr, npages, !write, req->pages);
        if (npages < 0)
                return npages;