Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BRT: Relax brt_pending_apply() locking #15955

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions module/zfs/brt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1514,26 +1514,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.
*/
behlendorf marked this conversation as resolved.
Show resolved Hide resolved
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
Expand All @@ -1551,10 +1548,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
Expand Down
Loading