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:
parent
d47b4e4dd2
commit
d9d9704510
|
@ -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);
|
ret = do_defrag(fd, defrag_global_fancy_ioctl, &defrag_global_range);
|
||||||
e = errno;
|
e = errno;
|
||||||
close(fd);
|
close(fd);
|
||||||
if (ret && e == ENOTTY) {
|
if (ret && e == ENOTTY && defrag_global_fancy_ioctl) {
|
||||||
fprintf(stderr, "ERROR: defrag range ioctl not "
|
fprintf(stderr, "ERROR: defrag range ioctl not "
|
||||||
"supported in this kernel, please try "
|
"supported in this kernel, please try "
|
||||||
"without any options.\n");
|
"without any options.\n");
|
||||||
|
@ -820,7 +820,7 @@ static int cmd_defrag(int argc, char **argv)
|
||||||
e = errno;
|
e = errno;
|
||||||
}
|
}
|
||||||
close_file_or_dir(fd, dirstream);
|
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 "
|
fprintf(stderr, "ERROR: defrag range ioctl not "
|
||||||
"supported in this kernel, please try "
|
"supported in this kernel, please try "
|
||||||
"without any options.\n");
|
"without any options.\n");
|
||||||
|
|
Loading…
Reference in New Issue