Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: cem@kernel.org
To: cem@kernel.org
Cc: linux-xfs@vger.kernel.org, hch@lst.de, sandeen@sandeen.net,
	dgc@kernel.org, aalbersh@kernel.org, bfoster@redhat.com,
	stable@vger.kernel.org
Subject: [PATCH v3 1/2] xfs: move _right_neighbor_result trace before erroring out
Date: Wed, 25 Nov 2026 18:45:59 +0100	[thread overview]
Message-ID: <20261125174607.135959-2-cem@kernel.org> (raw)
In-Reply-To: <20261125174607.135959-1-cem@kernel.org>

From: Carlos Maiolino <cem@kernel.org>

The tracepoint doesn't help much if we find an invalid right record.
Move it before we check the record so it can still be printed even if we
end up jumping to the error label.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
V3: No changes

V2: Initialize rmap records during definition so we can safely use them
    in the tracepoints

Signed-off-by: Carlos Maiolino <cem@kernel.org>
 fs/xfs/libxfs/xfs_rmap.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c
index 14aef87837a9..aad6e7c0e1c9 100644
--- a/fs/xfs/libxfs/xfs_rmap.c
+++ b/fs/xfs/libxfs/xfs_rmap.c
@@ -1024,8 +1024,8 @@ xfs_rmap_map(
 	const struct xfs_owner_info	*oinfo)
 {
 	struct xfs_mount		*mp = cur->bc_mp;
-	struct xfs_rmap_irec		ltrec;
-	struct xfs_rmap_irec		gtrec;
+	struct xfs_rmap_irec		ltrec = {0};
+	struct xfs_rmap_irec		gtrec = {0};
 	int				have_gt;
 	int				have_lt;
 	int				error = 0;
@@ -1082,6 +1082,12 @@ xfs_rmap_map(
 		error = xfs_rmap_get_rec(cur, &gtrec, &have_gt);
 		if (error)
 			goto out_error;
+
+		trace_xfs_rmap_find_right_neighbor_result(cur,
+				gtrec.rm_startblock, gtrec.rm_blockcount,
+				gtrec.rm_owner, gtrec.rm_offset,
+				gtrec.rm_flags);
+
 		if (XFS_IS_CORRUPT(mp, have_gt != 1)) {
 			xfs_btree_mark_sick(cur);
 			error = -EFSCORRUPTED;
@@ -1092,10 +1098,6 @@ xfs_rmap_map(
 			error = -EFSCORRUPTED;
 			goto out_error;
 		}
-		trace_xfs_rmap_find_right_neighbor_result(cur,
-				gtrec.rm_startblock, gtrec.rm_blockcount,
-				gtrec.rm_owner, gtrec.rm_offset,
-				gtrec.rm_flags);
 		if (!xfs_rmap_is_mergeable(&gtrec, owner, flags))
 			have_gt = 0;
 	}
-- 
2.56.1


  reply	other threads:[~2026-11-25 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 17:45 [PATCH v3 0/2] xfs: force all shared extent swap to use rmap shared path cem
2026-11-25 17:45 ` cem [this message]
2026-11-25 17:46 ` [PATCH v3 2/2] " cem

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125174607.135959-2-cem@kernel.org \
    --to=cem@kernel.org \
    --cc=aalbersh@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=dgc@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox