When 'btrfs replace status' encounters an unknown dev replace status, it
will cause an assert, which is somewhat overkilled and can be replaced
with a normal error message.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
break;
default:
prevent_loop = 1;
- assert(0);
+ fprintf(stderr,
+ "Unknown btrfs dev replace status:%llu",
+ status->replace_state);
+ ret = -EINVAL;
break;
}
(unsigned long long)status->num_write_errors,
(unsigned long long)
status->num_uncorrectable_read_errors);
- if (once || prevent_loop) {
+ if (once || prevent_loop || ret) {
printf("\n");
- return 0;
+ return ret;
}
fflush(stdout);