summaryrefslogtreecommitdiff
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>2013-12-11 17:27:46 +0800
committerChris Mason <clm@fb.com>2014-01-31 08:22:13 -0800
commitd9d970451024709bdff71bf20b99843a132c195d (patch)
tree64a312109aa739e889d1f93ebd0161b882518391 /cmds-filesystem.c
parentd47b4e4dd284a7668b517671d4dd5de35e8a912d (diff)
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 <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r--cmds-filesystem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 8e4754f8..0f29afc5 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");