tools/first-damage: Fix struct unpack

The first field is a 64 bit integer, the script
was unpacking it as 32 bit integer. Fixed the
same.

Also printing the 'first' value in debug

Signed-off-by: Kotresh HR <khiremat@redhat.com>
This commit is contained in:
Kotresh HR 2024-05-24 13:38:24 +05:30
parent 9637ffe6f9
commit df2d65c5ae

View File

@ -85,7 +85,8 @@ def traverse(MEMO, ioctx):
nkey = None
for (dnk, val) in it:
log.debug(f'\t{dnk}: val size {len(val)}')
(first,) = struct.unpack('<I', val[:4])
(first,) = struct.unpack('<Q', val[:8])
log.debug(f'\t{dnk}: first {first}')
if first > NEXT_SNAP:
log.warning(f"found {o.key}:{dnk} first (0x{first:x}) > NEXT_SNAP (0x{NEXT_SNAP:x})")
if REPAIR_NOSNAP and dnk.endswith(b"_head") and first == CEPH_NOSNAP: