diff options
author | Alexander Motin <[email protected]> | 2024-03-25 17:59:55 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-25 14:59:55 -0700 |
commit | 4616b96a643c941e96ee0d1d816c573df9f0de28 (patch) | |
tree | 0d2a815331fb50dca293288ab2ed3ee0409a1908 /module/zfs/brt.c | |
parent | 80cc516295fef1a429542fcfeea369c6bbb85ce4 (diff) |
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 <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Brian Atkinson <[email protected]>
Reviewed-by: Rob Norris <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Sponsored by: iXsystems, Inc.
Closes #15955
Diffstat (limited to 'module/zfs/brt.c')
-rw-r--r-- | module/zfs/brt.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/module/zfs/brt.c b/module/zfs/brt.c index 5e10df9df..416caeb11 100644 --- a/module/zfs/brt.c +++ b/module/zfs/brt.c @@ -1473,26 +1473,23 @@ brt_pending_remove(spa_t *spa, const blkptr_t *bp, dmu_tx_t *tx) void brt_pending_apply(spa_t *spa, uint64_t txg) { - brt_t *brt; + brt_t *brt = spa->spa_brt; brt_pending_entry_t *bpe; avl_tree_t *pending_tree; - kmutex_t *pending_lock; void *c; 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_lock = &brt->brt_pending_lock[txg & TXG_MASK]; - - mutex_enter(pending_lock); c = NULL; while ((bpe = avl_destroy_nodes(pending_tree, &c)) != NULL) { boolean_t added_to_ddt; - mutex_exit(pending_lock); - for (int i = 0; i < bpe->bpe_count; i++) { /* * 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); - mutex_enter(pending_lock); } - - mutex_exit(pending_lock); } static void |