diff options
author | Matthew Ahrens <[email protected]> | 2020-02-28 14:49:44 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-28 14:49:44 -0800 |
commit | 9cdf7b1f6b00cdd0a31d07e3fbc679d0e9eff247 (patch) | |
tree | e94d73d90ddd9fa6ba64207dfbbe706f24974976 /module/zfs/spa.c | |
parent | 6c0abcfddd4dcf8ef62e84cfa3b77c14e146827d (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 'module/zfs/spa.c')
-rw-r--r-- | module/zfs/spa.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c index c12b20270..a6f97eb37 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -8125,10 +8125,10 @@ bpobj_enqueue_free_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) static int spa_free_sync_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) { - zio_t *zio = arg; + zio_t *pio = arg; - zio_nowait(zio_free_sync(zio, zio->io_spa, dmu_tx_get_txg(tx), bp, - zio->io_flags)); + zio_nowait(zio_free_sync(pio, pio->io_spa, dmu_tx_get_txg(tx), bp, + pio->io_flags)); return (0); } |