summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorFilipe Manana2014-03-01 11:55:54 +0100
committerJosef Bacik2014-03-10 20:17:16 +0100
commitdec8ef90552f7b8cc6612daa2e3aa3a2212b0402 (patch)
tree6369b052c7bce2c06ce2ec00142437ae02cd1f92 /fs/btrfs
parentbtrfs: Cleanup the "_struct" suffix in btrfs_workequeue (diff)
downloadkernel-qcow2-linux-dec8ef90552f7b8cc6612daa2e3aa3a2212b0402.tar.gz
kernel-qcow2-linux-dec8ef90552f7b8cc6612daa2e3aa3a2212b0402.tar.xz
kernel-qcow2-linux-dec8ef90552f7b8cc6612daa2e3aa3a2212b0402.zip
Btrfs: correctly flush data on defrag when compression is enabled
When the defrag flag BTRFS_DEFRAG_RANGE_START_IO is set and compression enabled, we weren't flushing completely, as writing compressed extents is a 2 steps process, one to compress the data and another one to write the compressed data to disk. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ioctl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index d4c179502775..f914b5db7ff1 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1382,8 +1382,12 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
}
}
- if ((range->flags & BTRFS_DEFRAG_RANGE_START_IO))
+ if ((range->flags & BTRFS_DEFRAG_RANGE_START_IO)) {
filemap_flush(inode->i_mapping);
+ if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT,
+ &BTRFS_I(inode)->runtime_flags))
+ filemap_flush(inode->i_mapping);
+ }
if ((range->flags & BTRFS_DEFRAG_RANGE_COMPRESS)) {
/* the filemap_flush will queue IO into the worker threads, but