zio: rename ZIO_TYPE_IOCTL to ZIO_TYPE_FLUSH

The only possible ioctl is a flush, and any other kind of meta-operation
introduced in the future is likely to have different semantics (much
like trim did). So, lets just call it what it is.

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:
Rob Norris 2024-04-04 22:35:00 +11:00 committed by Brian Behlendorf
parent b613709c46
commit d7605ae77b
13 changed files with 53 additions and 47 deletions

View File

@ -265,7 +265,7 @@ usage(void)
"\t\tspa_vdev_exit() will trigger a panic.\n"
"\n"
"\tzinject -d device [-e errno] [-L <nvlist|uber|pad1|pad2>] [-F]\n"
"\t\t[-T <read|write|free|claim|ioctl|all>] [-f frequency] pool\n\n"
"\t\t[-T <read|write|free|claim|flush|all>] [-f frequency] pool\n\n"
"\t\tInject a fault into a particular device or the device's\n"
"\t\tlabel. Label injection can either be 'nvlist', 'uber',\n "
"\t\t'pad1', or 'pad2'.\n"
@ -425,7 +425,7 @@ print_device_handler(int id, const char *pool, zinject_record_t *record,
void *data)
{
static const char *iotypestr[] = {
"null", "read", "write", "free", "claim", "ioctl", "trim", "all",
"null", "read", "write", "free", "claim", "flush", "trim", "all",
};
int *count = data;
@ -978,14 +978,14 @@ main(int argc, char **argv)
io_type = ZIO_TYPE_FREE;
} else if (strcasecmp(optarg, "claim") == 0) {
io_type = ZIO_TYPE_CLAIM;
} else if (strcasecmp(optarg, "ioctl") == 0) {
io_type = ZIO_TYPE_IOCTL;
} else if (strcasecmp(optarg, "flush") == 0) {
io_type = ZIO_TYPE_FLUSH;
} else if (strcasecmp(optarg, "all") == 0) {
io_type = ZIO_TYPES;
} else {
(void) fprintf(stderr, "invalid I/O type "
"'%s': must be 'read', 'write', 'free', "
"'claim', 'ioctl' or 'all'\n", optarg);
"'claim', 'flush' or 'all'\n", optarg);
usage();
libzfs_fini(g_zfs);
return (1);

View File

@ -1094,11 +1094,17 @@ typedef enum zio_type {
ZIO_TYPE_WRITE,
ZIO_TYPE_FREE,
ZIO_TYPE_CLAIM,
ZIO_TYPE_IOCTL,
ZIO_TYPE_FLUSH,
ZIO_TYPE_TRIM,
ZIO_TYPES
} zio_type_t;
/*
* Compatibility: _IOCTL was renamed to _FLUSH; keep the old name available to
* user programs.
*/
#define ZIO_TYPE_IOCTL ZIO_TYPE_FLUSH
/*
* Pool statistics. Note: all fields should be 64-bit because this
* is passed between kernel and userland as an nvlist uint64 array.

View File

@ -40,7 +40,7 @@ extern "C" {
*
* The ZFS I/O pipeline is comprised of various stages which are defined
* in the zio_stage enum below. The individual stages are used to construct
* these basic I/O operations: Read, Write, Free, Claim, Ioctl and Trim.
* these basic I/O operations: Read, Write, Free, Claim, Flush and Trim.
*
* I/O operations: (XXX - provide detail for each of the operations)
*
@ -48,7 +48,7 @@ extern "C" {
* Write:
* Free:
* Claim:
* Ioctl:
* Flush:
* Trim:
*
* Although the most common pipeline are used by the basic I/O operations
@ -122,7 +122,7 @@ extern "C" {
* zio pipeline stage definitions
*/
enum zio_stage {
ZIO_STAGE_OPEN = 1 << 0, /* RWFCIT */
ZIO_STAGE_OPEN = 1 << 0, /* RWFCXT */
ZIO_STAGE_READ_BP_INIT = 1 << 1, /* R----- */
ZIO_STAGE_WRITE_BP_INIT = 1 << 2, /* -W---- */
@ -150,15 +150,15 @@ enum zio_stage {
ZIO_STAGE_DVA_FREE = 1 << 18, /* --F--- */
ZIO_STAGE_DVA_CLAIM = 1 << 19, /* ---C-- */
ZIO_STAGE_READY = 1 << 20, /* RWFCIT */
ZIO_STAGE_READY = 1 << 20, /* RWFCXT */
ZIO_STAGE_VDEV_IO_START = 1 << 21, /* RW--IT */
ZIO_STAGE_VDEV_IO_DONE = 1 << 22, /* RW--IT */
ZIO_STAGE_VDEV_IO_ASSESS = 1 << 23, /* RW--IT */
ZIO_STAGE_VDEV_IO_START = 1 << 21, /* RW--XT */
ZIO_STAGE_VDEV_IO_DONE = 1 << 22, /* RW--XT */
ZIO_STAGE_VDEV_IO_ASSESS = 1 << 23, /* RW--XT */
ZIO_STAGE_CHECKSUM_VERIFY = 1 << 24, /* R----- */
ZIO_STAGE_DONE = 1 << 25 /* RWFCIT */
ZIO_STAGE_DONE = 1 << 25 /* RWFCXT */
};
#define ZIO_ROOT_PIPELINE \
@ -259,7 +259,7 @@ enum zio_stage {
(ZIO_INTERLOCK_STAGES | \
ZIO_STAGE_DVA_CLAIM)
#define ZIO_IOCTL_PIPELINE \
#define ZIO_FLUSH_PIPELINE \
(ZIO_INTERLOCK_STAGES | \
ZIO_VDEV_IO_STAGES)

View File

@ -364,7 +364,7 @@ that is, the bits set in the good data which are cleared in the bad data.
.Sh I/O STAGES
The ZFS I/O pipeline is comprised of various stages which are defined below.
The individual stages are used to construct these basic I/O
operations: Read, Write, Free, Claim, Ioctl and Trim.
operations: Read, Write, Free, Claim, Flush and Trim.
These stages may be
set on an event to describe the life cycle of a given I/O request.
.Pp
@ -373,7 +373,7 @@ tab(:);
l l l .
Stage:Bit Mask:Operations
_:_:_
ZIO_STAGE_OPEN:0x00000001:RWFCIT
ZIO_STAGE_OPEN:0x00000001:RWFCXT
ZIO_STAGE_READ_BP_INIT:0x00000002:R-----
ZIO_STAGE_WRITE_BP_INIT:0x00000004:-W----
@ -403,13 +403,13 @@ ZIO_STAGE_DVA_CLAIM:0x00080000:---C--
ZIO_STAGE_READY:0x00100000:RWFCIT
ZIO_STAGE_VDEV_IO_START:0x00200000:RW--IT
ZIO_STAGE_VDEV_IO_DONE:0x00400000:RW--IT
ZIO_STAGE_VDEV_IO_ASSESS:0x00800000:RW--IT
ZIO_STAGE_VDEV_IO_START:0x00200000:RW--XT
ZIO_STAGE_VDEV_IO_DONE:0x00400000:RW--XT
ZIO_STAGE_VDEV_IO_ASSESS:0x00800000:RW--XT
ZIO_STAGE_CHECKSUM_VERIFY:0x01000000:R-----
ZIO_STAGE_DONE:0x02000000:RWFCIT
ZIO_STAGE_DONE:0x02000000:RWFCXT
.TE
.
.Sh I/O FLAGS

View File

@ -247,7 +247,7 @@ vdev_file_io_start(zio_t *zio)
vdev_t *vd = zio->io_vd;
vdev_file_t *vf = vd->vdev_tsd;
if (zio->io_type == ZIO_TYPE_IOCTL) {
if (zio->io_type == ZIO_TYPE_FLUSH) {
/* XXPOLICY */
if (!vdev_readable(vd)) {
zio->io_error = SET_ERROR(ENXIO);

View File

@ -1053,7 +1053,7 @@ vdev_geom_io_intr(struct bio *bp)
/*
* We have to split bio freeing into two parts, because the ABD code
* cannot be called in this context and vdev_op_io_done is not called
* for ZIO_TYPE_IOCTL zio-s.
* for ZIO_TYPE_FLUSH zio-s.
*/
if (zio->io_type != ZIO_TYPE_READ && zio->io_type != ZIO_TYPE_WRITE) {
g_destroy_bio(bp);
@ -1153,7 +1153,7 @@ vdev_geom_io_start(zio_t *zio)
vd = zio->io_vd;
if (zio->io_type == ZIO_TYPE_IOCTL) {
if (zio->io_type == ZIO_TYPE_FLUSH) {
/* XXPOLICY */
if (!vdev_readable(vd)) {
zio->io_error = SET_ERROR(ENXIO);
@ -1181,7 +1181,7 @@ vdev_geom_io_start(zio_t *zio)
ASSERT(zio->io_type == ZIO_TYPE_READ ||
zio->io_type == ZIO_TYPE_WRITE ||
zio->io_type == ZIO_TYPE_TRIM ||
zio->io_type == ZIO_TYPE_IOCTL);
zio->io_type == ZIO_TYPE_FLUSH);
cp = vd->vdev_tsd;
if (cp == NULL) {
@ -1233,7 +1233,7 @@ vdev_geom_io_start(zio_t *zio)
bp->bio_offset = zio->io_offset;
bp->bio_length = zio->io_size;
break;
case ZIO_TYPE_IOCTL:
case ZIO_TYPE_FLUSH:
bp->bio_cmd = BIO_FLUSH;
bp->bio_data = NULL;
bp->bio_offset = cp->provider->mediasize;

View File

@ -1400,7 +1400,7 @@ vdev_disk_io_start(zio_t *zio)
}
switch (zio->io_type) {
case ZIO_TYPE_IOCTL:
case ZIO_TYPE_FLUSH:
if (!vdev_readable(v)) {
/* Drive not there, can't flush */

View File

@ -242,7 +242,7 @@ vdev_file_io_start(zio_t *zio)
vdev_t *vd = zio->io_vd;
vdev_file_t *vf = vd->vdev_tsd;
if (zio->io_type == ZIO_TYPE_IOCTL) {
if (zio->io_type == ZIO_TYPE_FLUSH) {
/* XXPOLICY */
if (!vdev_readable(vd)) {
zio->io_error = SET_ERROR(ENXIO);

View File

@ -180,7 +180,7 @@ static zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ_TYPES] = {
{ ZTI_SYNC, ZTI_N(5), ZTI_SCALE, ZTI_N(5) }, /* WRITE */
{ ZTI_SCALE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* FREE */
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* CLAIM */
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* IOCTL */
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* FLUSH */
{ ZTI_N(4), ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* TRIM */
};

View File

@ -4924,11 +4924,11 @@ vdev_stat_update(zio_t *zio, uint64_t psize)
/*
* TRIM ops and bytes are reported to user space as
* ZIO_TYPE_IOCTL. This is done to preserve the
* ZIO_TYPE_FLUSH. This is done to preserve the
* vdev_stat_t structure layout for user space.
*/
if (type == ZIO_TYPE_TRIM)
vs_type = ZIO_TYPE_IOCTL;
vs_type = ZIO_TYPE_FLUSH;
/*
* Solely for the purposes of 'zpool iostat -lqrw'
@ -6239,12 +6239,12 @@ vdev_prop_get(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl)
case VDEV_PROP_OPS_TRIM:
/*
* TRIM ops and bytes are reported to user
* space as ZIO_TYPE_IOCTL. This is done to
* space as ZIO_TYPE_FLUSH. This is done to
* preserve the vdev_stat_t structure layout
* for user space.
*/
vdev_prop_add_list(outnvl, propname, NULL,
vd->vdev_stat.vs_ops[ZIO_TYPE_IOCTL],
vd->vdev_stat.vs_ops[ZIO_TYPE_FLUSH],
ZPROP_SRC_NONE);
continue;
case VDEV_PROP_BYTES_NULL:
@ -6275,12 +6275,12 @@ vdev_prop_get(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl)
case VDEV_PROP_BYTES_TRIM:
/*
* TRIM ops and bytes are reported to user
* space as ZIO_TYPE_IOCTL. This is done to
* space as ZIO_TYPE_FLUSH. This is done to
* preserve the vdev_stat_t structure layout
* for user space.
*/
vdev_prop_add_list(outnvl, propname, NULL,
vd->vdev_stat.vs_bytes[ZIO_TYPE_IOCTL],
vd->vdev_stat.vs_bytes[ZIO_TYPE_FLUSH],
ZPROP_SRC_NONE);
continue;
case VDEV_PROP_REMOVING:

View File

@ -2548,11 +2548,11 @@ vdev_draid_read_config_spare(vdev_t *vd)
}
/*
* Handle any ioctl requested of the distributed spare. Only flushes
* are supported in which case all children must be flushed.
* Handle any flush requested of the distributed spare. All children must be
* flushed.
*/
static int
vdev_draid_spare_ioctl(zio_t *zio)
vdev_draid_spare_flush(zio_t *zio)
{
vdev_t *vd = zio->io_vd;
int error = 0;
@ -2592,8 +2592,8 @@ vdev_draid_spare_io_start(zio_t *zio)
}
switch (zio->io_type) {
case ZIO_TYPE_IOCTL:
zio->io_error = vdev_draid_spare_ioctl(zio);
case ZIO_TYPE_FLUSH:
zio->io_error = vdev_draid_spare_flush(zio);
break;
case ZIO_TYPE_WRITE:

View File

@ -63,7 +63,7 @@ const char *const zio_type_name[ZIO_TYPES] = {
* Note: Linux kernel thread name length is limited
* so these names will differ from upstream open zfs.
*/
"z_null", "z_rd", "z_wr", "z_fr", "z_cl", "z_ioctl", "z_trim"
"z_null", "z_rd", "z_wr", "z_fr", "z_cl", "z_flush", "z_trim"
};
int zio_dva_throttle_enabled = B_TRUE;
@ -1632,8 +1632,8 @@ zio_flush(zio_t *pio, vdev_t *vd)
if (vd->vdev_children == 0) {
zio_nowait(zio_create(pio, vd->vdev_spa, 0, NULL, NULL, 0, 0,
NULL, NULL, ZIO_TYPE_IOCTL, ZIO_PRIORITY_NOW, flags, vd, 0,
NULL, ZIO_STAGE_OPEN, ZIO_IOCTL_PIPELINE));
NULL, NULL, ZIO_TYPE_FLUSH, ZIO_PRIORITY_NOW, flags, vd, 0,
NULL, ZIO_STAGE_OPEN, ZIO_FLUSH_PIPELINE));
} else {
for (uint64_t c = 0; c < vd->vdev_children; c++)
zio_flush(pio, vd->vdev_child[c]);
@ -4086,7 +4086,7 @@ zio_vdev_io_done(zio_t *zio)
ASSERT(zio->io_type == ZIO_TYPE_READ ||
zio->io_type == ZIO_TYPE_WRITE ||
zio->io_type == ZIO_TYPE_IOCTL ||
zio->io_type == ZIO_TYPE_FLUSH ||
zio->io_type == ZIO_TYPE_TRIM);
if (zio->io_delay)
@ -4094,7 +4094,7 @@ zio_vdev_io_done(zio_t *zio)
if (vd != NULL && vd->vdev_ops->vdev_op_leaf &&
vd->vdev_ops != &vdev_draid_spare_ops) {
if (zio->io_type != ZIO_TYPE_IOCTL)
if (zio->io_type != ZIO_TYPE_FLUSH)
vdev_queue_io_done(zio);
if (zio_injection_enabled && zio->io_error == 0)
@ -4239,7 +4239,7 @@ zio_vdev_io_assess(zio_t *zio)
* boolean flag so that we don't bother with it in the future.
*/
if ((zio->io_error == ENOTSUP || zio->io_error == ENOTTY) &&
zio->io_type == ZIO_TYPE_IOCTL && vd != NULL)
zio->io_type == ZIO_TYPE_FLUSH && vd != NULL)
vd->vdev_nowritecache = B_TRUE;
if (zio->io_error)

View File

@ -367,7 +367,7 @@ zio_handle_device_injection_impl(vdev_t *vd, zio_t *zio, int err1, int err2)
* We skip over faults in the labels unless it's during device open
* (i.e. zio == NULL) or a device flush (offset is meaningless)
*/
if (zio != NULL && zio->io_type != ZIO_TYPE_IOCTL) {
if (zio != NULL && zio->io_type != ZIO_TYPE_FLUSH) {
uint64_t offset = zio->io_offset;
if (offset < VDEV_LABEL_START_SIZE ||