aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index ceba0bd03662..379ff0bcbf6e 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -441,6 +441,7 @@ int filemap_write_and_wait_range(struct address_space *mapping,
441 } 441 }
442 return err; 442 return err;
443} 443}
444EXPORT_SYMBOL(filemap_write_and_wait_range);
444 445
445/** 446/**
446 * add_to_page_cache_locked - add a locked page to the pagecache 447 * add_to_page_cache_locked - add a locked page to the pagecache
@@ -513,6 +514,7 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
513 } 514 }
514 return ret; 515 return ret;
515} 516}
517EXPORT_SYMBOL_GPL(add_to_page_cache_lru);
516 518
517#ifdef CONFIG_NUMA 519#ifdef CONFIG_NUMA
518struct page *__page_cache_alloc(gfp_t gfp) 520struct page *__page_cache_alloc(gfp_t gfp)
@@ -565,6 +567,24 @@ void wait_on_page_bit(struct page *page, int bit_nr)
565EXPORT_SYMBOL(wait_on_page_bit); 567EXPORT_SYMBOL(wait_on_page_bit);
566 568
567/** 569/**
570 * add_page_wait_queue - Add an arbitrary waiter to a page's wait queue
571 * @page: Page defining the wait queue of interest
572 * @waiter: Waiter to add to the queue
573 *
574 * Add an arbitrary @waiter to the wait queue for the nominated @page.
575 */
576void add_page_wait_queue(struct page *page, wait_queue_t *waiter)
577{
578 wait_queue_head_t *q = page_waitqueue(page);
579 unsigned long flags;
580
581 spin_lock_irqsave(&q->lock, flags);
582 __add_wait_queue(q, waiter);
583 spin_unlock_irqrestore(&q->lock, flags);
584}
585EXPORT_SYMBOL_GPL(add_page_wait_queue);
586
587/**
568 * unlock_page - unlock a locked page 588 * unlock_page - unlock a locked page
569 * @page: the page 589 * @page: the page
570 * 590 *
@@ -627,6 +647,7 @@ int __lock_page_killable(struct page *page)
627 return __wait_on_bit_lock(page_waitqueue(page), &wait, 647 return __wait_on_bit_lock(page_waitqueue(page), &wait,
628 sync_page_killable, TASK_KILLABLE); 648 sync_page_killable, TASK_KILLABLE);
629} 649}
650EXPORT_SYMBOL_GPL(__lock_page_killable);
630 651
631/** 652/**
632 * __lock_page_nosync - get a lock on the page, without calling sync_page() 653 * __lock_page_nosync - get a lock on the page, without calling sync_page()
@@ -1374,7 +1395,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
1374 return 0; 1395 return 0;
1375} 1396}
1376 1397
1377asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count) 1398SYSCALL_DEFINE(readahead)(int fd, loff_t offset, size_t count)
1378{ 1399{
1379 ssize_t ret; 1400 ssize_t ret;
1380 struct file *file; 1401 struct file *file;
@@ -1393,6 +1414,13 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count)
1393 } 1414 }
1394 return ret; 1415 return ret;
1395} 1416}
1417#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
1418asmlinkage long SyS_readahead(long fd, loff_t offset, long count)
1419{
1420 return SYSC_readahead((int) fd, offset, (size_t) count);
1421}
1422SYSCALL_ALIAS(sys_readahead, SyS_readahead);
1423#endif
1396 1424
1397#ifdef CONFIG_MMU 1425#ifdef CONFIG_MMU
1398/** 1426/**
@@ -1816,7 +1844,7 @@ static size_t __iovec_copy_from_user_inatomic(char *vaddr,
1816 int copy = min(bytes, iov->iov_len - base); 1844 int copy = min(bytes, iov->iov_len - base);
1817 1845
1818 base = 0; 1846 base = 0;
1819 left = __copy_from_user_inatomic_nocache(vaddr, buf, copy); 1847 left = __copy_from_user_inatomic(vaddr, buf, copy);
1820 copied += copy; 1848 copied += copy;
1821 bytes -= copy; 1849 bytes -= copy;
1822 vaddr += copy; 1850 vaddr += copy;
@@ -1844,8 +1872,7 @@ size_t iov_iter_copy_from_user_atomic(struct page *page,
1844 if (likely(i->nr_segs == 1)) { 1872 if (likely(i->nr_segs == 1)) {
1845 int left; 1873 int left;
1846 char __user *buf = i->iov->iov_base + i->iov_offset; 1874 char __user *buf = i->iov->iov_base + i->iov_offset;
1847 left = __copy_from_user_inatomic_nocache(kaddr + offset, 1875 left = __copy_from_user_inatomic(kaddr + offset, buf, bytes);
1848 buf, bytes);
1849 copied = bytes - left; 1876 copied = bytes - left;
1850 } else { 1877 } else {
1851 copied = __iovec_copy_from_user_inatomic(kaddr + offset, 1878 copied = __iovec_copy_from_user_inatomic(kaddr + offset,
@@ -1873,7 +1900,7 @@ size_t iov_iter_copy_from_user(struct page *page,
1873 if (likely(i->nr_segs == 1)) { 1900 if (likely(i->nr_segs == 1)) {
1874 int left; 1901 int left;
1875 char __user *buf = i->iov->iov_base + i->iov_offset; 1902 char __user *buf = i->iov->iov_base + i->iov_offset;
1876 left = __copy_from_user_nocache(kaddr + offset, buf, bytes); 1903 left = __copy_from_user(kaddr + offset, buf, bytes);
1877 copied = bytes - left; 1904 copied = bytes - left;
1878 } else { 1905 } else {
1879 copied = __iovec_copy_from_user_inatomic(kaddr + offset, 1906 copied = __iovec_copy_from_user_inatomic(kaddr + offset,
@@ -2457,6 +2484,9 @@ EXPORT_SYMBOL(generic_file_aio_write);
2457 * (presumably at page->private). If the release was successful, return `1'. 2484 * (presumably at page->private). If the release was successful, return `1'.
2458 * Otherwise return zero. 2485 * Otherwise return zero.
2459 * 2486 *
2487 * This may also be called if PG_fscache is set on a page, indicating that the
2488 * page is known to the local caching routines.
2489 *
2460 * The @gfp_mask argument specifies whether I/O may be performed to release 2490 * The @gfp_mask argument specifies whether I/O may be performed to release
2461 * this page (__GFP_IO), and whether the call may block (__GFP_WAIT & __GFP_FS). 2491 * this page (__GFP_IO), and whether the call may block (__GFP_WAIT & __GFP_FS).
2462 * 2492 *