diff options
author | Jan Kara <jack@suse.cz> | 2009-08-17 13:30:27 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2009-09-14 11:08:14 -0400 |
commit | d3bccb6f4b886060aa0f58976b92b77d951f5434 (patch) | |
tree | b5f9eb43890da173a078e883d51c23b8c27ceaa6 /mm/filemap.c | |
parent | 86d710146fb9975f04c505ec78caa43d227c1018 (diff) |
vfs: Introduce filemap_fdatawait_range
This simple helper saves some filesystems conversion from byte offset
to page numbers and also makes the fdata* interface more complete.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index ccea3b665c12..65b2e50efcd0 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -307,6 +307,26 @@ int wait_on_page_writeback_range(struct address_space *mapping, | |||
307 | } | 307 | } |
308 | 308 | ||
309 | /** | 309 | /** |
310 | * filemap_fdatawait_range - wait for all under-writeback pages to complete in a given range | ||
311 | * @mapping: address space structure to wait for | ||
312 | * @start: offset in bytes where the range starts | ||
313 | * @end: offset in bytes where the range ends (inclusive) | ||
314 | * | ||
315 | * Walk the list of under-writeback pages of the given address space | ||
316 | * in the given range and wait for all of them. | ||
317 | * | ||
318 | * This is just a simple wrapper so that callers don't have to convert offsets | ||
319 | * to page indexes themselves | ||
320 | */ | ||
321 | int filemap_fdatawait_range(struct address_space *mapping, loff_t start, | ||
322 | loff_t end) | ||
323 | { | ||
324 | return wait_on_page_writeback_range(mapping, start >> PAGE_CACHE_SHIFT, | ||
325 | end >> PAGE_CACHE_SHIFT); | ||
326 | } | ||
327 | EXPORT_SYMBOL(filemap_fdatawait_range); | ||
328 | |||
329 | /** | ||
310 | * sync_page_range - write and wait on all pages in the passed range | 330 | * sync_page_range - write and wait on all pages in the passed range |
311 | * @inode: target inode | 331 | * @inode: target inode |
312 | * @mapping: target address_space | 332 | * @mapping: target address_space |