From: Donald Douwsma <ddouwsma@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: Donald Douwsma <ddouwsma@redhat.com>
Subject: [PATCH 3/5] xfsrestore: include TREE_DEBUG all builds
Date: Tue, 24 Feb 2026 18:17:10 +1100 [thread overview]
Message-ID: <20260224071712.1014075-4-ddouwsma@redhat.com> (raw)
In-Reply-To: <20260224071712.1014075-1-ddouwsma@redhat.com>
TREE_DEBUG guards additional tree debugging code, making it unavailable
for troubleshooting production issues in the field. Remove the define
and move the logging to level debug or nitty.
xfsrestore -v tree=debug -f dump /tmp/testdir
Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
---
restore/tree.c | 43 +++++++++++++++----------------------------
restore/win.c | 21 ++++++---------------
2 files changed, 21 insertions(+), 43 deletions(-)
diff --git a/restore/tree.c b/restore/tree.c
index 7e79ef2..bf89c6a 100644
--- a/restore/tree.c
+++ b/restore/tree.c
@@ -1342,13 +1342,13 @@ noref_elim_recurse(nh_t parh,
grandcldh = cldp->n_cldh;
nextcldh = cldp->n_sibh;
-#ifdef TREE_DEBUG
- ok = Node2path(cldh, path1, _("noref debug"));
- mlog(MLOG_TRACE | MLOG_TREE,
- "noref: %s: isdir = %d, isreal = %d, isref = %d, "
- "isrenamedir = %d\n",
- path1, isdirpr, isrealpr, isrefpr, isrenamepr);
-#endif
+ if (mlog_level_ss[MLOG_SS_TREE] == MLOG_DEBUG) {
+ ok = Node2path(cldh, path1, _("noref debug"));
+ mlog(MLOG_DEBUG | MLOG_TREE,
+ "noref: %s: isdir = %d, isreal = %d, isref = %d, "
+ "isrenamedir = %d\n",
+ path1, isdirpr, isrealpr, isrefpr, isrenamepr);
+ }
Node_unmap(cldh, &cldp);
@@ -3616,11 +3616,9 @@ adopt(nh_t parh, nh_t cldh, nrh_t nrh)
node_t *cldp;
node_t *sibp;
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE,
+ mlog(MLOG_NITTY | MLOG_TREE,
"adopt(parent=%llu,child=%llu,node=%llu): \n",
parh, cldh, nrh);
-#endif
/* fix up our child - put at front of child list */
cldp = Node_map(cldh);
@@ -3921,10 +3919,8 @@ link_in(nh_t nh)
gen_t gen;
nh_t hardh;
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE,
+ mlog(MLOG_NITTY | MLOG_TREE,
"link_in(%llu): map in node\n", nh);
-#endif
/* map in the node to read ino and gen
*/
@@ -3940,18 +3936,14 @@ link_in(nh_t nh)
* of hard link (lnk) list.
*/
if (hardh == NH_NULL) {
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE,
+ mlog(MLOG_NITTY | MLOG_TREE,
"link_in(): hash node in for ino %llu\n", ino);
-#endif
hash_in(nh);
} else {
nh_t prevh = hardh;
node_t *prevp = Node_map(prevh);
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE,
+ mlog(MLOG_NITTY | MLOG_TREE,
"link_in(): put at end of hash list\n");
-#endif
while (prevp->n_lnkh != NH_NULL) {
nh_t nexth = prevp->n_lnkh;
Node_unmap(prevh, &prevp);
@@ -3967,10 +3959,8 @@ link_in(nh_t nh)
*/
np->n_lnkh = NH_NULL;
Node_unmap(nh, &np);
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE,
+ mlog(MLOG_NITTY | MLOG_TREE,
"link_in(%llu): UNmap in node\n", nh);
-#endif
}
static void
@@ -4362,11 +4352,9 @@ hash_find(xfs_ino_t ino, gen_t gen)
return NH_NULL;
}
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE,
+ mlog(MLOG_NITTY | MLOG_TREE,
"hash_find(%llu,%u): traversing hash link list\n",
ino, gen);
-#endif
/* walk the list until found.
*/
@@ -4382,10 +4370,9 @@ hash_find(xfs_ino_t ino, gen_t gen)
}
Node_unmap(nh, &np);
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE,
+ mlog(MLOG_NITTY | MLOG_TREE,
"hash_find(): return nh = %llu\n", nh);
-#endif
+
return nh;
}
diff --git a/restore/win.c b/restore/win.c
index 64dae1a..8540a98 100644
--- a/restore/win.c
+++ b/restore/win.c
@@ -185,10 +185,9 @@ win_map(segix_t segix, void **pp)
CRITICAL_BEGIN();
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE | MLOG_NOLOCK,
+ mlog(MLOG_NITTY | MLOG_TREE | MLOG_NOLOCK,
"win_map(segix=%u,addr=%p)\n", segix, pp);
-#endif
+
/* resize the array if necessary */
if (segix >= tranp->t_segmaplen)
win_segmap_resize(segix);
@@ -198,10 +197,8 @@ win_map(segix_t segix, void **pp)
*/
winp = tranp->t_segmap[segix];
if (winp) {
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE | MLOG_NOLOCK,
+ mlog(MLOG_NITTY | MLOG_TREE | MLOG_NOLOCK,
"win_map(): requested segment already mapped\n");
-#endif
if (winp->w_refcnt == 0) {
assert(tranp->t_lruheadp);
assert(tranp->t_lrutailp);
@@ -238,19 +235,15 @@ win_map(segix_t segix, void **pp)
* otherwise reuse any descriptor on the LRU list.
*/
if (tranp->t_wincnt < tranp->t_winmax) {
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE | MLOG_NOLOCK,
+ mlog(MLOG_NITTY | MLOG_TREE | MLOG_NOLOCK,
"win_map(): create a new window\n");
-#endif
winp = (win_t *)calloc(1, sizeof(win_t));
assert(winp);
tranp->t_wincnt++;
} else if (tranp->t_lruheadp) {
__attribute__((unused)) int rval;
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE | MLOG_NOLOCK,
+ mlog(MLOG_NITTY | MLOG_TREE | MLOG_NOLOCK,
"win_map(): get head from lru freelist & unmap\n");
-#endif
assert(tranp->t_lrutailp);
winp = tranp->t_lruheadp;
tranp->t_lruheadp = winp->w_nextp;
@@ -284,11 +277,9 @@ win_map(segix_t segix, void **pp)
OFF64MAX - segoff - (off64_t)tranp->t_segsz + 1ll);
assert(!(tranp->t_segsz % pgsz));
assert(!((tranp->t_firstoff + segoff) % (off64_t)pgsz));
-#ifdef TREE_DEBUG
- mlog(MLOG_DEBUG | MLOG_TREE | MLOG_NOLOCK,
+ mlog(MLOG_NITTY | MLOG_TREE | MLOG_NOLOCK,
"win_map(): mmap segment at %lld, size = %llu\n",
(off64_t)(tranp->t_firstoff + segoff), tranp->t_segsz);
-#endif
tranp->t_winmmaps++;
winp->w_p = mmap_autogrow(
tranp->t_segsz,
--
2.47.3
next prev parent reply other threads:[~2026-02-24 7:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 7:17 [PATCH 0/5] xfsdump, xfsprogs distro builds and DEBUG= Donald Douwsma
2026-02-24 7:17 ` [PATCH 1/5] xfsrestore: remove unused variable strctxp Donald Douwsma
2026-02-24 7:17 ` [PATCH 2/5] annotate variables only used for assert Donald Douwsma
2026-02-24 7:17 ` Donald Douwsma [this message]
2026-02-24 7:17 ` [PATCH 4/5] xfsrestore: remove failing assert from noref_elim_recurse Donald Douwsma
2026-03-23 3:01 ` Donald Douwsma
2026-02-24 7:17 ` [PATCH 5/5] xfsrestore: assert suppression workaround Donald Douwsma
2026-03-13 13:12 ` [PATCH 0/5] xfsdump, xfsprogs distro builds and DEBUG= Andrey Albershteyn
2026-03-23 1:48 ` Donald Douwsma
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=20260224071712.1014075-4-ddouwsma@redhat.com \
--to=ddouwsma@redhat.com \
--cc=linux-xfs@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