aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zdb
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2020-02-28 14:49:44 -0800
committerGitHub <[email protected]>2020-02-28 14:49:44 -0800
commit9cdf7b1f6b00cdd0a31d07e3fbc679d0e9eff247 (patch)
treee94d73d90ddd9fa6ba64207dfbbe706f24974976 /cmd/zdb
parent6c0abcfddd4dcf8ef62e84cfa3b77c14e146827d (diff)
Improve zfs destroy performance with zio_t-free zio_free()
When "zfs destroy" is run, it completes quickly, and in the background we locate the blocks to free and free them. This background activity can be observed with `zpool get freeing` and `zpool wait -t free ...`. This background activity is processed by a single thread (the spa_sync thread) which calls zio_free() on each of the blocks to free. With even modest storage performance, the CPU consumption of zio_free() can be the performance bottleneck. Performance of zio_free() can be improved by not actually creating a zio_t in the common case (non-dedup, non-gang), instead calling metaslab_free() directly. This avoids the CPU cost of allocating the zio_t, and more importantly the cost of adding and later removing this zio_t from the parent zio's child list. The result is that performance of background freeing more than doubles, from 0.6 million blocks per second to 1.3 million blocks per second. Reviewed-by: Paul Dagnelie <[email protected]> Reviewed-by: Serapheim Dimitropoulos <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Wilson <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Closes #10034
Diffstat (limited to 'cmd/zdb')
-rw-r--r--cmd/zdb/zdb.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index caaf1e608..e9e801b11 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -6913,7 +6913,7 @@ zdb_read_block(char *thing, spa_t *spa)
*/
if ((flags & ZDB_FLAG_CHECKSUM) && !(flags & ZDB_FLAG_RAW) &&
!(flags & ZDB_FLAG_GBH)) {
- zio_t *czio, *cio;
+ zio_t *czio;
(void) printf("\n");
for (enum zio_checksum ck = ZIO_CHECKSUM_LABEL;
ck < ZIO_CHECKSUM_FUNCTIONS; ck++) {
@@ -6929,12 +6929,11 @@ zdb_read_block(char *thing, spa_t *spa)
czio->io_bp = bp;
if (vd == vd->vdev_top) {
- cio = zio_read(czio, spa, bp, pabd, psize,
+ zio_nowait(zio_read(czio, spa, bp, pabd, psize,
NULL, NULL,
ZIO_PRIORITY_SYNC_READ,
ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW |
- ZIO_FLAG_DONT_RETRY, NULL);
- zio_nowait(cio);
+ ZIO_FLAG_DONT_RETRY, NULL));
} else {
zio_nowait(zio_vdev_child_io(czio, bp, vd,
offset, pabd, psize, ZIO_TYPE_READ,