Commit e5dbd332 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by David Howells

mm/writeback: Add wait_on_page_writeback_killable

This is the killable version of wait_on_page_writeback.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Tested-by: kafs-testing@auristor.com
cc: linux-afs@lists.infradead.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20210320054104.1300774-3-willy@infradead.org
parent 39f985c8
...@@ -682,6 +682,7 @@ static inline int wait_on_page_locked_killable(struct page *page) ...@@ -682,6 +682,7 @@ static inline int wait_on_page_locked_killable(struct page *page)
int put_and_wait_on_page_locked(struct page *page, int state); int put_and_wait_on_page_locked(struct page *page, int state);
void wait_on_page_writeback(struct page *page); void wait_on_page_writeback(struct page *page);
int wait_on_page_writeback_killable(struct page *page);
extern void end_page_writeback(struct page *page); extern void end_page_writeback(struct page *page);
void wait_for_stable_page(struct page *page); void wait_for_stable_page(struct page *page);
......
...@@ -2833,6 +2833,22 @@ void wait_on_page_writeback(struct page *page) ...@@ -2833,6 +2833,22 @@ void wait_on_page_writeback(struct page *page)
} }
EXPORT_SYMBOL_GPL(wait_on_page_writeback); EXPORT_SYMBOL_GPL(wait_on_page_writeback);
/*
* Wait for a page to complete writeback. Returns -EINTR if we get a
* fatal signal while waiting.
*/
int wait_on_page_writeback_killable(struct page *page)
{
while (PageWriteback(page)) {
trace_wait_on_page_writeback(page, page_mapping(page));
if (wait_on_page_bit_killable(page, PG_writeback))
return -EINTR;
}
return 0;
}
EXPORT_SYMBOL_GPL(wait_on_page_writeback_killable);
/** /**
* wait_for_stable_page() - wait for writeback to finish, if necessary. * wait_for_stable_page() - wait for writeback to finish, if necessary.
* @page: The page to wait on. * @page: The page to wait on.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment