[PATCH 25/27] xfs_logprint: report realtime RUIs

Darrick J. Wong
2025-02-06T22:56:15Z

Decode the RUI format just enough to report if an RUI 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 8336f26e093310..aaa9598616a308 100644
--- a/logprint/log_misc.c
+++ b/logprint/log_misc.c
@@ -1014,12 +1014,14 @@ xlog_print_record(
be32_to_cpu(op_head->oh_len));
break;
}
+ case XFS_LI_RUI_RT:
case XFS_LI_RUI: {
skip = xlog_print_trans_rui(&ptr,
be32_to_cpu(op_head->oh_len),
continued);
break;
}
+ case XFS_LI_RUD_RT:
case XFS_LI_RUD: {
skip = xlog_print_trans_rud(&ptr,
be32_to_cpu(op_head->oh_len));
diff --git a/logprint/log_print_all.c b/logprint/log_print_all.c
index ed5f234975ccad..56e765d64f2df4 100644
--- a/logprint/log_print_all.c
+++ b/logprint/log_print_all.c
@@ -422,9 +422,11 @@ xlog_recover_print_logitem(
case XFS_LI_ATTRI:
xlog_recover_print_attri(item);
break;
+ case XFS_LI_RUD_RT:
case XFS_LI_RUD:
xlog_recover_print_rud(item);
break;
+ case XFS_LI_RUI_RT:
case XFS_LI_RUI:
xlog_recover_print_rui(item);
break;
@@ -498,6 +500,12 @@ xlog_recover_print_item(
case XFS_LI_RUI:
printf("RUI");
break;
+ case XFS_LI_RUD_RT:
+ printf("RUD_RT");
+ break;
+ case XFS_LI_RUI_RT:
+ printf("RUI_RT");
+ break;
case XFS_LI_CUD:
printf("CUD");
break;
diff --git a/logprint/log_redo.c b/logprint/log_redo.c
index 41e7c94a52dc21..a0cc558499ae0b 100644
--- a/logprint/log_redo.c
+++ b/logprint/log_redo.c
@@ -274,6 +274,7 @@ xlog_print_trans_rui(
uint src_len,
int continued)
{
+ const char *item_name = "RUI?";
struct xfs_rui_log_format *src_f, *f = NULL;
uint dst_len;
uint nextents;
@@ -318,8 +319,14 @@ xlog_print_trans_rui(
goto error;
}

- printf(_("RUI: #regs: %d num_extents: %d id: 0x%llx\n"),
- f->rui_size, f->rui_nextents, (unsigned long long)f->rui_id);
+ switch (f->rui_type) {
+ case XFS_LI_RUI: item_name = "RUI"; break;
+ case XFS_LI_RUI_RT: item_name = "RUI_RT"; break;
+ }
+
+ printf(_("%s: #regs: %d num_extents: %d id: 0x%llx\n"),
+ item_name, f->rui_size, f->rui_nextents,
+ (unsigned long long)f->rui_id);

if (continued) {
printf(_("RUI extent data skipped (CONTINUE set, no space)\n"));
@@ -359,6 +366,7 @@ xlog_print_trans_rud(
char **ptr,
uint len)
{
+ const char *item_name = "RUD?";
struct xfs_rud_log_format *f;
struct xfs_rud_log_format lbuf;

@@ -371,11 +379,17 @@ xlog_print_trans_rud(
*/
memmove(&lbuf, *ptr, min(core_size, len));
f = &lbuf;
+
+ switch (f->rud_type) {
+ case XFS_LI_RUD: item_name = "RUD"; break;
+ case XFS_LI_RUD_RT: item_name = "RUD_RT"; break;
+ }
+
*ptr += len;
if (len >= core_size) {
- printf(_("RUD: #regs: %d id: 0x%llx\n"),
- f->rud_size,
- (unsigned long long)f->rud_rui_id);
+ printf(_("%s: #regs: %d id: 0x%llx\n"),
+ item_name, f->rud_size,
+ (unsigned long long)f->rud_rui_id);

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