Btrfs: add helper btrfs_fdatawrite_range
To avoid duplicating this double filemap_fdatawrite_range() call for
inodes with async extents (compressed writes) so often.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 01d223e..95f0693 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7015,14 +7015,7 @@
btrfs_put_ordered_extent(ordered);
} else {
/* Screw you mmap */
- ret = filemap_fdatawrite_range(inode->i_mapping,
- lockstart,
- lockend);
- if (!ret && test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT,
- &BTRFS_I(inode)->runtime_flags))
- ret = filemap_fdatawrite_range(inode->i_mapping,
- lockstart,
- lockend);
+ ret = btrfs_fdatawrite_range(inode, lockstart, lockend);
if (ret)
break;
ret = filemap_fdatawait_range(inode->i_mapping,