mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 11:19:32 +03:00
BRT: Relax brt_pending_apply() locking
Since brt_pending_apply() is running in syncing context, no other brt_pending_tree accesses are possible for the TXG. We don't need to acquire brt_pending_lock here. Reviewed-by: Pawel Jakub Dawidek <pawel@dawidek.net> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Reviewed-by: Rob Norris <robn@despairlabs.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #15955
This commit is contained in:
parent
19bf54b764
commit
457e62d7ca
@ -1473,26 +1473,23 @@ brt_pending_remove(spa_t *spa, const blkptr_t *bp, dmu_tx_t *tx)
|
|||||||
void
|
void
|
||||||
brt_pending_apply(spa_t *spa, uint64_t txg)
|
brt_pending_apply(spa_t *spa, uint64_t txg)
|
||||||
{
|
{
|
||||||
brt_t *brt;
|
brt_t *brt = spa->spa_brt;
|
||||||
brt_pending_entry_t *bpe;
|
brt_pending_entry_t *bpe;
|
||||||
avl_tree_t *pending_tree;
|
avl_tree_t *pending_tree;
|
||||||
kmutex_t *pending_lock;
|
|
||||||
void *c;
|
void *c;
|
||||||
|
|
||||||
ASSERT3U(txg, !=, 0);
|
ASSERT3U(txg, !=, 0);
|
||||||
|
|
||||||
brt = spa->spa_brt;
|
/*
|
||||||
|
* We are in syncing context, so no other brt_pending_tree accesses
|
||||||
|
* are possible for the TXG. Don't need to acquire brt_pending_lock.
|
||||||
|
*/
|
||||||
pending_tree = &brt->brt_pending_tree[txg & TXG_MASK];
|
pending_tree = &brt->brt_pending_tree[txg & TXG_MASK];
|
||||||
pending_lock = &brt->brt_pending_lock[txg & TXG_MASK];
|
|
||||||
|
|
||||||
mutex_enter(pending_lock);
|
|
||||||
|
|
||||||
c = NULL;
|
c = NULL;
|
||||||
while ((bpe = avl_destroy_nodes(pending_tree, &c)) != NULL) {
|
while ((bpe = avl_destroy_nodes(pending_tree, &c)) != NULL) {
|
||||||
boolean_t added_to_ddt;
|
boolean_t added_to_ddt;
|
||||||
|
|
||||||
mutex_exit(pending_lock);
|
|
||||||
|
|
||||||
for (int i = 0; i < bpe->bpe_count; i++) {
|
for (int i = 0; i < bpe->bpe_count; i++) {
|
||||||
/*
|
/*
|
||||||
* If the block has DEDUP bit set, it means that it
|
* If the block has DEDUP bit set, it means that it
|
||||||
@ -1510,10 +1507,7 @@ brt_pending_apply(spa_t *spa, uint64_t txg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
kmem_cache_free(brt_pending_entry_cache, bpe);
|
kmem_cache_free(brt_pending_entry_cache, bpe);
|
||||||
mutex_enter(pending_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_exit(pending_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user