ASSERT3U(idx, <, brtvd->bv_size);
- if (brtvd->bv_need_byteswap) {
+ if (unlikely(brtvd->bv_need_byteswap)) {
return (BSWAP_16(brtvd->bv_entcount[idx]));
} else {
return (brtvd->bv_entcount[idx]);
ASSERT3U(idx, <, brtvd->bv_size);
- if (brtvd->bv_need_byteswap) {
+ if (unlikely(brtvd->bv_need_byteswap)) {
brtvd->bv_entcount[idx] = BSWAP_16(entcnt);
} else {
brtvd->bv_entcount[idx] = entcnt;
#ifdef ZFS_DEBUG
static void
-brt_vdev_dump(brt_t *brt)
+brt_vdev_dump(brt_vdev_t *brtvd)
{
- brt_vdev_t *brtvd;
- uint64_t vdevid;
-
- if ((zfs_flags & ZFS_DEBUG_BRT) == 0) {
- return;
- }
-
- if (brt->brt_nvdevs == 0) {
- zfs_dbgmsg("BRT empty");
- return;
- }
-
- zfs_dbgmsg("BRT vdev dump:");
- for (vdevid = 0; vdevid < brt->brt_nvdevs; vdevid++) {
- uint64_t idx;
+ uint64_t idx;
- brtvd = &brt->brt_vdevs[vdevid];
- zfs_dbgmsg(" vdevid=%llu/%llu meta_dirty=%d entcount_dirty=%d "
- "size=%llu totalcount=%llu nblocks=%llu bitmapsize=%zu\n",
- (u_longlong_t)vdevid, (u_longlong_t)brtvd->bv_vdevid,
- brtvd->bv_meta_dirty, brtvd->bv_entcount_dirty,
- (u_longlong_t)brtvd->bv_size,
- (u_longlong_t)brtvd->bv_totalcount,
- (u_longlong_t)brtvd->bv_nblocks,
- (size_t)BT_SIZEOFMAP(brtvd->bv_nblocks));
- if (brtvd->bv_totalcount > 0) {
- zfs_dbgmsg(" entcounts:");
- for (idx = 0; idx < brtvd->bv_size; idx++) {
- if (brt_vdev_entcount_get(brtvd, idx) > 0) {
- zfs_dbgmsg(" [%04llu] %hu",
- (u_longlong_t)idx,
- brt_vdev_entcount_get(brtvd, idx));
- }
+ zfs_dbgmsg(" BRT vdevid=%llu meta_dirty=%d entcount_dirty=%d "
+ "size=%llu totalcount=%llu nblocks=%llu bitmapsize=%zu\n",
+ (u_longlong_t)brtvd->bv_vdevid,
+ brtvd->bv_meta_dirty, brtvd->bv_entcount_dirty,
+ (u_longlong_t)brtvd->bv_size,
+ (u_longlong_t)brtvd->bv_totalcount,
+ (u_longlong_t)brtvd->bv_nblocks,
+ (size_t)BT_SIZEOFMAP(brtvd->bv_nblocks));
+ if (brtvd->bv_totalcount > 0) {
+ zfs_dbgmsg(" entcounts:");
+ for (idx = 0; idx < brtvd->bv_size; idx++) {
+ uint16_t entcnt = brt_vdev_entcount_get(brtvd, idx);
+ if (entcnt > 0) {
+ zfs_dbgmsg(" [%04llu] %hu",
+ (u_longlong_t)idx, entcnt);
}
}
- if (brtvd->bv_entcount_dirty) {
- char *bitmap;
+ }
+ if (brtvd->bv_entcount_dirty) {
+ char *bitmap;
- bitmap = kmem_alloc(brtvd->bv_nblocks + 1, KM_SLEEP);
- for (idx = 0; idx < brtvd->bv_nblocks; idx++) {
- bitmap[idx] =
- BT_TEST(brtvd->bv_bitmap, idx) ? 'x' : '.';
- }
- bitmap[idx] = '\0';
- zfs_dbgmsg(" bitmap: %s", bitmap);
- kmem_free(bitmap, brtvd->bv_nblocks + 1);
+ bitmap = kmem_alloc(brtvd->bv_nblocks + 1, KM_SLEEP);
+ for (idx = 0; idx < brtvd->bv_nblocks; idx++) {
+ bitmap[idx] =
+ BT_TEST(brtvd->bv_bitmap, idx) ? 'x' : '.';
}
+ bitmap[idx] = '\0';
+ zfs_dbgmsg(" dirty: %s", bitmap);
+ kmem_free(bitmap, brtvd->bv_nblocks + 1);
}
}
#endif
BT_SET(brtvd->bv_bitmap, idx);
#ifdef ZFS_DEBUG
- brt_vdev_dump(brt);
+ if (zfs_flags & ZFS_DEBUG_BRT)
+ brt_vdev_dump(brtvd);
#endif
}
BT_SET(brtvd->bv_bitmap, idx);
#ifdef ZFS_DEBUG
- brt_vdev_dump(brt);
+ if (zfs_flags & ZFS_DEBUG_BRT)
+ brt_vdev_dump(brtvd);
#endif
}