From 9cdf7b1f6b00cdd0a31d07e3fbc679d0e9eff247 Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Fri, 28 Feb 2020 14:49:44 -0800 Subject: 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 Reviewed-by: Serapheim Dimitropoulos Reviewed-by: Brian Behlendorf Reviewed-by: George Wilson Signed-off-by: Matthew Ahrens Closes #10034 --- module/zfs/dmu_objset.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/zfs/dmu_objset.c') diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c index 9f9eb1e01..a91ecb640 100644 --- a/module/zfs/dmu_objset.c +++ b/module/zfs/dmu_objset.c @@ -1714,8 +1714,7 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx) while ((dr = list_head(list)) != NULL) { ASSERT0(dr->dr_dbuf->db_level); list_remove(list, dr); - if (dr->dr_zio) - zio_nowait(dr->dr_zio); + zio_nowait(dr->dr_zio); } /* Enable dnode backfill if enough objects have been freed. */ -- cgit v1.2.3