ZIO: Optimize zio_flush()
- Generalize vdev_nowritecache handling by traversing through the VDEV tree and skipping children ZIOs where not supported. - Remove intermediate zio_null() in case of several VDEV children. - Remove children handling from zio_ioctl(). There are no other use cases for this code beside DKIOCFLUSHWRITECACHED, and would there be, I doubt they would so straightforward apply to all VDEV children. Comparing to removed previous optimization this should improve cases of redundant ZILs/SLOGs. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: George Wilson <george.wilson@delphix.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #15515
This commit is contained in:
parent
22c8c33a58
commit
5a3bffab10
|
@ -1599,7 +1599,7 @@ zil_lwb_write_done(zio_t *zio)
|
||||||
|
|
||||||
while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) {
|
while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) {
|
||||||
vdev_t *vd = vdev_lookup_top(spa, zv->zv_vdev);
|
vdev_t *vd = vdev_lookup_top(spa, zv->zv_vdev);
|
||||||
if (vd != NULL && !vd->vdev_nowritecache) {
|
if (vd != NULL) {
|
||||||
/*
|
/*
|
||||||
* The "ZIO_FLAG_DONT_PROPAGATE" is currently
|
* The "ZIO_FLAG_DONT_PROPAGATE" is currently
|
||||||
* always used within "zio_flush". This means,
|
* always used within "zio_flush". This means,
|
||||||
|
|
|
@ -1399,23 +1399,10 @@ zio_t *
|
||||||
zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd,
|
zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd,
|
||||||
zio_done_func_t *done, void *private, zio_flag_t flags)
|
zio_done_func_t *done, void *private, zio_flag_t flags)
|
||||||
{
|
{
|
||||||
zio_t *zio;
|
zio_t *zio = zio_create(pio, spa, 0, NULL, NULL, 0, 0, done, private,
|
||||||
int c;
|
ZIO_TYPE_IOCTL, ZIO_PRIORITY_NOW, flags, vd, 0, NULL,
|
||||||
|
ZIO_STAGE_OPEN, ZIO_IOCTL_PIPELINE);
|
||||||
if (vd->vdev_children == 0) {
|
zio->io_cmd = cmd;
|
||||||
zio = zio_create(pio, spa, 0, NULL, NULL, 0, 0, done, private,
|
|
||||||
ZIO_TYPE_IOCTL, ZIO_PRIORITY_NOW, flags, vd, 0, NULL,
|
|
||||||
ZIO_STAGE_OPEN, ZIO_IOCTL_PIPELINE);
|
|
||||||
|
|
||||||
zio->io_cmd = cmd;
|
|
||||||
} else {
|
|
||||||
zio = zio_null(pio, spa, NULL, NULL, NULL, flags);
|
|
||||||
|
|
||||||
for (c = 0; c < vd->vdev_children; c++)
|
|
||||||
zio_nowait(zio_ioctl(zio, spa, vd->vdev_child[c], cmd,
|
|
||||||
done, private, flags));
|
|
||||||
}
|
|
||||||
|
|
||||||
return (zio);
|
return (zio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1586,11 +1573,18 @@ zio_vdev_delegated_io(vdev_t *vd, uint64_t offset, abd_t *data, uint64_t size,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
zio_flush(zio_t *zio, vdev_t *vd)
|
zio_flush(zio_t *pio, vdev_t *vd)
|
||||||
{
|
{
|
||||||
zio_nowait(zio_ioctl(zio, zio->io_spa, vd, DKIOCFLUSHWRITECACHE,
|
if (vd->vdev_nowritecache)
|
||||||
NULL, NULL,
|
return;
|
||||||
ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_DONT_RETRY));
|
if (vd->vdev_children == 0) {
|
||||||
|
zio_nowait(zio_ioctl(pio, vd->vdev_spa, vd,
|
||||||
|
DKIOCFLUSHWRITECACHE, NULL, NULL, ZIO_FLAG_CANFAIL |
|
||||||
|
ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_DONT_RETRY));
|
||||||
|
} else {
|
||||||
|
for (uint64_t c = 0; c < vd->vdev_children; c++)
|
||||||
|
zio_flush(pio, vd->vdev_child[c]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue