On Fri, Oct 06, 2017 at 02:31:20PM +0200, Ilya Dryomov wrote:
> This would unconditionally overwrite any WRITE ZEROS error. If we get
> e.g. -EIO, and manual zeroing is not allowed, I don't think we want to
> return -EOPNOTSUPP?
>
> Returning -EOPNOTSUPP to mean "can't zero using either method" doesn't
> make sense to me, because manual zeroing is always supported, just not
> always allowed.
Then thow the throw bdev_write_zeroes_sectors check back in:
if (ret && try_write_zeroes) {
if (!(flags & BLKDEV_ZERO_NOFALLBACK))
try_write_zeroes = false;
goto retry;
}
if (!bdev_write_zeroes_sectors(bdev))
ret = -EOPNOTSUPP;
}
The important bit is that the structure in the current patch where the
bdev_write_zeroes_sectors check is on the same level as the method
selection is extremely confusing.