From d9d970451024709bdff71bf20b99843a132c195d Mon Sep 17 00:00:00 2001 From: Gui Hecheng Date: Wed, 11 Dec 2013 17:27:46 +0800 Subject: [PATCH] btrfs-progs: fix improper error prompt for defragment The error msg: "ERROR: defrag range ioctl not supported in this kernel, please try without any options." should only show up when failing to do a range defraging, not upon non-range defraging. Signed-off-by: Gui Hecheng Signed-off-by: David Sterba Signed-off-by: Chris Mason --- cmds-filesystem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 8e4754f..0f29afc 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -687,7 +687,7 @@ static int defrag_callback(const char *fpath, const struct stat *sb, ret = do_defrag(fd, defrag_global_fancy_ioctl, &defrag_global_range); e = errno; close(fd); - if (ret && e == ENOTTY) { + if (ret && e == ENOTTY && defrag_global_fancy_ioctl) { fprintf(stderr, "ERROR: defrag range ioctl not " "supported in this kernel, please try " "without any options.\n"); @@ -820,7 +820,7 @@ static int cmd_defrag(int argc, char **argv) e = errno; } close_file_or_dir(fd, dirstream); - if (ret && e == ENOTTY) { + if (ret && e == ENOTTY && defrag_global_fancy_ioctl) { fprintf(stderr, "ERROR: defrag range ioctl not " "supported in this kernel, please try " "without any options.\n"); -- 2.7.4