[PATCH] btrfs-progs: fix improper error prompt for defragment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux