mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
zio: remove io_cmd and DKIOCFLUSHWRITECACHE
There's no other options, so we can just always assume its a flush. Includes some light refactoring where a switch statement was doing control flow that no longer works. 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 #16064
This commit is contained in:
committed by
Brian Behlendorf
parent
cac416f106
commit
c9c838aa1f
@@ -1403,38 +1403,29 @@ vdev_disk_io_start(zio_t *zio)
|
||||
case ZIO_TYPE_IOCTL:
|
||||
|
||||
if (!vdev_readable(v)) {
|
||||
rw_exit(&vd->vd_lock);
|
||||
zio->io_error = SET_ERROR(ENXIO);
|
||||
zio_interrupt(zio);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (zio->io_cmd) {
|
||||
case DKIOCFLUSHWRITECACHE:
|
||||
|
||||
if (zfs_nocacheflush)
|
||||
break;
|
||||
|
||||
if (v->vdev_nowritecache) {
|
||||
zio->io_error = SET_ERROR(ENOTSUP);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Drive not there, can't flush */
|
||||
error = SET_ERROR(ENXIO);
|
||||
} else if (zfs_nocacheflush) {
|
||||
/* Flushing disabled by operator, declare success */
|
||||
error = 0;
|
||||
} else if (v->vdev_nowritecache) {
|
||||
/* This vdev not capable of flushing */
|
||||
error = SET_ERROR(ENOTSUP);
|
||||
} else {
|
||||
/*
|
||||
* Issue the flush. If successful, the response will
|
||||
* be handled in the completion callback, so we're done.
|
||||
*/
|
||||
error = vdev_disk_io_flush(BDH_BDEV(vd->vd_bdh), zio);
|
||||
if (error == 0) {
|
||||
rw_exit(&vd->vd_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
zio->io_error = error;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
zio->io_error = SET_ERROR(ENOTSUP);
|
||||
}
|
||||
|
||||
/* Couldn't issue the flush, so set the error and return it */
|
||||
rw_exit(&vd->vd_lock);
|
||||
zio->io_error = error;
|
||||
zio_execute(zio);
|
||||
return;
|
||||
|
||||
|
||||
@@ -250,33 +250,27 @@ vdev_file_io_start(zio_t *zio)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (zio->io_cmd) {
|
||||
case DKIOCFLUSHWRITECACHE:
|
||||
|
||||
if (zfs_nocacheflush)
|
||||
break;
|
||||
|
||||
/*
|
||||
* We cannot safely call vfs_fsync() when PF_FSTRANS
|
||||
* is set in the current context. Filesystems like
|
||||
* XFS include sanity checks to verify it is not
|
||||
* already set, see xfs_vm_writepage(). Therefore
|
||||
* the sync must be dispatched to a different context.
|
||||
*/
|
||||
if (__spl_pf_fstrans_check()) {
|
||||
VERIFY3U(taskq_dispatch(vdev_file_taskq,
|
||||
vdev_file_io_fsync, zio, TQ_SLEEP), !=,
|
||||
TASKQID_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
zio->io_error = zfs_file_fsync(vf->vf_file,
|
||||
O_SYNC | O_DSYNC);
|
||||
break;
|
||||
default:
|
||||
zio->io_error = SET_ERROR(ENOTSUP);
|
||||
if (zfs_nocacheflush) {
|
||||
zio_execute(zio);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* We cannot safely call vfs_fsync() when PF_FSTRANS
|
||||
* is set in the current context. Filesystems like
|
||||
* XFS include sanity checks to verify it is not
|
||||
* already set, see xfs_vm_writepage(). Therefore
|
||||
* the sync must be dispatched to a different context.
|
||||
*/
|
||||
if (__spl_pf_fstrans_check()) {
|
||||
VERIFY3U(taskq_dispatch(vdev_file_taskq,
|
||||
vdev_file_io_fsync, zio, TQ_SLEEP), !=,
|
||||
TASKQID_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
zio->io_error = zfs_file_fsync(vf->vf_file, O_SYNC | O_DSYNC);
|
||||
|
||||
zio_execute(zio);
|
||||
return;
|
||||
} else if (zio->io_type == ZIO_TYPE_TRIM) {
|
||||
|
||||
Reference in New Issue
Block a user