aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2024-03-26 00:13:45 +0000
committerGitHub <noreply@github.com>2024-03-26 00:13:45 +0000
commit8cd8ccca5383dcdd9bf55d4d22921a6b43b4ebe1 (patch)
treef5c0bc1ef5e9040249285ed3af820bbc029d1286
parentc6be6ce1755a3d9a3cbe70256cd8958ef83d8542 (diff)
downloadsrc-8cd8ccca5383dcdd9bf55d4d22921a6b43b4ebe1.tar.gz
src-8cd8ccca5383dcdd9bf55d4d22921a6b43b4ebe1.zip
BRT: Skip getting length in brt_entry_lookup()
Unlike DDT, where ZAP values may have different lengths due to compression, all BRT entries are identical 8-byte counters. It does not make sense to first fetch the length only to assert it. zap_lookup_uint64() is specifically designed to work with counters of different size and should return error if something odd found. Calling it straight allows to save some measurable CPU time. Reviewed-by: Pawel Jakub Dawidek <pawel@dawidek.net> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rob Norris <robn@despairlabs.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #15950
-rw-r--r--module/zfs/brt.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/module/zfs/brt.c b/module/zfs/brt.c
index 5d1f4728b645..ea8c0735c4b7 100644
--- a/module/zfs/brt.c
+++ b/module/zfs/brt.c
@@ -900,7 +900,6 @@ static int
brt_entry_lookup(brt_t *brt, brt_vdev_t *brtvd, brt_entry_t *bre)
{
uint64_t mos_entries;
- uint64_t one, physsize;
int error;
ASSERT(RW_LOCK_HELD(&brt->brt_lock));
@@ -918,21 +917,8 @@ brt_entry_lookup(brt_t *brt, brt_vdev_t *brtvd, brt_entry_t *bre)
brt_unlock(brt);
- error = zap_length_uint64(brt->brt_mos, mos_entries, &bre->bre_offset,
- BRT_KEY_WORDS, &one, &physsize);
- if (error == 0) {
- ASSERT3U(one, ==, 1);
- ASSERT3U(physsize, ==, sizeof (bre->bre_refcount));
-
- error = zap_lookup_uint64(brt->brt_mos, mos_entries,
- &bre->bre_offset, BRT_KEY_WORDS, 1,
- sizeof (bre->bre_refcount), &bre->bre_refcount);
- BRT_DEBUG("ZAP lookup: object=%llu vdev=%llu offset=%llu "
- "count=%llu error=%d", (u_longlong_t)mos_entries,
- (u_longlong_t)brtvd->bv_vdevid,
- (u_longlong_t)bre->bre_offset,
- error == 0 ? (u_longlong_t)bre->bre_refcount : 0, error);
- }
+ error = zap_lookup_uint64(brt->brt_mos, mos_entries, &bre->bre_offset,
+ BRT_KEY_WORDS, 1, sizeof (bre->bre_refcount), &bre->bre_refcount);
brt_wlock(brt);