diff options
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 849293c4f418..dd51c68e2b86 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -326,70 +326,6 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start, | |||
326 | EXPORT_SYMBOL(filemap_fdatawait_range); | 326 | EXPORT_SYMBOL(filemap_fdatawait_range); |
327 | 327 | ||
328 | /** | 328 | /** |
329 | * sync_page_range - write and wait on all pages in the passed range | ||
330 | * @inode: target inode | ||
331 | * @mapping: target address_space | ||
332 | * @pos: beginning offset in pages to write | ||
333 | * @count: number of bytes to write | ||
334 | * | ||
335 | * Write and wait upon all the pages in the passed range. This is a "data | ||
336 | * integrity" operation. It waits upon in-flight writeout before starting and | ||
337 | * waiting upon new writeout. If there was an IO error, return it. | ||
338 | * | ||
339 | * We need to re-take i_mutex during the generic_osync_inode list walk because | ||
340 | * it is otherwise livelockable. | ||
341 | */ | ||
342 | int sync_page_range(struct inode *inode, struct address_space *mapping, | ||
343 | loff_t pos, loff_t count) | ||
344 | { | ||
345 | pgoff_t start = pos >> PAGE_CACHE_SHIFT; | ||
346 | pgoff_t end = (pos + count - 1) >> PAGE_CACHE_SHIFT; | ||
347 | int ret; | ||
348 | |||
349 | if (!mapping_cap_writeback_dirty(mapping) || !count) | ||
350 | return 0; | ||
351 | ret = filemap_fdatawrite_range(mapping, pos, pos + count - 1); | ||
352 | if (ret == 0) { | ||
353 | mutex_lock(&inode->i_mutex); | ||
354 | ret = generic_osync_inode(inode, mapping, OSYNC_METADATA); | ||
355 | mutex_unlock(&inode->i_mutex); | ||
356 | } | ||
357 | if (ret == 0) | ||
358 | ret = wait_on_page_writeback_range(mapping, start, end); | ||
359 | return ret; | ||
360 | } | ||
361 | EXPORT_SYMBOL(sync_page_range); | ||
362 | |||
363 | /** | ||
364 | * sync_page_range_nolock - write & wait on all pages in the passed range without locking | ||
365 | * @inode: target inode | ||
366 | * @mapping: target address_space | ||
367 | * @pos: beginning offset in pages to write | ||
368 | * @count: number of bytes to write | ||
369 | * | ||
370 | * Note: Holding i_mutex across sync_page_range_nolock() is not a good idea | ||
371 | * as it forces O_SYNC writers to different parts of the same file | ||
372 | * to be serialised right until io completion. | ||
373 | */ | ||
374 | int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, | ||
375 | loff_t pos, loff_t count) | ||
376 | { | ||
377 | pgoff_t start = pos >> PAGE_CACHE_SHIFT; | ||
378 | pgoff_t end = (pos + count - 1) >> PAGE_CACHE_SHIFT; | ||
379 | int ret; | ||
380 | |||
381 | if (!mapping_cap_writeback_dirty(mapping) || !count) | ||
382 | return 0; | ||
383 | ret = filemap_fdatawrite_range(mapping, pos, pos + count - 1); | ||
384 | if (ret == 0) | ||
385 | ret = generic_osync_inode(inode, mapping, OSYNC_METADATA); | ||
386 | if (ret == 0) | ||
387 | ret = wait_on_page_writeback_range(mapping, start, end); | ||
388 | return ret; | ||
389 | } | ||
390 | EXPORT_SYMBOL(sync_page_range_nolock); | ||
391 | |||
392 | /** | ||
393 | * filemap_fdatawait - wait for all under-writeback pages to complete | 329 | * filemap_fdatawait - wait for all under-writeback pages to complete |
394 | * @mapping: address space structure to wait for | 330 | * @mapping: address space structure to wait for |
395 | * | 331 | * |