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>
This commit is contained in:
Gui Hecheng 2013-12-11 17:27:46 +08:00 committed by Chris Mason
parent d47b4e4dd2
commit d9d9704510
1 changed files with 2 additions and 2 deletions

View File

@ -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");