On 10/15/19 12:23 PM, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > The error handling strategy for media errors is totally bogus. First of > all, short reads are entirely unhandled -- when we encounter a short > read, we know the disk was able to feed us the beginning of what we > asked for, so we need to single-step through the remainder to try to > capture the exact error that we hit. > > Second, an actual IO error causes the entire region to be marked bad > even though it could be just a few MB of a multi-gigabyte extent that's > bad. Therefore, single-step each block in the IO request until we stop > getting IO errors to find out if all the blocks are bad or if it's just > that extent. > > Third, fix the fact that the loop updates its own counter variables with > the length fed to read(), which doesn't necessarily have anything to do > with the amount of data that the read actually produced. > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > --- > v2: fix errors_seen bogosity changing io_error to read_error on commit (since io_error != EIO is odd?) Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>