aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_file.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-11-12 06:53:57 -0500
committerBen Myers <bpm@sgi.com>2012-11-14 16:15:08 -0500
commitfb59581404ab7ec5075299065c22cb211a9262a9 (patch)
tree56a9d9a6cf90ee9b6d753de4401b6a2bf8d02e0f /fs/xfs/xfs_file.c
parent4bc1ea6b8ddd4f2bd78944fbe5a1042ac14b1f5f (diff)
xfs: remove xfs_flushinval_pages
It's just a simple wrapper around VFS functionality, and is actually bugging in that it doesn't remove mappings before invalidating the page cache. Remove it and replace it with the correct VFS functionality. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Andrew Dahl <adahl@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_file.c')
-rw-r--r--fs/xfs/xfs_file.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index daf4066c24b2..c42f99e71f14 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -255,15 +255,14 @@ xfs_file_aio_read(
255 xfs_buftarg_t *target = 255 xfs_buftarg_t *target =
256 XFS_IS_REALTIME_INODE(ip) ? 256 XFS_IS_REALTIME_INODE(ip) ?
257 mp->m_rtdev_targp : mp->m_ddev_targp; 257 mp->m_rtdev_targp : mp->m_ddev_targp;
258 if ((iocb->ki_pos & target->bt_smask) || 258 if ((pos & target->bt_smask) || (size & target->bt_smask)) {
259 (size & target->bt_smask)) { 259 if (pos == i_size_read(inode))
260 if (iocb->ki_pos == i_size_read(inode))
261 return 0; 260 return 0;
262 return -XFS_ERROR(EINVAL); 261 return -XFS_ERROR(EINVAL);
263 } 262 }
264 } 263 }
265 264
266 n = mp->m_super->s_maxbytes - iocb->ki_pos; 265 n = mp->m_super->s_maxbytes - pos;
267 if (n <= 0 || size == 0) 266 if (n <= 0 || size == 0)
268 return 0; 267 return 0;
269 268
@@ -289,20 +288,21 @@ xfs_file_aio_read(
289 xfs_rw_ilock(ip, XFS_IOLOCK_EXCL); 288 xfs_rw_ilock(ip, XFS_IOLOCK_EXCL);
290 289
291 if (inode->i_mapping->nrpages) { 290 if (inode->i_mapping->nrpages) {
292 ret = -xfs_flushinval_pages(ip, 291 ret = -filemap_write_and_wait_range(
293 (iocb->ki_pos & PAGE_CACHE_MASK), 292 VFS_I(ip)->i_mapping,
294 -1, FI_REMAPF_LOCKED); 293 pos, -1);
295 if (ret) { 294 if (ret) {
296 xfs_rw_iunlock(ip, XFS_IOLOCK_EXCL); 295 xfs_rw_iunlock(ip, XFS_IOLOCK_EXCL);
297 return ret; 296 return ret;
298 } 297 }
298 truncate_pagecache_range(VFS_I(ip), pos, -1);
299 } 299 }
300 xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL); 300 xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL);
301 } 301 }
302 302
303 trace_xfs_file_read(ip, size, iocb->ki_pos, ioflags); 303 trace_xfs_file_read(ip, size, pos, ioflags);
304 304
305 ret = generic_file_aio_read(iocb, iovp, nr_segs, iocb->ki_pos); 305 ret = generic_file_aio_read(iocb, iovp, nr_segs, pos);
306 if (ret > 0) 306 if (ret > 0)
307 XFS_STATS_ADD(xs_read_bytes, ret); 307 XFS_STATS_ADD(xs_read_bytes, ret);
308 308
@@ -670,10 +670,11 @@ xfs_file_dio_aio_write(
670 goto out; 670 goto out;
671 671
672 if (mapping->nrpages) { 672 if (mapping->nrpages) {
673 ret = -xfs_flushinval_pages(ip, (pos & PAGE_CACHE_MASK), -1, 673 ret = -filemap_write_and_wait_range(VFS_I(ip)->i_mapping,
674 FI_REMAPF_LOCKED); 674 pos, -1);
675 if (ret) 675 if (ret)
676 goto out; 676 goto out;
677 truncate_pagecache_range(VFS_I(ip), pos, -1);
677 } 678 }
678 679
679 /* 680 /*