mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-12 08:00:09 +00:00
xfs: use named array initializers for log item dumping
Use named array initializers for the string arrays used to dump log items, rather than depending on the order being maintained correctly. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
49ca9118e6
commit
5110cd82ca
132
fs/xfs/xfs_log.c
132
fs/xfs/xfs_log.c
@ -2008,77 +2008,81 @@ xlog_print_tic_res(
|
|||||||
uint ophdr_spc = ticket->t_res_num_ophdrs * (uint)sizeof(xlog_op_header_t);
|
uint ophdr_spc = ticket->t_res_num_ophdrs * (uint)sizeof(xlog_op_header_t);
|
||||||
|
|
||||||
/* match with XLOG_REG_TYPE_* in xfs_log.h */
|
/* match with XLOG_REG_TYPE_* in xfs_log.h */
|
||||||
static char *res_type_str[XLOG_REG_TYPE_MAX] = {
|
#define REG_TYPE_STR(type, str) [XLOG_REG_TYPE_##type] = str
|
||||||
"bformat",
|
static char *res_type_str[XLOG_REG_TYPE_MAX + 1] = {
|
||||||
"bchunk",
|
REG_TYPE_STR(BFORMAT, "bformat"),
|
||||||
"efi_format",
|
REG_TYPE_STR(BCHUNK, "bchunk"),
|
||||||
"efd_format",
|
REG_TYPE_STR(EFI_FORMAT, "efi_format"),
|
||||||
"iformat",
|
REG_TYPE_STR(EFD_FORMAT, "efd_format"),
|
||||||
"icore",
|
REG_TYPE_STR(IFORMAT, "iformat"),
|
||||||
"iext",
|
REG_TYPE_STR(ICORE, "icore"),
|
||||||
"ibroot",
|
REG_TYPE_STR(IEXT, "iext"),
|
||||||
"ilocal",
|
REG_TYPE_STR(IBROOT, "ibroot"),
|
||||||
"iattr_ext",
|
REG_TYPE_STR(ILOCAL, "ilocal"),
|
||||||
"iattr_broot",
|
REG_TYPE_STR(IATTR_EXT, "iattr_ext"),
|
||||||
"iattr_local",
|
REG_TYPE_STR(IATTR_BROOT, "iattr_broot"),
|
||||||
"qformat",
|
REG_TYPE_STR(IATTR_LOCAL, "iattr_local"),
|
||||||
"dquot",
|
REG_TYPE_STR(QFORMAT, "qformat"),
|
||||||
"quotaoff",
|
REG_TYPE_STR(DQUOT, "dquot"),
|
||||||
"LR header",
|
REG_TYPE_STR(QUOTAOFF, "quotaoff"),
|
||||||
"unmount",
|
REG_TYPE_STR(LRHEADER, "LR header"),
|
||||||
"commit",
|
REG_TYPE_STR(UNMOUNT, "unmount"),
|
||||||
"trans header"
|
REG_TYPE_STR(COMMIT, "commit"),
|
||||||
|
REG_TYPE_STR(TRANSHDR, "trans header"),
|
||||||
|
REG_TYPE_STR(ICREATE, "inode create")
|
||||||
};
|
};
|
||||||
|
#undef REG_TYPE_STR
|
||||||
|
#define TRANS_TYPE_STR(type) [XFS_TRANS_##type] = #type
|
||||||
static char *trans_type_str[XFS_TRANS_TYPE_MAX] = {
|
static char *trans_type_str[XFS_TRANS_TYPE_MAX] = {
|
||||||
"SETATTR_NOT_SIZE",
|
TRANS_TYPE_STR(SETATTR_NOT_SIZE),
|
||||||
"SETATTR_SIZE",
|
TRANS_TYPE_STR(SETATTR_SIZE),
|
||||||
"INACTIVE",
|
TRANS_TYPE_STR(INACTIVE),
|
||||||
"CREATE",
|
TRANS_TYPE_STR(CREATE),
|
||||||
"CREATE_TRUNC",
|
TRANS_TYPE_STR(CREATE_TRUNC),
|
||||||
"TRUNCATE_FILE",
|
TRANS_TYPE_STR(TRUNCATE_FILE),
|
||||||
"REMOVE",
|
TRANS_TYPE_STR(REMOVE),
|
||||||
"LINK",
|
TRANS_TYPE_STR(LINK),
|
||||||
"RENAME",
|
TRANS_TYPE_STR(RENAME),
|
||||||
"MKDIR",
|
TRANS_TYPE_STR(MKDIR),
|
||||||
"RMDIR",
|
TRANS_TYPE_STR(RMDIR),
|
||||||
"SYMLINK",
|
TRANS_TYPE_STR(SYMLINK),
|
||||||
"SET_DMATTRS",
|
TRANS_TYPE_STR(SET_DMATTRS),
|
||||||
"GROWFS",
|
TRANS_TYPE_STR(GROWFS),
|
||||||
"STRAT_WRITE",
|
TRANS_TYPE_STR(STRAT_WRITE),
|
||||||
"DIOSTRAT",
|
TRANS_TYPE_STR(DIOSTRAT),
|
||||||
"WRITE_SYNC",
|
TRANS_TYPE_STR(WRITEID),
|
||||||
"WRITEID",
|
TRANS_TYPE_STR(ADDAFORK),
|
||||||
"ADDAFORK",
|
TRANS_TYPE_STR(ATTRINVAL),
|
||||||
"ATTRINVAL",
|
TRANS_TYPE_STR(ATRUNCATE),
|
||||||
"ATRUNCATE",
|
TRANS_TYPE_STR(ATTR_SET),
|
||||||
"ATTR_SET",
|
TRANS_TYPE_STR(ATTR_RM),
|
||||||
"ATTR_RM",
|
TRANS_TYPE_STR(ATTR_FLAG),
|
||||||
"ATTR_FLAG",
|
TRANS_TYPE_STR(CLEAR_AGI_BUCKET),
|
||||||
"CLEAR_AGI_BUCKET",
|
TRANS_TYPE_STR(SB_CHANGE),
|
||||||
"QM_SBCHANGE",
|
TRANS_TYPE_STR(DUMMY1),
|
||||||
"DUMMY1",
|
TRANS_TYPE_STR(DUMMY2),
|
||||||
"DUMMY2",
|
TRANS_TYPE_STR(QM_QUOTAOFF),
|
||||||
"QM_QUOTAOFF",
|
TRANS_TYPE_STR(QM_DQALLOC),
|
||||||
"QM_DQALLOC",
|
TRANS_TYPE_STR(QM_SETQLIM),
|
||||||
"QM_SETQLIM",
|
TRANS_TYPE_STR(QM_DQCLUSTER),
|
||||||
"QM_DQCLUSTER",
|
TRANS_TYPE_STR(QM_QINOCREATE),
|
||||||
"QM_QINOCREATE",
|
TRANS_TYPE_STR(QM_QUOTAOFF_END),
|
||||||
"QM_QUOTAOFF_END",
|
TRANS_TYPE_STR(FSYNC_TS),
|
||||||
"FSYNC_TS",
|
TRANS_TYPE_STR(GROWFSRT_ALLOC),
|
||||||
"GROWFSRT_ALLOC",
|
TRANS_TYPE_STR(GROWFSRT_ZERO),
|
||||||
"GROWFSRT_ZERO",
|
TRANS_TYPE_STR(GROWFSRT_FREE),
|
||||||
"GROWFSRT_FREE",
|
TRANS_TYPE_STR(SWAPEXT),
|
||||||
"SWAPEXT",
|
TRANS_TYPE_STR(CHECKPOINT),
|
||||||
"CHECKPOINT",
|
TRANS_TYPE_STR(ICREATE),
|
||||||
"ICREATE",
|
TRANS_TYPE_STR(CREATE_TMPFILE)
|
||||||
"CREATE_TMPFILE"
|
|
||||||
};
|
};
|
||||||
|
#undef TRANS_TYPE_STR
|
||||||
|
|
||||||
xfs_warn(mp, "xlog_write: reservation summary:");
|
xfs_warn(mp, "xlog_write: reservation summary:");
|
||||||
xfs_warn(mp, " trans type = %s (%u)",
|
xfs_warn(mp, " trans type = %s (%u)",
|
||||||
((ticket->t_trans_type <= 0 ||
|
((ticket->t_trans_type <= 0 ||
|
||||||
ticket->t_trans_type > XFS_TRANS_TYPE_MAX) ?
|
ticket->t_trans_type > XFS_TRANS_TYPE_MAX) ?
|
||||||
"bad-trans-type" : trans_type_str[ticket->t_trans_type-1]),
|
"bad-trans-type" : trans_type_str[ticket->t_trans_type]),
|
||||||
ticket->t_trans_type);
|
ticket->t_trans_type);
|
||||||
xfs_warn(mp, " unit res = %d bytes",
|
xfs_warn(mp, " unit res = %d bytes",
|
||||||
ticket->t_unit_res);
|
ticket->t_unit_res);
|
||||||
@ -2097,7 +2101,7 @@ xlog_print_tic_res(
|
|||||||
uint r_type = ticket->t_res_arr[i].r_type;
|
uint r_type = ticket->t_res_arr[i].r_type;
|
||||||
xfs_warn(mp, "region[%u]: %s - %u bytes", i,
|
xfs_warn(mp, "region[%u]: %s - %u bytes", i,
|
||||||
((r_type <= 0 || r_type > XLOG_REG_TYPE_MAX) ?
|
((r_type <= 0 || r_type > XLOG_REG_TYPE_MAX) ?
|
||||||
"bad-rtype" : res_type_str[r_type-1]),
|
"bad-rtype" : res_type_str[r_type]),
|
||||||
ticket->t_res_arr[i].r_len);
|
ticket->t_res_arr[i].r_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user