xfs: flush removing page cache in xfs_reflink_remap_prep
[sfrench/cifs-2.6.git] / fs / xfs / xfs_bmap_util.c
index 5d263dfdb3bcc60ca30708622397e42de9fbaeac..404e581f1ea1e879e4a32099d303e53a89fbb91a 100644 (file)
@@ -1042,7 +1042,7 @@ out_trans_cancel:
        goto out_unlock;
 }
 
-static int
+int
 xfs_flush_unmap_range(
        struct xfs_inode        *ip,
        xfs_off_t               offset,
@@ -1195,13 +1195,7 @@ xfs_prepare_shift(
         * Writeback and invalidate cache for the remainder of the file as we're
         * about to shift down every extent from offset to EOF.
         */
-       error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, offset, -1);
-       if (error)
-               return error;
-       error = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping,
-                                       offset >> PAGE_SHIFT, -1);
-       if (error)
-               return error;
+       error = xfs_flush_unmap_range(ip, offset, XFS_ISIZE(ip));
 
        /*
         * Clean out anything hanging around in the cow fork now that