diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index f9c3f9ea6..d65cd3a23 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -94,6 +94,13 @@ (idx) == DMU_OTN_UINT64_DATA || (idx) == DMU_OTN_UINT64_METADATA ? \ DMU_OT_UINT64_OTHER : DMU_OT_NUMTYPES) +/* Some platforms require part of inode IDs to be remapped */ +#ifdef __APPLE__ +#define ZDB_MAP_OBJECT_ID(obj) INO_XNUTOZFS(obj, 2) +#else +#define ZDB_MAP_OBJECT_ID(obj) (obj) +#endif + static char * zdb_ot_name(dmu_object_type_t type) { @@ -3631,6 +3638,7 @@ parse_object_range(char *range, zopt_object_range_t *zor, char **msg) *msg = "Invalid characters in object ID"; rc = 1; } + zor->zor_obj_start = ZDB_MAP_OBJECT_ID(zor->zor_obj_start); zor->zor_obj_end = zor->zor_obj_start; return (rc); } @@ -3709,6 +3717,9 @@ parse_object_range(char *range, zopt_object_range_t *zor, char **msg) } zor->zor_flags = flags; + zor->zor_obj_start = ZDB_MAP_OBJECT_ID(zor->zor_obj_start); + zor->zor_obj_end = ZDB_MAP_OBJECT_ID(zor->zor_obj_end); + out: free(dup); return (rc);