Allow skipping dmu_buf_will_dirty() call in dsl_dir_transfer_space().
dsl_dir_transfer_space() is mostly called after dsl_dir_diduse_space(), which already calls dmu_buf_will_dirty() for the same dbuf and tx, so its duplicate call in those cases will change nothing, only spend time. Skipping this call by four times reduces time spent in dbuf_write_done() and descendants, updating dataset statistics with several congested lock acquisitions. When rewriting 8K zvol blocks at 1GB/s rate, this reduces CPU time spent inside dbuf_write_done(), according to profiling, from 45% of 683K samples to 18% of 422K. MFC after: 2 weeks
This commit is contained in:
parent
b829c841ad
commit
d6245e3d44
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277419
@ -136,7 +136,7 @@ dsl_dataset_block_born(dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx)
|
||||
dsl_dir_diduse_space(ds->ds_dir, DD_USED_HEAD, delta,
|
||||
compressed, uncompressed, tx);
|
||||
dsl_dir_transfer_space(ds->ds_dir, used - delta,
|
||||
DD_USED_REFRSRV, DD_USED_HEAD, tx);
|
||||
DD_USED_REFRSRV, DD_USED_HEAD, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
@ -179,7 +179,7 @@ dsl_dataset_block_kill(dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx,
|
||||
dsl_dir_diduse_space(ds->ds_dir, DD_USED_HEAD,
|
||||
delta, -compressed, -uncompressed, tx);
|
||||
dsl_dir_transfer_space(ds->ds_dir, -used - delta,
|
||||
DD_USED_REFRSRV, DD_USED_HEAD, tx);
|
||||
DD_USED_REFRSRV, DD_USED_HEAD, NULL);
|
||||
} else {
|
||||
dprintf_bp(bp, "putting on dead list: %s", "");
|
||||
if (async) {
|
||||
@ -2837,7 +2837,7 @@ dsl_dataset_clone_swap_sync_impl(dsl_dataset_t *clone,
|
||||
origin_head->ds_dir->dd_origin_txg, UINT64_MAX,
|
||||
&odl_used, &odl_comp, &odl_uncomp);
|
||||
dsl_dir_transfer_space(origin_head->ds_dir, cdl_used - odl_used,
|
||||
DD_USED_HEAD, DD_USED_SNAP, tx);
|
||||
DD_USED_HEAD, DD_USED_SNAP, NULL);
|
||||
}
|
||||
|
||||
/* swap ds_*_bytes */
|
||||
|
@ -1389,7 +1389,7 @@ dsl_dir_diduse_space(dsl_dir_t *dd, dd_used_t type,
|
||||
accounted_delta, compressed, uncompressed, tx);
|
||||
dsl_dir_transfer_space(dd->dd_parent,
|
||||
used - accounted_delta,
|
||||
DD_USED_CHILD_RSRV, DD_USED_CHILD, tx);
|
||||
DD_USED_CHILD_RSRV, DD_USED_CHILD, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1397,7 +1397,7 @@ void
|
||||
dsl_dir_transfer_space(dsl_dir_t *dd, int64_t delta,
|
||||
dd_used_t oldtype, dd_used_t newtype, dmu_tx_t *tx)
|
||||
{
|
||||
ASSERT(dmu_tx_is_syncing(tx));
|
||||
ASSERT(tx == NULL || dmu_tx_is_syncing(tx));
|
||||
ASSERT(oldtype < DD_USED_NUM);
|
||||
ASSERT(newtype < DD_USED_NUM);
|
||||
|
||||
@ -1405,7 +1405,8 @@ dsl_dir_transfer_space(dsl_dir_t *dd, int64_t delta,
|
||||
!(dsl_dir_phys(dd)->dd_flags & DD_FLAG_USED_BREAKDOWN))
|
||||
return;
|
||||
|
||||
dmu_buf_will_dirty(dd->dd_dbuf, tx);
|
||||
if (tx != NULL)
|
||||
dmu_buf_will_dirty(dd->dd_dbuf, tx);
|
||||
mutex_enter(&dd->dd_lock);
|
||||
ASSERT(delta > 0 ?
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[oldtype] >= delta :
|
||||
|
Loading…
Reference in New Issue
Block a user