ftp1 ~ # btrfs --version btrfs-progs v4.9 ftp1 ~ # btrfs device stats --check /DATA btrfs device stats: unrecognized option '--check' usage: btrfs device stats [options] <path>|<device> Show device IO error statistics Show device IO error statistics for all devices of the given filesystem identified by PATH or DEVICE. The filesystem must be mounted. -c|--check return non-zero if any stat counter is not zero -z|--reset show current stats and reset values to zero ftp1 ~ # btrfs device stats -c /DATA [/dev/sdg1].write_io_errs 0 [/dev/sdg1].read_io_errs 0 [/dev/sdg1].flush_io_errs 0 [/dev/sdg1].corruption_errs 0 [/dev/sdg1].generation_errs 0 [/dev/sdc1].write_io_errs 0 [/dev/sdc1].read_io_errs 0 [/dev/sdc1].flush_io_errs 0 [/dev/sdc1].corruption_errs 0 [/dev/sdc1].generation_errs 0 [/dev/sdi1].write_io_errs 0 [/dev/sdi1].read_io_errs 0 [/dev/sdi1].flush_io_errs 0 [/dev/sdi1].corruption_errs 0 [/dev/sdi1].generation_errs 0 [/dev/sdb1].write_io_errs 0 [/dev/sdb1].read_io_errs 0 [/dev/sdb1].flush_io_errs 0 [/dev/sdb1].corruption_errs 0 [/dev/sdb1].generation_errs 0 [/dev/sdd1].write_io_errs 0 [/dev/sdd1].read_io_errs 0 [/dev/sdd1].flush_io_errs 0 [/dev/sdd1].corruption_errs 0 [/dev/sdd1].generation_errs 0 [/dev/sdh1].write_io_errs 0 [/dev/sdh1].read_io_errs 0 [/dev/sdh1].flush_io_errs 0 [/dev/sdh1].corruption_errs 0 [/dev/sdh1].generation_errs 0 [/dev/sdf1].write_io_errs 0 [/dev/sdf1].read_io_errs 0 [/dev/sdf1].flush_io_errs 0 [/dev/sdf1].corruption_errs 0 [/dev/sdf1].generation_errs 0 [/dev/sde1].write_io_errs 0 [/dev/sde1].read_io_errs 0 [/dev/sde1].flush_io_errs 0 [/dev/sde1].corruption_errs 0 [/dev/sde1].generation_errs 0
Problem still occurs. ftp1 ~ # uname -a Linux ftp1 4.9.16-gentoo-xeon #13 SMP Tue Apr 18 03:15:39 CEST 2017 x86_64 Intel(R) Xeon(R) CPU E3-1265L V2 @ 2.50GHz GenuineIntel GNU/Linux ftp1 ~ # btrfs --version btrfs-progs v4.10.2 ftp1 ~ # btrfs device stats --check /DATA btrfs device stats: unrecognized option '--check' usage: btrfs device stats [options] <path>|<device> Show device IO error statistics Show device IO error statistics for all devices of the given filesystem identified by PATH or DEVICE. The filesystem must be mounted. -c|--check return non-zero if any stat counter is not zero -z|--reset show current stats and reset values to zero ftp1 ~ # btrfs device stats -c /DATA [/dev/sdf1].write_io_errs 0 [/dev/sdf1].read_io_errs 0 [/dev/sdf1].flush_io_errs 0 [/dev/sdf1].corruption_errs 0 [/dev/sdf1].generation_errs 0 [/dev/sdc1].write_io_errs 0 [/dev/sdc1].read_io_errs 0 [/dev/sdc1].flush_io_errs 0 [/dev/sdc1].corruption_errs 0 [/dev/sdc1].generation_errs 0 [/dev/sdi1].write_io_errs 0 [/dev/sdi1].read_io_errs 0 [/dev/sdi1].flush_io_errs 0 [/dev/sdi1].corruption_errs 0 [/dev/sdi1].generation_errs 0 [/dev/sdb1].write_io_errs 0 [/dev/sdb1].read_io_errs 0 [/dev/sdb1].flush_io_errs 0 [/dev/sdb1].corruption_errs 0 [/dev/sdb1].generation_errs 0 [/dev/sdd1].write_io_errs 0 [/dev/sdd1].read_io_errs 0 [/dev/sdd1].flush_io_errs 0 [/dev/sdd1].corruption_errs 0 [/dev/sdd1].generation_errs 0
Thanks for the report. Seems like below 1-line fix, will resolve this issue. Will sent it for review in a day or two. diff --git a/cmds-device.c b/cmds-device.c index 5e016a7..4337eb2 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -400,6 +400,7 @@ static int cmd_device_stats(int argc, char **argv) while (1) { int c; static const struct option long_options[] = { + {"check", no_argument, NULL, 'c'}, {"reset", no_argument, NULL, 'z'}, {NULL, 0, NULL, 0} }; # ./btrfs device stats --check /mntpt [/dev/sda6].write_io_errs 0 [/dev/sda6].read_io_errs 0 [/dev/sda6].flush_io_errs 0 [/dev/sda6].corruption_errs 0 [/dev/sda6].generation_errs 0 [/dev/sda7].write_io_errs 0 [/dev/sda7].read_io_errs 0 [/dev/sda7].flush_io_errs 0 [/dev/sda7].corruption_errs 0 [/dev/sda7].generation_errs 0
sent a patch, hopefully it will be merged in next version.
Thanks. Patch applied to devel. Will be released in 4.12 at the latest, there might be a minor 4.11.x release (not decided yet).