Commit 765dad09 authored by Marcelo Tosatti's avatar Marcelo Tosatti Committed by Linus Torvalds

[PATCH] small wait_on_page_writeback_range() optimization

filemap_fdatawait() calls wait_on_page_writeback_range() with -1 as "end"
parameter.  This is not needed since we know the EOF from the inode.  Use
that instead.
Signed-off-by: default avatarMarcelo Tosatti <marcelo.tosatti@cyclades.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6043dddc
...@@ -287,7 +287,13 @@ EXPORT_SYMBOL(sync_page_range); ...@@ -287,7 +287,13 @@ EXPORT_SYMBOL(sync_page_range);
*/ */
int filemap_fdatawait(struct address_space *mapping) int filemap_fdatawait(struct address_space *mapping)
{ {
return wait_on_page_writeback_range(mapping, 0, -1); loff_t i_size = i_size_read(mapping->host);
if (i_size == 0)
return 0;
return wait_on_page_writeback_range(mapping, 0,
(i_size - 1) >> PAGE_CACHE_SHIFT);
} }
EXPORT_SYMBOL(filemap_fdatawait); EXPORT_SYMBOL(filemap_fdatawait);
......
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