xfs: fix broken log reservation debugging
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 23 May 2019 15:45:21 +0000 (08:45 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 24 May 2019 14:32:01 +0000 (07:32 -0700)
xlog_print_tic_res() is supposed to print a human readable string for
each element of the log ticket reservation array.  Unfortunately, I
forgot to update the string array when we added rmap & reflink support,
so the debug message prints "region[3]: (null) - 352 bytes" which isn't
useful at all.  Add the missing elements and add a build check so that
we don't forget again to add a string when adding a new XLOG_REG_TYPE.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
fs/xfs/xfs_log.c

index 457ced3ee3e113b9f8eeefd3a16d8d2ef62458d2..2466b0f5b6c43f175c27e4952e1aed7a0698c607 100644 (file)
@@ -2069,7 +2069,7 @@ xlog_print_tic_res(
 
        /* match with XLOG_REG_TYPE_* in xfs_log.h */
 #define REG_TYPE_STR(type, str)        [XLOG_REG_TYPE_##type] = str
-       static char *res_type_str[XLOG_REG_TYPE_MAX + 1] = {
+       static char *res_type_str[] = {
            REG_TYPE_STR(BFORMAT, "bformat"),
            REG_TYPE_STR(BCHUNK, "bchunk"),
            REG_TYPE_STR(EFI_FORMAT, "efi_format"),
@@ -2089,8 +2089,15 @@ xlog_print_tic_res(
            REG_TYPE_STR(UNMOUNT, "unmount"),
            REG_TYPE_STR(COMMIT, "commit"),
            REG_TYPE_STR(TRANSHDR, "trans header"),
-           REG_TYPE_STR(ICREATE, "inode create")
+           REG_TYPE_STR(ICREATE, "inode create"),
+           REG_TYPE_STR(RUI_FORMAT, "rui_format"),
+           REG_TYPE_STR(RUD_FORMAT, "rud_format"),
+           REG_TYPE_STR(CUI_FORMAT, "cui_format"),
+           REG_TYPE_STR(CUD_FORMAT, "cud_format"),
+           REG_TYPE_STR(BUI_FORMAT, "bui_format"),
+           REG_TYPE_STR(BUD_FORMAT, "bud_format"),
        };
+       BUILD_BUG_ON(ARRAY_SIZE(res_type_str) != XLOG_REG_TYPE_MAX + 1);
 #undef REG_TYPE_STR
 
        xfs_warn(mp, "ticket reservation summary:");