X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fspa.c;h=c885e3e4131ef99eaf160a8935149d83b10bbdd6;hb=0a6bef26ec80ee4db5f5340bbc007a45311e0415;hp=e022c325864b3d7767cd1de9e5d045536472351d;hpb=7ef5e54e2e28884a04dc800657967b891239e933;p=zfs.git diff --git a/module/zfs/spa.c b/module/zfs/spa.c index e022c32..c885e3e 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -920,12 +920,37 @@ spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q, if (tqs->stqs_count == 1) { tq = tqs->stqs_taskq[0]; } else { - tq = tqs->stqs_taskq[gethrtime() % tqs->stqs_count]; + tq = tqs->stqs_taskq[((uint64_t)gethrtime()) % tqs->stqs_count]; } taskq_dispatch_ent(tq, func, arg, flags, ent); } +/* + * Same as spa_taskq_dispatch_ent() but block on the task until completion. + */ +void +spa_taskq_dispatch_sync(spa_t *spa, zio_type_t t, zio_taskq_type_t q, + task_func_t *func, void *arg, uint_t flags) +{ + spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q]; + taskq_t *tq; + taskqid_t id; + + ASSERT3P(tqs->stqs_taskq, !=, NULL); + ASSERT3U(tqs->stqs_count, !=, 0); + + if (tqs->stqs_count == 1) { + tq = tqs->stqs_taskq[0]; + } else { + tq = tqs->stqs_taskq[((uint64_t)gethrtime()) % tqs->stqs_count]; + } + + id = taskq_dispatch(tq, func, arg, flags); + if (id) + taskq_wait_id(tq, id); +} + static void spa_create_zio_taskqs(spa_t *spa) { @@ -5137,7 +5162,7 @@ spa_vdev_remove_evacuate(spa_t *spa, vdev_t *vd) * The evacuation succeeded. Remove any remaining MOS metadata * associated with this vdev, and wait for these changes to sync. */ - ASSERT3U(vd->vdev_stat.vs_alloc, ==, 0); + ASSERT0(vd->vdev_stat.vs_alloc); txg = spa_vdev_config_enter(spa); vd->vdev_removing = B_TRUE; vdev_dirty(vd, 0, NULL, txg); @@ -6138,7 +6163,7 @@ spa_sync(spa_t *spa, uint64_t txg) zio_t *zio = zio_root(spa, NULL, NULL, 0); VERIFY3U(bpobj_iterate(defer_bpo, spa_free_sync_cb, zio, tx), ==, 0); - VERIFY3U(zio_wait(zio), ==, 0); + VERIFY0(zio_wait(zio)); } /*