Gui Hecheng
2013-Dec-11 09:27 UTC
[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 <guihc.fnst@cn.fujitsu.com>
---
cmds-filesystem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 83fe819..0cb35c6 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -765,7 +765,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");
@@ -898,7 +898,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");
--
1.8.0.1
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html