platform/linux/mm/filemap.c
/**
 * wait_on_page_writeback_range - wait for writeback to complete
 * @mapping:	target address_space
 * @start:	beginning page index
 * @end:	ending page index
 *
 * Wait for writeback to complete against pages indexed by start->end
 * inclusive
 */
wait for writeback to complete
@mapping:    target address_space
@start:      beginning page index
@end:        ending page index

Wait for writeback to complete against pages indexed by start->end
inclusive
wait for writeback to complete @mapping : target address_space @start : beginning page index @end : ending page index Wait for writeback to complete against pages indexed by start - > end inclusive
int wait_on_page_writeback_range(struct address_space *mapping,
				pgoff_t start, pgoff_t end)
{
	struct pagevec pvec;
	int nr_pages;
	int ret = 0;
	pgoff_t index;
	if (end < start)
		return 0;
	pagevec_init(&pvec, 0);
	index = start;
	while ((index <= end) &&
			(nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
			PAGECACHE_TAG_WRITEBACK,
			min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1)) != 0) {
		unsigned i;
		for (i = 0; i < nr_pages; i++) {
			struct page *page = pvec.pages[i];
			if (page->index > end)
				continue;
			wait_on_page_writeback(page);
			if (PageError(page))
				ret = -EIO;
		}
		pagevec_release(&pvec);
		cond_resched();
	}
	if (test_and_clear_bit(AS_ENOSPC, &mapping->flags))
		ret = -ENOSPC;
	if (test_and_clear_bit(AS_EIO, &mapping->flags))
		ret = -EIO;
	return ret;
}
int wait_on_page_writeback_range ( struct address_space * mapping , pgoff_t start , pgoff_t end ) { struct pagevec pvec ; int nr_pages ; int ret = 0 ; pgoff_t index ; if ( end < start ) return 0 ; pagevec_init ( & pvec , 0 ) ; index = start ; while ( ( index <= end ) && ( nr_pages = pagevec_lookup_tag ( & pvec , mapping , & index , PAGECACHE_TAG_WRITEBACK , min ( end - index , ( pgoff_t ) PAGEVEC_SIZE - 1 ) + 1 ) ) != 0 ) { unsigned i ; for ( i = 0 ; i < nr_pages ; i ++ ) { struct page * page = pvec . pages [ i ] ; if ( page -> index > end ) continue ; wait_on_page_writeback ( page ) ; if ( PageError ( page ) ) ret = - EIO ; } pagevec_release ( & pvec ) ; cond_resched ( ) ; } if ( test_and_clear_bit ( AS_ENOSPC , & mapping -> flags ) ) ret = - ENOSPC ; if ( test_and_clear_bit ( AS_EIO , & mapping -> flags ) ) ret = - EIO ; return ret ; }
wait_on_page_writeback_range - wait for writeback to complete
 @mapping:    target address_space
 @start:      beginning page index
 @end:        ending page index
wait_on_page_writeback_range - wait for writeback to complete @mapping : target address_space @start : beginning page index @end : ending page index
/* until radix tree lookup accepts end_index */ /* Check for outstanding write errors */