提交 f5dd33c4 编写于 作者: N Nick Piggin 提交者: Linus Torvalds

dio: use get_user_pages_fast

Use get_user_pages_fast in the common/generic block and fs direct IO paths.
Signed-off-by: NNick Piggin <npiggin@suse.de>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Cc: Badari Pulavarty <pbadari@us.ibm.com>
Cc: Zach Brown <zach.brown@oracle.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Reviewed-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 8174c430
...@@ -721,12 +721,8 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, ...@@ -721,12 +721,8 @@ static struct bio *__bio_map_user_iov(struct request_queue *q,
const int local_nr_pages = end - start; const int local_nr_pages = end - start;
const int page_limit = cur_page + local_nr_pages; const int page_limit = cur_page + local_nr_pages;
down_read(&current->mm->mmap_sem); ret = get_user_pages_fast(uaddr, local_nr_pages,
ret = get_user_pages(current, current->mm, uaddr, write_to_vm, &pages[cur_page]);
local_nr_pages,
write_to_vm, 0, &pages[cur_page], NULL);
up_read(&current->mm->mmap_sem);
if (ret < local_nr_pages) { if (ret < local_nr_pages) {
ret = -EFAULT; ret = -EFAULT;
goto out_unmap; goto out_unmap;
......
...@@ -150,17 +150,11 @@ static int dio_refill_pages(struct dio *dio) ...@@ -150,17 +150,11 @@ static int dio_refill_pages(struct dio *dio)
int nr_pages; int nr_pages;
nr_pages = min(dio->total_pages - dio->curr_page, DIO_PAGES); nr_pages = min(dio->total_pages - dio->curr_page, DIO_PAGES);
down_read(&current->mm->mmap_sem); ret = get_user_pages_fast(
ret = get_user_pages(
current, /* Task for fault acounting */
current->mm, /* whose pages? */
dio->curr_user_address, /* Where from? */ dio->curr_user_address, /* Where from? */
nr_pages, /* How many pages? */ nr_pages, /* How many pages? */
dio->rw == READ, /* Write to memory? */ dio->rw == READ, /* Write to memory? */
0, /* force (?) */ &dio->pages[0]); /* Put results here */
&dio->pages[0],
NULL); /* vmas */
up_read(&current->mm->mmap_sem);
if (ret < 0 && dio->blocks_available && (dio->rw & WRITE)) { if (ret < 0 && dio->blocks_available && (dio->rw & WRITE)) {
struct page *page = ZERO_PAGE(0); struct page *page = ZERO_PAGE(0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册