From 74fc769ffda6701dc64b316627f485e8d4d4c908 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Wed, 28 Feb 2024 16:28:12 -0500 Subject: [PATCH] BRT: Skip duplicate BRT prefetches If there is a pending entry for this block, then we've already issued BRT prefetch for it within this TXG, so don't do it again. BRT vdev lookup and following zap_prefetch_uint64() call can be pretty expensive and should be avoided when not necessary. Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. --- module/zfs/brt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/zfs/brt.c b/module/zfs/brt.c index 225ddaca1e54..756eca079ed9 100644 --- a/module/zfs/brt.c +++ b/module/zfs/brt.c @@ -1471,10 +1471,10 @@ brt_pending_add(spa_t *spa, const blkptr_t *bp, dmu_tx_t *tx) kmem_cache_free(brt_pending_entry_cache, newbpe); } else { ASSERT(bpe == NULL); - } - /* Prefetch BRT entry, as we will need it in the syncing context. */ - brt_prefetch(brt, bp); + /* Prefetch BRT entry for the syncing context. */ + brt_prefetch(brt, bp); + } } void