The sparse inode feature uses a different on-disk inobt record format.
Define the new record format in the xfs_db type infrastructure and use
this definition for fs' that support sparse inodes.
Also update the superblock type structure with the sb_spino_align field.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
{ NULL }
};
+const field_t inobt_spcrc_hfld[] = {
+ { "", FLDT_INOBT_SPCRC, OI(0), C1, 0, TYP_NONE },
+ { NULL }
+};
+
#define OFF(f) bitize(offsetof(struct xfs_btree_block, bb_ ## f))
const field_t inobt_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_INOBT },
{ NULL }
};
+const field_t inobt_spcrc_flds[] = {
+ { "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
+ { "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
+ { "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
+ { "leftsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_leftsib)), C1, 0, TYP_INOBT },
+ { "rightsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_rightsib)), C1, 0, TYP_INOBT },
+ { "bno", FLDT_DFSBNO, OI(OFF(u.s.bb_blkno)), C1, 0, TYP_INOBT },
+ { "lsn", FLDT_UINT64X, OI(OFF(u.s.bb_lsn)), C1, 0, TYP_NONE },
+ { "uuid", FLDT_UUID, OI(OFF(u.s.bb_uuid)), C1, 0, TYP_NONE },
+ { "owner", FLDT_AGNUMBER, OI(OFF(u.s.bb_owner)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
+ { "recs", FLDT_INOBTSPREC, btblock_rec_offset, btblock_rec_count,
+ FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
+ { "keys", FLDT_INOBTKEY, btblock_key_offset, btblock_key_count,
+ FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
+ { "ptrs", FLDT_INOBTPTR, btblock_ptr_offset, btblock_key_count,
+ FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_INOBT },
+ { NULL }
+};
+
#undef OFF
#define KOFF(f) bitize(offsetof(xfs_inobt_key_t, ir_ ## f))
{ "free", FLDT_INOFREE, OI(ROFF(ir_free)), C1, 0, TYP_NONE },
{ NULL }
};
+/* sparse inode on-disk format */
+const field_t inobt_sprec_flds[] = {
+ { "startino", FLDT_AGINO, OI(ROFF(ir_startino)), C1, 0, TYP_INODE },
+ { "holemask", FLDT_UINT16X, OI(ROFF(ir_u.sp.ir_holemask)), C1, 0,
+ TYP_NONE },
+ { "count", FLDT_UINT8D, OI(ROFF(ir_u.sp.ir_count)), C1, 0, TYP_NONE },
+ { "freecount", FLDT_INT8D, OI(ROFF(ir_u.sp.ir_freecount)), C1, 0,
+ TYP_NONE },
+ { "free", FLDT_INOFREE, OI(ROFF(ir_free)), C1, 0, TYP_NONE },
+ { NULL }
+};
#undef ROFF
extern const struct field inobt_flds[];
extern const struct field inobt_hfld[];
extern const struct field inobt_crc_flds[];
+extern const struct field inobt_spcrc_flds[];
extern const struct field inobt_crc_hfld[];
+extern const struct field inobt_spcrc_hfld[];
extern const struct field inobt_key_flds[];
extern const struct field inobt_rec_flds[];
+extern const struct field inobt_sprec_flds[];
extern const struct field bnobt_flds[];
extern const struct field bnobt_hfld[];
FTARG_SIZE, NULL, inobt_flds },
{ FLDT_INOBT_CRC, "inobt", NULL, (char *)inobt_crc_flds, btblock_size,
FTARG_SIZE, NULL, inobt_crc_flds },
+ { FLDT_INOBT_SPCRC, "inobt", NULL, (char *)inobt_spcrc_flds,
+ btblock_size, FTARG_SIZE, NULL, inobt_spcrc_flds },
{ FLDT_INOBTKEY, "inobtkey", fp_sarray, (char *)inobt_key_flds,
SI(bitsz(xfs_inobt_key_t)), 0, NULL, inobt_key_flds },
{ FLDT_INOBTPTR, "inobtptr", fp_num, "%u", SI(bitsz(xfs_inobt_ptr_t)),
0, fa_agblock, NULL },
{ FLDT_INOBTREC, "inobtrec", fp_sarray, (char *)inobt_rec_flds,
SI(bitsz(xfs_inobt_rec_t)), 0, NULL, inobt_rec_flds },
+ { FLDT_INOBTSPREC, "inobtsprec", fp_sarray, (char *) inobt_sprec_flds,
+ SI(bitsz(xfs_inobt_rec_t)), 0, NULL, inobt_sprec_flds },
{ FLDT_INODE, "inode", NULL, (char *)inode_flds, inode_size, FTARG_SIZE,
NULL, inode_flds },
{ FLDT_INODE_CRC, "inode", NULL, (char *)inode_crc_flds, inode_size,
FLDT_INO,
FLDT_INOBT,
FLDT_INOBT_CRC,
+ FLDT_INOBT_SPCRC,
FLDT_INOBTKEY,
FLDT_INOBTPTR,
FLDT_INOBTREC,
+ FLDT_INOBTSPREC,
FLDT_INODE,
FLDT_INODE_CRC,
FLDT_INOFREE,
}
}
- if (xfs_sb_version_hascrc(&mp->m_sb))
+ if (xfs_sb_version_hassparseinodes(&mp->m_sb))
+ type_set_tab_spcrc();
+ else if (xfs_sb_version_hascrc(&mp->m_sb))
type_set_tab_crc();
push_cur();
{ "features_log_incompat", FLDT_UINT32X, OI(OFF(features_log_incompat)),
C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
+ { "spino_align", FLDT_EXTLEN, OI(OFF(spino_align)), C1, 0, TYP_NONE },
{ "pquotino", FLDT_INO, OI(OFF(pquotino)), C1, 0, TYP_INODE },
{ "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
{ NULL }
{ TYP_NONE, NULL }
};
+static const typ_t __typtab_spcrc[] = {
+ { TYP_AGF, "agf", handle_struct, agf_hfld, &xfs_agf_buf_ops },
+ { TYP_AGFL, "agfl", handle_struct, agfl_crc_hfld, &xfs_agfl_buf_ops },
+ { TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agfl_buf_ops },
+ { TYP_ATTR, "attr3", handle_struct, attr3_hfld,
+ &xfs_attr3_db_buf_ops },
+ { TYP_BMAPBTA, "bmapbta", handle_struct, bmapbta_crc_hfld,
+ &xfs_bmbt_buf_ops },
+ { TYP_BMAPBTD, "bmapbtd", handle_struct, bmapbtd_crc_hfld,
+ &xfs_bmbt_buf_ops },
+ { TYP_BNOBT, "bnobt", handle_struct, bnobt_crc_hfld,
+ &xfs_allocbt_buf_ops },
+ { TYP_CNTBT, "cntbt", handle_struct, cntbt_crc_hfld,
+ &xfs_allocbt_buf_ops },
+ { TYP_DATA, "data", handle_block, NULL, NULL },
+ { TYP_DIR2, "dir3", handle_struct, dir3_hfld,
+ &xfs_dir3_db_buf_ops },
+ { TYP_DQBLK, "dqblk", handle_struct, dqblk_hfld,
+ &xfs_dquot_buf_ops },
+ { TYP_INOBT, "inobt", handle_struct, inobt_spcrc_hfld,
+ &xfs_inobt_buf_ops },
+ { TYP_INODATA, "inodata", NULL, NULL, NULL },
+ { TYP_INODE, "inode", handle_struct, inode_crc_hfld,
+ &xfs_inode_buf_ops },
+ { TYP_LOG, "log", NULL, NULL, NULL },
+ { TYP_RTBITMAP, "rtbitmap", NULL, NULL, NULL },
+ { TYP_RTSUMMARY, "rtsummary", NULL, NULL, NULL },
+ { TYP_SB, "sb", handle_struct, sb_hfld, &xfs_sb_buf_ops },
+ { TYP_SYMLINK, "symlink", handle_struct, symlink_crc_hfld,
+ &xfs_symlink_buf_ops },
+ { TYP_TEXT, "text", handle_text, NULL, NULL },
+ { TYP_NONE, NULL }
+};
+
const typ_t *typtab = __typtab;
void
typtab = __typtab_crc;
}
+void
+type_set_tab_spcrc(void)
+{
+ typtab = __typtab_spcrc;
+}
+
static const typ_t *
findtyp(
char *name)
extern void type_init(void);
extern void type_set_tab_crc(void);
+extern void type_set_tab_spcrc(void);
extern void handle_block(int action, const struct field *fields, int argc,
char **argv);
extern void handle_string(int action, const struct field *fields, int argc,