]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_db: dump rt summary blocks
authorDarrick J. Wong <djwong@kernel.org>
Wed, 3 Jul 2024 21:22:09 +0000 (14:22 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 6 Aug 2024 12:53:50 +0000 (05:53 -0700)
Now that rtsummary blocks have a header, make it so that xfs_db can
analyze the structure.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
db/field.c
db/field.h
db/inode.c
db/rtgroup.c
db/rtgroup.h
db/type.c
db/type.h

index b4f995849738c6d4447f7f575506600486e1bf48..204e0cb0d76fc6ceb6eef6a0f8b7eab9e16e758c 100644 (file)
@@ -409,6 +409,10 @@ const ftattr_t     ftattrtab[] = {
          0, NULL, NULL },
        { FLDT_RGBITMAP, "rgbitmap", NULL, (char *)rgbitmap_flds, btblock_size,
          FTARG_SIZE, NULL, rgbitmap_flds },
+       { FLDT_SUMINFO, "suminfo", fp_num, "%u", SI(bitsz(xfs_suminfo_t)),
+         0, NULL, NULL },
+       { FLDT_RGSUMMARY, "rgsummary", NULL, (char *)rgsummary_flds,
+         btblock_size, FTARG_SIZE, NULL, rgsummary_flds },
 
        { FLDT_ZZZ, NULL }
 };
index d553d57cee5dfb556ef2a88194dec11c4b342e74..6763911c0baee96e8be81df337ee89fd88eb5b3a 100644 (file)
@@ -197,6 +197,8 @@ typedef enum fldt   {
 
        FLDT_RTWORD,
        FLDT_RGBITMAP,
+       FLDT_SUMINFO,
+       FLDT_RGSUMMARY,
 
        FLDT_ZZZ                        /* mark last entry */
 } fldt_t;
index db7780d6903389c5ec8511323ac9544f650c6c26..df46a836fc2c0704d3e1207f16c1066e4891a4d9 100644 (file)
@@ -646,8 +646,11 @@ inode_next_type(void)
                        if (xfs_has_rtgroups(mp))
                                return TYP_RGBITMAP;
                        return TYP_RTBITMAP;
-               } else if (iocur_top->ino == mp->m_sb.sb_rsumino)
+               } else if (iocur_top->ino == mp->m_sb.sb_rsumino) {
+                       if (xfs_has_rtgroups(mp))
+                               return TYP_RGSUMMARY;
                        return TYP_RTSUMMARY;
+               }
                else if (iocur_top->ino == mp->m_sb.sb_uquotino ||
                         iocur_top->ino == mp->m_sb.sb_gquotino ||
                         iocur_top->ino == mp->m_sb.sb_pquotino)
index 3ef2dc8fe7f03107c62594c120c2183f8c076534..c6b96c9dc79daa65767327c4b0b647e15cf9d79b 100644 (file)
@@ -132,3 +132,23 @@ const field_t      rgbitmap_hfld[] = {
        { "", FLDT_RGBITMAP, OI(0), C1, 0, TYP_NONE },
        { NULL }
 };
+
+#define        OFF(f)  bitize(offsetof(struct xfs_rtbuf_blkinfo, rt_ ## f))
+const field_t  rgsummary_flds[] = {
+       { "magicnum", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
+       { "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
+       { "owner", FLDT_INO, OI(OFF(owner)), C1, 0, TYP_NONE },
+       { "bno", FLDT_DFSBNO, OI(OFF(blkno)), C1, 0, TYP_BMAPBTD },
+       { "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
+       { "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE },
+       /* the suminfo array is after the actual structure */
+       { "suminfo", FLDT_SUMINFO, OI(bitize(sizeof(struct xfs_rtbuf_blkinfo))),
+         rtwords_count, FLD_ARRAY | FLD_COUNT, TYP_DATA },
+       { NULL }
+};
+#undef OFF
+
+const field_t  rgsummary_hfld[] = {
+       { "", FLDT_RGSUMMARY, OI(0), C1, 0, TYP_NONE },
+       { NULL }
+};
index 06f554e186285177ca13686571250e70c4eab027..5b120f2c9a29f334ff05648760fb780884131cc5 100644 (file)
@@ -12,6 +12,9 @@ extern const struct field     rtsb_hfld[];
 extern const struct field      rgbitmap_flds[];
 extern const struct field      rgbitmap_hfld[];
 
+extern const struct field      rgsummary_flds[];
+extern const struct field      rgsummary_hfld[];
+
 extern void    rtsb_init(void);
 extern int     rtsb_size(void *obj, int startoff, int idx);
 
index 65e7b24146f17072469f3bc2b398bc05a288a5b7..2091b4ac8b139b4daa3548d161fbdf977b4da12a 100644 (file)
--- a/db/type.c
+++ b/db/type.c
@@ -68,6 +68,7 @@ static const typ_t    __typtab[] = {
        { TYP_FINOBT, "finobt", handle_struct, finobt_hfld, NULL,
                TYP_F_NO_CRC_OFF },
        { TYP_RGBITMAP, NULL },
+       { TYP_RGSUMMARY, NULL },
        { TYP_NONE, NULL }
 };
 
@@ -116,6 +117,8 @@ static const typ_t  __typtab_crc[] = {
                &xfs_finobt_buf_ops, XFS_BTREE_SBLOCK_CRC_OFF },
        { TYP_RGBITMAP, "rgbitmap", handle_struct, rgbitmap_hfld,
                &xfs_rtbitmap_buf_ops, XFS_RTBUF_CRC_OFF },
+       { TYP_RGSUMMARY, "rgsummary", handle_struct, rgsummary_hfld,
+               &xfs_rtsummary_buf_ops, XFS_RTBUF_CRC_OFF },
        { TYP_NONE, NULL }
 };
 
@@ -164,6 +167,8 @@ static const typ_t  __typtab_spcrc[] = {
                &xfs_finobt_buf_ops, XFS_BTREE_SBLOCK_CRC_OFF },
        { TYP_RGBITMAP, "rgbitmap", handle_struct, rgbitmap_hfld,
                &xfs_rtbitmap_buf_ops, XFS_RTBUF_CRC_OFF },
+       { TYP_RGSUMMARY, "rgsummary", handle_struct, rgsummary_hfld,
+               &xfs_rtsummary_buf_ops, XFS_RTBUF_CRC_OFF },
        { TYP_NONE, NULL }
 };
 
index e2148c6351d1411c8aa4bb4498e9951de231c940..e7f0ecc17680bf24d9fc1c04506063f690b6669b 100644 (file)
--- a/db/type.h
+++ b/db/type.h
@@ -36,6 +36,7 @@ typedef enum typnm
        TYP_TEXT,
        TYP_FINOBT,
        TYP_RGBITMAP,
+       TYP_RGSUMMARY,
        TYP_NONE
 } typnm_t;