aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-09-01 22:12:53 -0400
committerDave Chinner <david@fromorbit.com>2014-09-01 22:12:53 -0400
commit7d4ea3ce63a6bc532abb334c469c18481798af8c (patch)
treeececad5aeceda0b2ead76e6d1016a98c6b5394d5 /fs
parent834ffca6f7e345a79f6f2e2d131b0dfba8a4b67a (diff)
xfs: use ranged writeback and invalidation for direct IO
Now we are not doing silly things with dirtying buffers beyond EOF and using invalidation correctly, we can finally reduce the ranges of writeback and invalidation used by direct IO to match that of the IO being issued. Bring the writeback and invalidation ranges back to match the generic direct IO code - this will greatly reduce the perturbation of cached data when direct IO and buffered IO are mixed, but still provide the same buffered vs direct IO coherency behaviour we currently have. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_file.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 19917faac2d2..de5368c803f9 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -291,7 +291,7 @@ xfs_file_read_iter(
291 if (inode->i_mapping->nrpages) { 291 if (inode->i_mapping->nrpages) {
292 ret = filemap_write_and_wait_range( 292 ret = filemap_write_and_wait_range(
293 VFS_I(ip)->i_mapping, 293 VFS_I(ip)->i_mapping,
294 pos, -1); 294 pos, pos + size - 1);
295 if (ret) { 295 if (ret) {
296 xfs_rw_iunlock(ip, XFS_IOLOCK_EXCL); 296 xfs_rw_iunlock(ip, XFS_IOLOCK_EXCL);
297 return ret; 297 return ret;
@@ -303,7 +303,8 @@ xfs_file_read_iter(
303 * happen on XFS. Warn if it does fail. 303 * happen on XFS. Warn if it does fail.
304 */ 304 */
305 ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping, 305 ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping,
306 pos >> PAGE_CACHE_SHIFT, -1); 306 pos >> PAGE_CACHE_SHIFT,
307 (pos + size - 1) >> PAGE_CACHE_SHIFT);
307 WARN_ON_ONCE(ret); 308 WARN_ON_ONCE(ret);
308 ret = 0; 309 ret = 0;
309 } 310 }
@@ -641,7 +642,7 @@ xfs_file_dio_aio_write(
641 642
642 if (mapping->nrpages) { 643 if (mapping->nrpages) {
643 ret = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, 644 ret = filemap_write_and_wait_range(VFS_I(ip)->i_mapping,
644 pos, -1); 645 pos, pos + count - 1);
645 if (ret) 646 if (ret)
646 goto out; 647 goto out;
647 /* 648 /*
@@ -650,7 +651,8 @@ xfs_file_dio_aio_write(
650 * happen on XFS. Warn if it does fail. 651 * happen on XFS. Warn if it does fail.
651 */ 652 */
652 ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping, 653 ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping,
653 pos >> PAGE_CACHE_SHIFT, -1); 654 pos >> PAGE_CACHE_SHIFT,
655 (pos + count - 1) >> PAGE_CACHE_SHIFT);
654 WARN_ON_ONCE(ret); 656 WARN_ON_ONCE(ret);
655 ret = 0; 657 ret = 0;
656 } 658 }