Skip to contentSkip to conversation

xfs_db: fix finobt record decoding when sparse inodes enabled

PATCH In review Darrick J. Wong 2 participants 2 messages Dec 31, 2018 – Jan 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_db: fix finobt record decoding when sparse inodes enabled

From: Darrick J. Wong <[email protected]>

Use the sparse inobt record field decoder (inobt_spcrc_hfld) to decode finobt records when sparse inodes are enabled. Otherwise, xfs_db prints out bogus things like:

recs[1] = [startino,freecount,free]
1:[214720,16429,0xfffffffffff80000]

There can never be 16429 records in an inode btree record; instead it should print:

recs[1] = [startino,holemask,count,freecount,free] 1:[214720,0,64,45,0xfffffffffff80000]

---
 db/type.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
db/type.c +1 -1
index d0234c57..f5f65042 100644
@@ -151,7 +151,7 @@ static const typ_t	__typtab_spcrc[] = {
 	{ TYP_SYMLINK, "symlink", handle_struct, symlink_crc_hfld,
 		&xfs_symlink_buf_ops, XFS_SYMLINK_CRC_OFF },
 	{ TYP_TEXT, "text", handle_text, NULL, NULL, TYP_F_NO_CRC_OFF },
-	{ TYP_FINOBT, "finobt", handle_struct, inobt_crc_hfld,
+	{ TYP_FINOBT, "finobt", handle_struct, inobt_spcrc_hfld,
 		&xfs_inobt_buf_ops, XFS_BTREE_SBLOCK_CRC_OFF },
 	{ TYP_NONE, NULL }
 };
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Use the sparse inobt record field decoder (inobt_spcrc_hfld) to decode finobt records when sparse inodes are enabled. Otherwise, xfs_db prints out bogus things like:

recs[1] = [startino,freecount,free]
1:[214720,16429,0xfffffffffff80000]

There can never be 16429 records in an inode btree record; instead it should print:

recs[1] = [startino,holemask,count,freecount,free] 1:[214720,0,64,45,0xfffffffffff80000]

---
 db/type.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
db/type.c +0 -0
index d0234c57..f5f65042 100644

db/type.c static const typ_t __typtab_spcrc[] = { · line 157

Quoted 8 lines
db/type.c +1 -1
@@ -151,7 +151,7 @@ static const typ_t	__typtab_spcrc[] = {
 	{ TYP_SYMLINK, "symlink", handle_struct, symlink_crc_hfld,
 		&xfs_symlink_buf_ops, XFS_SYMLINK_CRC_OFF },
 	{ TYP_TEXT, "text", handle_text, NULL, NULL, TYP_F_NO_CRC_OFF },
-	{ TYP_FINOBT, "finobt", handle_struct, inobt_crc_hfld,
+	{ TYP_FINOBT, "finobt", handle_struct, inobt_spcrc_hfld,
 		&xfs_inobt_buf_ops, XFS_BTREE_SBLOCK_CRC_OFF },
 	{ TYP_NONE, NULL }
 };

Looks fine.

Signature · 2 lines
Dave Chinner
[email protected]