mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 03:19:35 +03:00
zdb: dump ZAP_FLAG_UINT64_KEY ZAPs properly (#16334)
These are used for DDT and BRT stores. There's limited information available to produce meaningful output, but at least we can put something on screen rather than crashing. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tony Hutter <hutter2@llnl.gov>
This commit is contained in:
parent
5de3ac2236
commit
dc91e74524
@ -48,6 +48,7 @@
|
|||||||
#include <sys/spa_impl.h>
|
#include <sys/spa_impl.h>
|
||||||
#include <sys/dmu.h>
|
#include <sys/dmu.h>
|
||||||
#include <sys/zap.h>
|
#include <sys/zap.h>
|
||||||
|
#include <sys/zap_impl.h>
|
||||||
#include <sys/fs/zfs.h>
|
#include <sys/fs/zfs.h>
|
||||||
#include <sys/zfs_znode.h>
|
#include <sys/zfs_znode.h>
|
||||||
#include <sys/zfs_sa.h>
|
#include <sys/zfs_sa.h>
|
||||||
@ -1126,16 +1127,33 @@ dump_zap(objset_t *os, uint64_t object, void *data, size_t size)
|
|||||||
for (zap_cursor_init(&zc, os, object);
|
for (zap_cursor_init(&zc, os, object);
|
||||||
zap_cursor_retrieve(&zc, &attr) == 0;
|
zap_cursor_retrieve(&zc, &attr) == 0;
|
||||||
zap_cursor_advance(&zc)) {
|
zap_cursor_advance(&zc)) {
|
||||||
|
boolean_t key64 =
|
||||||
|
!!(zap_getflags(zc.zc_zap) & ZAP_FLAG_UINT64_KEY);
|
||||||
|
|
||||||
|
if (key64)
|
||||||
|
(void) printf("\t\t0x%010lx = ",
|
||||||
|
*(uint64_t *)attr.za_name);
|
||||||
|
else
|
||||||
(void) printf("\t\t%s = ", attr.za_name);
|
(void) printf("\t\t%s = ", attr.za_name);
|
||||||
|
|
||||||
if (attr.za_num_integers == 0) {
|
if (attr.za_num_integers == 0) {
|
||||||
(void) printf("\n");
|
(void) printf("\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
prop = umem_zalloc(attr.za_num_integers *
|
prop = umem_zalloc(attr.za_num_integers *
|
||||||
attr.za_integer_length, UMEM_NOFAIL);
|
attr.za_integer_length, UMEM_NOFAIL);
|
||||||
|
|
||||||
|
if (key64)
|
||||||
|
(void) zap_lookup_uint64(os, object,
|
||||||
|
(const uint64_t *)attr.za_name, 1,
|
||||||
|
attr.za_integer_length, attr.za_num_integers,
|
||||||
|
prop);
|
||||||
|
else
|
||||||
(void) zap_lookup(os, object, attr.za_name,
|
(void) zap_lookup(os, object, attr.za_name,
|
||||||
attr.za_integer_length, attr.za_num_integers, prop);
|
attr.za_integer_length, attr.za_num_integers,
|
||||||
if (attr.za_integer_length == 1) {
|
prop);
|
||||||
|
|
||||||
|
if (attr.za_integer_length == 1 && !key64) {
|
||||||
if (strcmp(attr.za_name,
|
if (strcmp(attr.za_name,
|
||||||
DSL_CRYPTO_KEY_MASTER_KEY) == 0 ||
|
DSL_CRYPTO_KEY_MASTER_KEY) == 0 ||
|
||||||
strcmp(attr.za_name,
|
strcmp(attr.za_name,
|
||||||
@ -1154,6 +1172,10 @@ dump_zap(objset_t *os, uint64_t object, void *data, size_t size)
|
|||||||
} else {
|
} else {
|
||||||
for (i = 0; i < attr.za_num_integers; i++) {
|
for (i = 0; i < attr.za_num_integers; i++) {
|
||||||
switch (attr.za_integer_length) {
|
switch (attr.za_integer_length) {
|
||||||
|
case 1:
|
||||||
|
(void) printf("%u ",
|
||||||
|
((uint8_t *)prop)[i]);
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
(void) printf("%u ",
|
(void) printf("%u ",
|
||||||
((uint16_t *)prop)[i]);
|
((uint16_t *)prop)[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user