[PATCH 20/22] xfs_logprint: report realtime CUIs

Darrick J. Wong
2025-02-06T23:01:59Z

Decode the CUI format just enough to report if an CUI targets the
realtime device or not.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
logprint/log_misc.c | 2 ++
logprint/log_print_all.c | 8 ++++++++
logprint/log_redo.c | 24 +++++++++++++++++++-----
3 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/logprint/log_misc.c b/logprint/log_misc.c
index aaa9598616a308..144695753211aa 100644
--- a/logprint/log_misc.c
+++ b/logprint/log_misc.c
@@ -1027,12 +1027,14 @@ xlog_print_record(
be32_to_cpu(op_head->oh_len));
break;
}
+ case XFS_LI_CUI_RT:
case XFS_LI_CUI: {
skip = xlog_print_trans_cui(&ptr,
be32_to_cpu(op_head->oh_len),
continued);
break;
}
+ case XFS_LI_CUD_RT:
case XFS_LI_CUD: {
skip = xlog_print_trans_cud(&ptr,
be32_to_cpu(op_head->oh_len));
diff --git a/logprint/log_print_all.c b/logprint/log_print_all.c
index 56e765d64f2df4..1498ef97247d3d 100644
--- a/logprint/log_print_all.c
+++ b/logprint/log_print_all.c
@@ -430,9 +430,11 @@ xlog_recover_print_logitem(
case XFS_LI_RUI:
xlog_recover_print_rui(item);
break;
+ case XFS_LI_CUD_RT:
case XFS_LI_CUD:
xlog_recover_print_cud(item);
break;
+ case XFS_LI_CUI_RT:
case XFS_LI_CUI:
xlog_recover_print_cui(item);
break;
@@ -512,6 +514,12 @@ xlog_recover_print_item(
case XFS_LI_CUI:
printf("CUI");
break;
+ case XFS_LI_CUD_RT:
+ printf("CUD_RT");
+ break;
+ case XFS_LI_CUI_RT:
+ printf("CUI_RT");
+ break;
case XFS_LI_BUD:
printf("BUD");
break;
diff --git a/logprint/log_redo.c b/logprint/log_redo.c
index a0cc558499ae0b..89d7448342b33d 100644
--- a/logprint/log_redo.c
+++ b/logprint/log_redo.c
@@ -440,6 +440,7 @@ xlog_print_trans_cui(
uint src_len,
int continued)
{
+ const char *item_name = "CUI?";
struct xfs_cui_log_format *src_f, *f = NULL;
uint dst_len;
uint nextents;
@@ -480,8 +481,14 @@ xlog_print_trans_cui(
goto error;
}

- printf(_("CUI: #regs: %d num_extents: %d id: 0x%llx\n"),
- f->cui_size, f->cui_nextents, (unsigned long long)f->cui_id);
+ switch (f->cui_type) {
+ case XFS_LI_CUI: item_name = "CUI"; break;
+ case XFS_LI_CUI_RT: item_name = "CUI_RT"; break;
+ }
+
+ printf(_("%s: #regs: %d num_extents: %d id: 0x%llx\n"),
+ item_name, f->cui_size, f->cui_nextents,
+ (unsigned long long)f->cui_id);

if (continued) {
printf(_("CUI extent data skipped (CONTINUE set, no space)\n"));
@@ -520,6 +527,7 @@ xlog_print_trans_cud(
char **ptr,
uint len)
{
+ const char *item_name = "CUD?";
struct xfs_cud_log_format *f;
struct xfs_cud_log_format lbuf;

@@ -528,11 +536,17 @@ xlog_print_trans_cud(

memcpy(&lbuf, *ptr, min(core_size, len));
f = &lbuf;
+
+ switch (f->cud_type) {
+ case XFS_LI_CUD: item_name = "CUD"; break;
+ case XFS_LI_CUD_RT: item_name = "CUD_RT"; break;
+ }
+
*ptr += len;
if (len >= core_size) {
- printf(_("CUD: #regs: %d id: 0x%llx\n"),
- f->cud_size,
- (unsigned long long)f->cud_cui_id);
+ printf(_("%s: #regs: %d id: 0x%llx\n"),
+ item_name, f->cud_size,
+ (unsigned long long)f->cud_cui_id);

/* don't print extents as they are not used */