]> git.proxmox.com Git - mirror_zfs.git/commitdiff
BRT: Skip duplicate BRT prefetches
authorAlexander Motin <mav@FreeBSD.org>
Mon, 25 Mar 2024 21:58:04 +0000 (17:58 -0400)
committerGitHub <noreply@github.com>
Mon, 25 Mar 2024 21:58:04 +0000 (14:58 -0700)
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.

Reviewed-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15941

module/zfs/brt.c

index 3d565cd1397c7633d464438ca723a11521c79bbe..7ddec0b4b9bbd3a3b9574d2c9467628bb81a6181 100644 (file)
@@ -1472,10 +1472,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