Skip to content

Commit 3e91a9c

Browse files
amotinbehlendorf
authored andcommitted
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 <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes #15950
1 parent c94f730 commit 3e91a9c

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

module/zfs/brt.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,6 @@ static int
900900
brt_entry_lookup(brt_t *brt, brt_vdev_t *brtvd, brt_entry_t *bre)
901901
{
902902
uint64_t mos_entries;
903-
uint64_t one, physsize;
904903
int error;
905904

906905
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)
918917

919918
brt_unlock(brt);
920919

921-
error = zap_length_uint64(brt->brt_mos, mos_entries, &bre->bre_offset,
922-
BRT_KEY_WORDS, &one, &physsize);
923-
if (error == 0) {
924-
ASSERT3U(one, ==, 1);
925-
ASSERT3U(physsize, ==, sizeof (bre->bre_refcount));
926-
927-
error = zap_lookup_uint64(brt->brt_mos, mos_entries,
928-
&bre->bre_offset, BRT_KEY_WORDS, 1,
929-
sizeof (bre->bre_refcount), &bre->bre_refcount);
930-
BRT_DEBUG("ZAP lookup: object=%llu vdev=%llu offset=%llu "
931-
"count=%llu error=%d", (u_longlong_t)mos_entries,
932-
(u_longlong_t)brtvd->bv_vdevid,
933-
(u_longlong_t)bre->bre_offset,
934-
error == 0 ? (u_longlong_t)bre->bre_refcount : 0, error);
935-
}
920+
error = zap_lookup_uint64(brt->brt_mos, mos_entries, &bre->bre_offset,
921+
BRT_KEY_WORDS, 1, sizeof (bre->bre_refcount), &bre->bre_refcount);
936922

937923
brt_wlock(brt);
938924

0 commit comments

Comments
 (0)