aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-11-12 06:53:56 -0500
committerBen Myers <bpm@sgi.com>2012-11-14 16:12:45 -0500
commit4bc1ea6b8ddd4f2bd78944fbe5a1042ac14b1f5f (patch)
tree8fb1419d5f7329afb431dbed481d441eb9d38c0c /fs/xfs
parent95eacf0f71b7682a05b8242c49c68e8e4bb673e3 (diff)
xfs: remove xfs_flush_pages
It is a complex wrapper around VFS functions, but there are VFS functions that provide exactly the same functionality. Call the VFS functions directly and remove the unnecessary indirection and complexity. We don't need to care about clearing the XFS_ITRUNCATED flag, as that is done during .writepages. Hence is cleared by the VFS writeback path if there is anything to write back during the flush. 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')
-rw-r--r--fs/xfs/xfs_aops.c2
-rw-r--r--fs/xfs/xfs_bmap.c2
-rw-r--r--fs/xfs/xfs_fs_subr.c24
-rw-r--r--fs/xfs/xfs_iops.c4
-rw-r--r--fs/xfs/xfs_vnodeops.c7
-rw-r--r--fs/xfs/xfs_vnodeops.h2
6 files changed, 9 insertions, 32 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index e57e2daa357c..71361da1f77c 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1641,7 +1641,7 @@ xfs_vm_bmap(
1641 1641
1642 trace_xfs_vm_bmap(XFS_I(inode)); 1642 trace_xfs_vm_bmap(XFS_I(inode));
1643 xfs_ilock(ip, XFS_IOLOCK_SHARED); 1643 xfs_ilock(ip, XFS_IOLOCK_SHARED);
1644 xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF); 1644 filemap_write_and_wait(mapping);
1645 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 1645 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
1646 return generic_block_bmap(mapping, block, xfs_get_blocks); 1646 return generic_block_bmap(mapping, block, xfs_get_blocks);
1647} 1647}
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 83d0cf3df930..a60f3d1f151c 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -5599,7 +5599,7 @@ xfs_getbmap(
5599 xfs_ilock(ip, XFS_IOLOCK_SHARED); 5599 xfs_ilock(ip, XFS_IOLOCK_SHARED);
5600 if (whichfork == XFS_DATA_FORK && !(iflags & BMV_IF_DELALLOC)) { 5600 if (whichfork == XFS_DATA_FORK && !(iflags & BMV_IF_DELALLOC)) {
5601 if (ip->i_delayed_blks || XFS_ISIZE(ip) > ip->i_d.di_size) { 5601 if (ip->i_delayed_blks || XFS_ISIZE(ip) > ip->i_d.di_size) {
5602 error = xfs_flush_pages(ip, 0, -1, 0, FI_REMAPF); 5602 error = -filemap_write_and_wait(VFS_I(ip)->i_mapping);
5603 if (error) 5603 if (error)
5604 goto out_unlock_iolock; 5604 goto out_unlock_iolock;
5605 } 5605 }
diff --git a/fs/xfs/xfs_fs_subr.c b/fs/xfs/xfs_fs_subr.c
index 33658234dfc5..b5380893728e 100644
--- a/fs/xfs/xfs_fs_subr.c
+++ b/fs/xfs/xfs_fs_subr.c
@@ -44,27 +44,3 @@ xfs_flushinval_pages(
44 truncate_inode_pages_range(mapping, first, last); 44 truncate_inode_pages_range(mapping, first, last);
45 return -ret; 45 return -ret;
46} 46}
47
48int
49xfs_flush_pages(
50 xfs_inode_t *ip,
51 xfs_off_t first,
52 xfs_off_t last,
53 uint64_t flags,
54 int fiopt)
55{
56 struct address_space *mapping = VFS_I(ip)->i_mapping;
57 int ret = 0;
58 int ret2;
59
60 xfs_iflags_clear(ip, XFS_ITRUNCATED);
61 ret = -filemap_fdatawrite_range(mapping, first,
62 last == -1 ? LLONG_MAX : last);
63 if (flags & XBF_ASYNC)
64 return ret;
65 ret2 = -filemap_fdatawait_range(mapping, first,
66 last == -1 ? XFS_ISIZE(ip) - 1 : last);
67 if (!ret)
68 ret = ret2;
69 return ret;
70}
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 81f5c4953287..d82efaa2ac73 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -780,8 +780,8 @@ xfs_setattr_size(
780 * care about here. 780 * care about here.
781 */ 781 */
782 if (oldsize != ip->i_d.di_size && newsize > ip->i_d.di_size) { 782 if (oldsize != ip->i_d.di_size && newsize > ip->i_d.di_size) {
783 error = xfs_flush_pages(ip, ip->i_d.di_size, newsize, 0, 783 error = -filemap_write_and_wait_range(VFS_I(ip)->i_mapping,
784 FI_NONE); 784 ip->i_d.di_size, newsize);
785 if (error) 785 if (error)
786 goto out_unlock; 786 goto out_unlock;
787 } 787 }
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 46a7a5de5d6d..c00326afa7bf 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -428,8 +428,11 @@ xfs_release(
428 truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED); 428 truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED);
429 if (truncated) { 429 if (truncated) {
430 xfs_iflags_clear(ip, XFS_IDIRTY_RELEASE); 430 xfs_iflags_clear(ip, XFS_IDIRTY_RELEASE);
431 if (VN_DIRTY(VFS_I(ip)) && ip->i_delayed_blks > 0) 431 if (VN_DIRTY(VFS_I(ip)) && ip->i_delayed_blks > 0) {
432 xfs_flush_pages(ip, 0, -1, XBF_ASYNC, FI_NONE); 432 error = -filemap_flush(VFS_I(ip)->i_mapping);
433 if (error)
434 return error;
435 }
433 } 436 }
434 } 437 }
435 438
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
index c8ad48b61a25..73cb3cb15f75 100644
--- a/fs/xfs/xfs_vnodeops.h
+++ b/fs/xfs/xfs_vnodeops.h
@@ -50,8 +50,6 @@ int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize,
50 int flags, struct attrlist_cursor_kern *cursor); 50 int flags, struct attrlist_cursor_kern *cursor);
51int xfs_flushinval_pages(struct xfs_inode *ip, xfs_off_t first, 51int xfs_flushinval_pages(struct xfs_inode *ip, xfs_off_t first,
52 xfs_off_t last, int fiopt); 52 xfs_off_t last, int fiopt);
53int xfs_flush_pages(struct xfs_inode *ip, xfs_off_t first,
54 xfs_off_t last, uint64_t flags, int fiopt);
55 53
56int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t); 54int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t);
57int xfs_free_eofblocks(struct xfs_mount *, struct xfs_inode *, bool); 55int xfs_free_eofblocks(struct xfs_mount *, struct xfs_inode *, bool);