* [PATCH] Btrfs: fix autodefrag with compression
@ 2014-08-27 18:51 Chris Mason
0 siblings, 0 replies; only message in thread
From: Chris Mason @ 2014-08-27 18:51 UTC (permalink / raw)
To: linux-btrfs
The autodefrag code skips defrag when two extents are adjacent. But one
big advantage for autodefrag is cutting down on the number of small
extents, even when they are adjacent. This commit changes it to defrag
all small extents.
This is especially useful when trying to use compression on slowly
growing log files. We usually end up writing 4K or less at a time, so
the compression code isn't able to compress across multiple pages.
Signed-off-by: Chris Mason <clm@fb.com>
---
fs/btrfs/ioctl.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index fce6fd0e..a018ea4 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1019,8 +1019,10 @@ static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em)
return false;
next = defrag_lookup_extent(inode, em->start + em->len);
- if (!next || next->block_start >= EXTENT_MAP_LAST_BYTE ||
- (em->block_start + em->block_len == next->block_start))
+ if (!next || next->block_start >= EXTENT_MAP_LAST_BYTE)
+ ret = false;
+ else if ((em->block_start + em->block_len == next->block_start) &&
+ (em->block_len > 128 * 1024 && next->block_len > 128 * 1024))
ret = false;
free_extent_map(next);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-08-27 18:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-27 18:51 [PATCH] Btrfs: fix autodefrag with compression Chris Mason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).