From 3ef0c861a50bb5b6a57c4b03c4e36526283d7cd4 Mon Sep 17 00:00:00 2001 From: mav Date: Thu, 2 Mar 2017 07:50:06 +0000 Subject: [PATCH] Completely skip cache flushing for not supporting log devices. MFC after: 2 weeks Sponsored by: iXsystems, Inc. --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c index 17377f731576..aa003fe33091 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c @@ -838,7 +838,7 @@ zil_flush_vdevs(zilog_t *zilog) avl_tree_t *t = &zilog->zl_vdev_tree; void *cookie = NULL; zil_vdev_node_t *zv; - zio_t *zio; + zio_t *zio = NULL; ASSERT(zilog->zl_writer); @@ -851,12 +851,13 @@ zil_flush_vdevs(zilog_t *zilog) spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); - zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); - while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) { vdev_t *vd = vdev_lookup_top(spa, zv->zv_vdev); - if (vd != NULL) + if (vd != NULL && !vd->vdev_nowritecache) { + if (zio == NULL) + zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); zio_flush(zio, vd); + } kmem_free(zv, sizeof (*zv)); } @@ -864,7 +865,8 @@ zil_flush_vdevs(zilog_t *zilog) * Wait for all the flushes to complete. Not all devices actually * support the DKIOCFLUSHWRITECACHE ioctl, so it's OK if it fails. */ - (void) zio_wait(zio); + if (zio) + (void) zio_wait(zio); spa_config_exit(spa, SCL_STATE, FTAG); }