btrfs: dev-replace: count uncorrectable read errors
btrfs_dev_replace::num_uncorrectable_read_errors is reported by the
dev-replace status ioctl ("uncorr. read errs" in btrfs replace status)
and stored in the dev_replace item, but nothing increments it.
Even before v4.19 only two replace paths counted it: the nodatasum fixup
worker, when it could not repair a sector through the page cache, and
the nocow copy worker, when it could not write a range to the target.
Uncorrectable sectors with checksums, data or metadata, went through
scrub_handle_errored_block(), which counted them in the scrub stats but
not here. Both paths were removed in v4.19, by commits
9bebe665c3e4
("btrfs: scrub: Remove unused copy_nocow_pages and its callchain") and
8b9b6f255485 ("btrfs: scrub: cleanup the remaining nodatasum fixup
code"), and the scrub_stripe based scrub never counted it either. Status
always shows 0, however many sectors could not be copied.
Count the sectors that flush_scrub_stripes() does not write to the
replace target because they are covered by an extent but could not be
read or repaired from any copy. This covers every uncorrectable sector
the replace skips, checksummed or not.
The count is taken before the check for a metadata error, which aborts
the replace, so that the sectors of the batch that aborts it are counted
as well.
Assisted-by: Claude:claude-opus-5-5