mirror of
https://git.proxmox.com/git/mirror_zfs
synced 2025-04-28 11:40:17 +00:00
flush: only detect lack of flush support in one place
It seems there's no good reason for vdev_disk & vdev_geom to explicitly detect no support for flush and set vdev_nowritecache. Instead, just signal it by setting the error to ENOTSUP, and let zio_vdev_io_assess() take care of it in one place. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16855
This commit is contained in:
parent
5bb034f533
commit
e1833a72f9
@ -1014,21 +1014,6 @@ vdev_geom_io_intr(struct bio *bp)
|
|||||||
zio->io_error = SET_ERROR(EIO);
|
zio->io_error = SET_ERROR(EIO);
|
||||||
|
|
||||||
switch (zio->io_error) {
|
switch (zio->io_error) {
|
||||||
case ENOTSUP:
|
|
||||||
/*
|
|
||||||
* If we get ENOTSUP for BIO_FLUSH or BIO_DELETE we know
|
|
||||||
* that future attempts will never succeed. In this case
|
|
||||||
* we set a persistent flag so that we don't bother with
|
|
||||||
* requests in the future.
|
|
||||||
*/
|
|
||||||
switch (bp->bio_cmd) {
|
|
||||||
case BIO_FLUSH:
|
|
||||||
vd->vdev_nowritecache = B_TRUE;
|
|
||||||
break;
|
|
||||||
case BIO_DELETE:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ENXIO:
|
case ENXIO:
|
||||||
if (!vd->vdev_remove_wanted) {
|
if (!vd->vdev_remove_wanted) {
|
||||||
/*
|
/*
|
||||||
|
@ -1198,9 +1198,8 @@ vdev_disk_io_flush_completion(struct bio *bio)
|
|||||||
{
|
{
|
||||||
zio_t *zio = bio->bi_private;
|
zio_t *zio = bio->bi_private;
|
||||||
zio->io_error = bi_status_to_errno(bio->bi_status);
|
zio->io_error = bi_status_to_errno(bio->bi_status);
|
||||||
|
if (zio->io_error == EOPNOTSUPP || zio->io_error == ENOTTY)
|
||||||
if (zio->io_error && (zio->io_error == EOPNOTSUPP))
|
zio->io_error = SET_ERROR(ENOTSUP);
|
||||||
zio->io_vd->vdev_nowritecache = B_TRUE;
|
|
||||||
|
|
||||||
bio_put(bio);
|
bio_put(bio);
|
||||||
ASSERT3S(zio->io_error, >=, 0);
|
ASSERT3S(zio->io_error, >=, 0);
|
||||||
|
@ -4606,13 +4606,13 @@ zio_vdev_io_assess(zio_t *zio)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a cache flush returns ENOTSUP or ENOTTY, we know that no future
|
* If a cache flush returns ENOTSUP we know that no future
|
||||||
* attempts will ever succeed. In this case we set a persistent
|
* attempts will ever succeed. In this case we set a persistent
|
||||||
* boolean flag so that we don't bother with it in the future, and
|
* boolean flag so that we don't bother with it in the future, and
|
||||||
* then we act like the flush succeeded.
|
* then we act like the flush succeeded.
|
||||||
*/
|
*/
|
||||||
if ((zio->io_error == ENOTSUP || zio->io_error == ENOTTY) &&
|
if (zio->io_error == ENOTSUP && zio->io_type == ZIO_TYPE_FLUSH &&
|
||||||
zio->io_type == ZIO_TYPE_FLUSH && vd != NULL) {
|
vd != NULL) {
|
||||||
vd->vdev_nowritecache = B_TRUE;
|
vd->vdev_nowritecache = B_TRUE;
|
||||||
zio->io_error = 0;
|
zio->io_error = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user