| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [PATCH] Btrfs: correctly flush data on defrag when compression is enabled |
| From: | Filipe David Borba Manana <fdmanana@xxxxxxxxx> |
| Date: | Sat, 1 Mar 2014 10:55:54 +0000 |
| Cc: | linux-btrfs@xxxxxxxxxxxxxxx, Filipe David Borba Manana <fdmanana@xxxxxxxxx> |
| Delivered-to: | xfs@xxxxxxxxxxx |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=sMBStUVeVBWfSUod8waoDNmgmrSSvufTHPzGBpPyEX4=; b=K42lSOvb/oguVJz1kT/j8eKoLucEbHrvmU6IRRtjC2fBkUz+liUM1A3K0lSamjO5Kc U9+Z+ltxb6Pq4bwTAP/9dtBIJtORSoFGG2LU00luC92y9gHdjUUzz7iklhFfqaa7TQRI cV2c9QeoO+S2hdy0QQbaRv5RQKQciIFezpYEsf48l5Lfy3DlVi3fxrgRwSzPb2dONdrP 2gOxbjKT5VHcHOlplRan3XcRjzQBj7/Mavh6tUs9ta7c3JSBqSjmUtLnnV7pemD60wxn 88AotJnO3+zR/YluRflHo4aD77ffaXR89YP+FAqNqlsrFbXVsYC/PLL7NDQXaKIL3hIV D51A== |
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@xxxxxxxxx>
---
fs/btrfs/ioctl.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index d4c1795..f914b5d 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
--
1.7.9.5
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | THANKS, Pt |
|---|---|
| Next by Date: | [PATCH] Btrfs: make defrag not fragment files when using prealloc extents, Filipe David Borba Manana |
| Previous by Thread: | THANKS, Pt |
| Next by Thread: | [PATCH] Btrfs: make defrag not fragment files when using prealloc extents, Filipe David Borba Manana |
| Indexes: | [Date] [Thread] [Top] [All Lists] |