aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-07-28 13:14:08 +0200
committerDavid Sterba <dsterba@suse.com>2016-07-28 14:08:30 +0200
commit2f732723d6c1e3b6e9205e96da4c600ee72de875 (patch)
tree5eafd136b2353a773bbd08b63af8ac2c49752ae9 /cmds-filesystem.c
parent2542112e0ce4558ea7cf2d27104469c5e3709f4e (diff)
downloadbtrfs-progs-2f732723d6c1e3b6e9205e96da4c600ee72de875.tar.gz
btrfs-progs-2f732723d6c1e3b6e9205e96da4c600ee72de875.tar.xz
btrfs-progs-2f732723d6c1e3b6e9205e96da4c600ee72de875.zip
btrfs-progs: fi defrag: change default extent target size to 32 MiB
The kernel default is too low, 32 MiB is recommended and should give better results. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r--cmds-filesystem.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index ef1f550..00e4bfe 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -968,7 +968,7 @@ static const char * const cmd_filesystem_defrag_usage[] = {
"-f flush data to disk immediately after defragmenting",
"-s start defragment only from byte onward",
"-l len defragment only up to len bytes",
- "-t size target extent size hint",
+ "-t size target extent size hint (default: 32M)",
NULL
};
@@ -1029,7 +1029,7 @@ static int cmd_filesystem_defrag(int argc, char **argv)
int flush = 0;
u64 start = 0;
u64 len = (u64)-1;
- u64 thresh = 0;
+ u64 thresh;
int i;
int recursive = 0;
int ret = 0;
@@ -1037,6 +1037,13 @@ static int cmd_filesystem_defrag(int argc, char **argv)
int compress_type = BTRFS_COMPRESS_NONE;
DIR *dirstream;
+ /*
+ * Kernel has a different default (256K) that is supposed to be safe,
+ * but it does not defragment very well. The 32M will likely lead to
+ * better results and is independent of the kernel default.
+ */
+ thresh = 32 * 1024 * 1024;
+
defrag_global_errors = 0;
defrag_global_verbose = 0;
defrag_global_errors = 0;