summaryrefslogtreecommitdiff
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-01-12 15:00:47 +0100
committerDavid Sterba <dsterba@suse.com>2017-01-25 09:47:43 +0100
commit52f21fc76965b4c7b39bc5e3d0f6e044f1ddb693 (patch)
tree4db0726a943385dfce4e8560f1635097d35499d4 /cmds-filesystem.c
parentb757cf4ba76b433769722622734c54b7c7e175a8 (diff)
btrfs-progs: defrag: force using v2 defrag ioctl and make default 32M threshold actually work
A user reported on IRC that the new 32M default for target extent size does not work. This happens because if there are no commandline options, the v1 ioctl is used that does not do any fine grained defrag. As the v2 ioctl has been introduced 6 years ago (2010, kernel 2.6.33) we won't keep backward compatibility anymore. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r--cmds-filesystem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index c66709b3..56a19a93 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -1042,14 +1042,15 @@ static int cmd_filesystem_defrag(int argc, char **argv)
/*
* 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.
+ * better results and is independent of the kernel default. We have to
+ * use the v2 defrag ioctl.
*/
thresh = 32 * 1024 * 1024;
+ defrag_global_fancy_ioctl = 1;
defrag_global_errors = 0;
defrag_global_verbose = 0;
defrag_global_errors = 0;
- defrag_global_fancy_ioctl = 0;
while(1) {
int c = getopt(argc, argv, "vrc::fs:l:t:");
if (c < 0)