diff options
author | Marcelo Tosatti <marcelo.tosatti@cyclades.com> | 2004-09-07 17:51:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-09-07 17:51:17 -0700 |
commit | 765dad09b4ac101a32d87af2bb793c3060497d3c (patch) | |
tree | 47af3a7cff77182f96a983797ff524fe3a5b3d13 /mm | |
parent | 6043dddc9f77792f320f6d3040a731d5842b90fa (diff) | |
download | history-765dad09b4ac101a32d87af2bb793c3060497d3c.tar.gz |
[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: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 78e18b7639b6aa..55fb7b4141e419 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -287,7 +287,13 @@ EXPORT_SYMBOL(sync_page_range); */ 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); |