diff options
author | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:39 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:39 -0400 |
commit | 385e1ca5f21c4680ad6a46a3aa2ea8af99e99c92 (patch) | |
tree | 7d887b59d943c5dd62c9604b7ea37fd2d650df71 /mm/filemap.c | |
parent | b510882281d56873e1194021643b7c325336f84f (diff) |
CacheFiles: Permit the page lock state to be monitored
Add a function to install a monitor on the page lock waitqueue for a particular
page, thus allowing the page being unlocked to be detected.
This is used by CacheFiles to detect read completion on a page in the backing
filesystem so that it can then copy the data to the waiting netfs page.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Daire Byrne <Daire.Byrne@framestore.com>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index cbc5772e7171..fc11974f2bee 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -565,6 +565,24 @@ void wait_on_page_bit(struct page *page, int bit_nr) | |||
565 | EXPORT_SYMBOL(wait_on_page_bit); | 565 | EXPORT_SYMBOL(wait_on_page_bit); |
566 | 566 | ||
567 | /** | 567 | /** |
568 | * add_page_wait_queue - Add an arbitrary waiter to a page's wait queue | ||
569 | * @page - Page defining the wait queue of interest | ||
570 | * @waiter - Waiter to add to the queue | ||
571 | * | ||
572 | * Add an arbitrary @waiter to the wait queue for the nominated @page. | ||
573 | */ | ||
574 | void add_page_wait_queue(struct page *page, wait_queue_t *waiter) | ||
575 | { | ||
576 | wait_queue_head_t *q = page_waitqueue(page); | ||
577 | unsigned long flags; | ||
578 | |||
579 | spin_lock_irqsave(&q->lock, flags); | ||
580 | __add_wait_queue(q, waiter); | ||
581 | spin_unlock_irqrestore(&q->lock, flags); | ||
582 | } | ||
583 | EXPORT_SYMBOL_GPL(add_page_wait_queue); | ||
584 | |||
585 | /** | ||
568 | * unlock_page - unlock a locked page | 586 | * unlock_page - unlock a locked page |
569 | * @page: the page | 587 | * @page: the page |
570 | * | 588 | * |