public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Allison Collins <allison.henderson@oracle.com>
Cc: Eric Sandeen <sandeen@redhat.com>, linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 4/3] libxfs: Remove XACT_DEBUG #ifdefs
Date: Mon, 20 May 2019 15:53:59 -0700	[thread overview]
Message-ID: <20190520225354.GF5335@magnolia> (raw)
In-Reply-To: <0b4b7122-82fd-d2e6-c4b2-4d920a653c5d@oracle.com>

On Fri, May 17, 2019 at 02:36:49PM -0700, Allison Collins wrote:
> On 5/16/19 1:38 PM, Eric Sandeen wrote:
> > Remove XACT_DEBUG #ifdefs to reduce more cosmetic differences
> > between userspace & kernelspace libxfs.  Add in some corresponding
> > (stubbed-out) tracepoint calls.
> > 
> > If these are felt to be particularly useful, the tracepoint calls
> > could be fleshed out to provide similar information.

I've occasionally wondered this myself.

> > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> 
> Looks ok.  It seems a shame to loose the extra tracing, but I confess most
> of the time when I'm chasing a particular bug I end up adding my own
> temporary traces anyway.  So I think trying to synchronize the code spaces
> is more important.  Do you think the stubs might be something to add to the
> kernel space side too?

I think most of them already exist in the kernel...

--D

> Allison
> 
> > ---
> >   include/xfs_trace.h | 13 +++++++
> >   libxfs/trans.c      | 85 ++++++++++++---------------------------------
> >   2 files changed, 35 insertions(+), 63 deletions(-)
> > 
> > diff --git a/include/xfs_trace.h b/include/xfs_trace.h
> > index 793ac56e..43720040 100644
> > --- a/include/xfs_trace.h
> > +++ b/include/xfs_trace.h
> > @@ -161,6 +161,19 @@
> >   #define trace_xfs_perag_get_tag(a,b,c,d) ((c) = (c))
> >   #define trace_xfs_perag_put(a,b,c,d)	((c) = (c))
> > +#define trace_xfs_trans_alloc(a,b)		((void) 0)
> > +#define trace_xfs_trans_cancel(a,b)		((void) 0)
> > +#define trace_xfs_trans_brelse(a)		((void) 0)
> > +#define trace_xfs_trans_binval(a)		((void) 0)
> > +#define trace_xfs_trans_bjoin(a)		((void) 0)
> > +#define trace_xfs_trans_bhold(a)		((void) 0)
> > +#define trace_xfs_trans_get_buf(a)		((void) 0)
> > +#define trace_xfs_trans_getsb_recur(a)		((void) 0)
> > +#define trace_xfs_trans_getsb(a)		((void) 0)
> > +#define trace_xfs_trans_read_buf_recur(a)	((void) 0)
> > +#define trace_xfs_trans_read_buf(a)		((void) 0)
> > +#define trace_xfs_trans_commit(a,b)		((void) 0)
> > +
> >   #define trace_xfs_defer_cancel(a,b)		((void) 0)
> >   #define trace_xfs_defer_pending_commit(a,b)	((void) 0)
> >   #define trace_xfs_defer_pending_abort(a,b)	((void) 0)
> > diff --git a/libxfs/trans.c b/libxfs/trans.c
> > index 9e49def0..6967a1de 100644
> > --- a/libxfs/trans.c
> > +++ b/libxfs/trans.c
> > @@ -18,6 +18,7 @@
> >   #include "xfs_trans.h"
> >   #include "xfs_sb.h"
> >   #include "xfs_defer.h"
> > +#include "xfs_trace.h"
> >   static void xfs_trans_free_items(struct xfs_trans *tp);
> >   STATIC struct xfs_trans *xfs_trans_dup(struct xfs_trans *tp);
> > @@ -269,9 +270,9 @@ xfs_trans_alloc(
> >   		xfs_trans_cancel(tp);
> >   		return error;
> >   	}
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "allocated new transaction %p\n", tp);
> > -#endif
> > +
> > +	trace_xfs_trans_alloc(tp, _RET_IP_);
> > +
> >   	*tpp = tp;
> >   	return 0;
> >   }
> > @@ -317,23 +318,16 @@ void
> >   xfs_trans_cancel(
> >   	struct xfs_trans	*tp)
> >   {
> > -#ifdef XACT_DEBUG
> > -	struct xfs_trans	*otp = tp;
> > -#endif
> > +	trace_xfs_trans_cancel(tp, _RET_IP_);
> > +
> >   	if (tp == NULL)
> > -		goto out;
> > +		return;
> >   	if (tp->t_flags & XFS_TRANS_PERM_LOG_RES)
> >   		xfs_defer_cancel(tp);
> >   	xfs_trans_free_items(tp);
> >   	xfs_trans_free(tp);
> > -
> > -out:
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "## cancelled transaction %p\n", otp);
> > -#endif
> > -	return;
> >   }
> >   void
> > @@ -353,10 +347,6 @@ xfs_trans_ijoin(
> >   	iip->ili_lock_flags = lock_flags;
> >   	xfs_trans_add_item(tp, (xfs_log_item_t *)(iip));
> > -
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "ijoin'd inode %llu, transaction %p\n", ip->i_ino, tp);
> > -#endif
> >   }
> >   void
> > @@ -388,9 +378,6 @@ xfs_trans_log_inode(
> >   	uint			flags)
> >   {
> >   	ASSERT(ip->i_itemp != NULL);
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "dirtied inode %llu, transaction %p\n", ip->i_ino, tp);
> > -#endif
> >   	tp->t_flags |= XFS_TRANS_DIRTY;
> >   	set_bit(XFS_LI_DIRTY, &ip->i_itemp->ili_item.li_flags);
> > @@ -434,9 +421,6 @@ xfs_trans_dirty_buf(
> >   	ASSERT(bp->b_transp == tp);
> >   	ASSERT(bip != NULL);
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "dirtied buffer %p, transaction %p\n", bp, tp);
> > -#endif
> >   	tp->t_flags |= XFS_TRANS_DIRTY;
> >   	set_bit(XFS_LI_DIRTY, &bip->bli_item.li_flags);
> >   }
> > @@ -501,15 +485,14 @@ xfs_trans_brelse(
> >   	xfs_buf_t		*bp)
> >   {
> >   	xfs_buf_log_item_t	*bip;
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "released buffer %p, transaction %p\n", bp, tp);
> > -#endif
> >   	if (tp == NULL) {
> >   		ASSERT(bp->b_transp == NULL);
> >   		libxfs_putbuf(bp);
> >   		return;
> >   	}
> > +
> > +	trace_xfs_trans_brelse(bip);
> >   	ASSERT(bp->b_transp == tp);
> >   	bip = bp->b_log_item;
> >   	ASSERT(bip->bli_item.li_type == XFS_LI_BUF);
> > @@ -536,13 +519,12 @@ xfs_trans_binval(
> >   	xfs_buf_t		*bp)
> >   {
> >   	xfs_buf_log_item_t	*bip = bp->b_log_item;
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "binval'd buffer %p, transaction %p\n", bp, tp);
> > -#endif
> >   	ASSERT(bp->b_transp == tp);
> >   	ASSERT(bip != NULL);
> > +	trace_xfs_trans_binval(bip);
> > +
> >   	if (bip->bli_flags & XFS_BLI_STALE)
> >   		return;
> >   	XFS_BUF_UNDELAYWRITE(bp);
> > @@ -563,14 +545,12 @@ xfs_trans_bjoin(
> >   	xfs_buf_log_item_t	*bip;
> >   	ASSERT(bp->b_transp == NULL);
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "bjoin'd buffer %p, transaction %p\n", bp, tp);
> > -#endif
> >   	xfs_buf_item_init(bp, tp->t_mountp);
> >   	bip = bp->b_log_item;
> >   	xfs_trans_add_item(tp, (xfs_log_item_t *)bip);
> >   	bp->b_transp = tp;
> > +	trace_xfs_trans_bjoin(bp->b_log_item);
> >   }
> >   void
> > @@ -582,11 +562,9 @@ xfs_trans_bhold(
> >   	ASSERT(bp->b_transp == tp);
> >   	ASSERT(bip != NULL);
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "bhold'd buffer %p, transaction %p\n", bp, tp);
> > -#endif
> >   	bip->bli_flags |= XFS_BLI_HOLD;
> > +	trace_xfs_trans_bhold(bip);
> >   }
> >   xfs_buf_t *
> > @@ -615,13 +593,11 @@ xfs_trans_get_buf_map(
> >   	bp = libxfs_getbuf_map(btp, map, nmaps, 0);
> >   	if (bp == NULL)
> >   		return NULL;
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "trans_get_buf buffer %p, transaction %p\n", bp, tp);
> > -#endif
> >   	xfs_trans_bjoin(tp, bp);
> >   	bip = bp->b_log_item;
> >   	bip->bli_recur = 0;
> > +	trace_xfs_trans_get_buf(bp->b_log_item);
> >   	return bp;
> >   }
> > @@ -644,17 +620,16 @@ xfs_trans_getsb(
> >   		bip = bp->b_log_item;
> >   		ASSERT(bip != NULL);
> >   		bip->bli_recur++;
> > +		trace_xfs_trans_getsb_recur(bip);
> >   		return bp;
> >   	}
> >   	bp = xfs_getsb(mp);
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "trans_get_sb buffer %p, transaction %p\n", bp, tp);
> > -#endif
> >   	xfs_trans_bjoin(tp, bp);
> >   	bip = bp->b_log_item;
> >   	bip->bli_recur = 0;
> > +	trace_xfs_trans_getsb(bp->b_log_item);
> >   	return bp;
> >   }
> > @@ -691,6 +666,7 @@ xfs_trans_read_buf_map(
> >   		ASSERT(bp->b_log_item != NULL);
> >   		bip = bp->b_log_item;
> >   		bip->bli_recur++;
> > +		trace_xfs_trans_read_buf_recur(bip);
> >   		goto done;
> >   	}
> > @@ -701,14 +677,11 @@ xfs_trans_read_buf_map(
> >   	if (bp->b_error)
> >   		goto out_relse;
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "trans_read_buf buffer %p, transaction %p\n", bp, tp);
> > -#endif
> > -
> >   	xfs_trans_bjoin(tp, bp);
> >   	bip = bp->b_log_item;
> >   	bip->bli_recur = 0;
> >   done:
> > +	trace_xfs_trans_read_buf(bp->b_log_item);
> >   	*bpp = bp;
> >   	return 0;
> >   out_relse:
> > @@ -824,10 +797,6 @@ inode_item_done(
> >   	}
> >   	libxfs_writebuf(bp, 0);
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "flushing dirty inode %llu, buffer %p\n",
> > -			ip->i_ino, bp);
> > -#endif
> >   free:
> >   	xfs_inode_item_put(iip);
> >   }
> > @@ -845,13 +814,8 @@ buf_item_done(
> >   	bp->b_transp = NULL;			/* remove xact ptr */
> >   	hold = (bip->bli_flags & XFS_BLI_HOLD);
> > -	if (bip->bli_flags & XFS_BLI_DIRTY) {
> > -#ifdef XACT_DEBUG
> > -		fprintf(stderr, "flushing/staling buffer %p (hold=%d)\n",
> > -			bp, hold);
> > -#endif
> > +	if (bip->bli_flags & XFS_BLI_DIRTY)
> >   		libxfs_writebuf_int(bp, 0);
> > -	}
> >   	bip->bli_flags &= ~XFS_BLI_HOLD;
> >   	xfs_buf_item_put(bip);
> > @@ -937,6 +901,8 @@ __xfs_trans_commit(
> >   	struct xfs_sb		*sbp;
> >   	int			error = 0;
> > +	trace_xfs_trans_commit(tp, _RET_IP_);
> > +
> >   	if (tp == NULL)
> >   		return 0;
> > @@ -952,12 +918,8 @@ __xfs_trans_commit(
> >   			goto out_unreserve;
> >   	}
> > -	if (!(tp->t_flags & XFS_TRANS_DIRTY)) {
> > -#ifdef XACT_DEBUG
> > -		fprintf(stderr, "committed clean transaction %p\n", tp);
> > -#endif
> > +	if (!(tp->t_flags & XFS_TRANS_DIRTY))
> >   		goto out_unreserve;
> > -	}
> >   	if (tp->t_flags & XFS_TRANS_SB_DIRTY) {
> >   		sbp = &(tp->t_mountp->m_sb);
> > @@ -972,9 +934,6 @@ __xfs_trans_commit(
> >   		xfs_log_sb(tp);
> >   	}
> > -#ifdef XACT_DEBUG
> > -	fprintf(stderr, "committing dirty transaction %p\n", tp);
> > -#endif
> >   	trans_committed(tp);
> >   	/* That's it for the transaction structure.  Free it. */
> > 

  reply	other threads:[~2019-05-20 22:54 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 17:42 [PATCH 0/3] xfsprogs: more libxfs/ spring cleaning Eric Sandeen
2019-05-16 17:43 ` [PATCH 1/3] libxfs: rename shared kernel functions from libxfs_ to xfs_ Eric Sandeen
2019-05-17 20:49   ` Allison Collins
2019-05-17 21:00     ` Eric Sandeen
2019-05-16 17:45 ` [PATCH 2/3] libxfs: remove libxfs API #defines for unexported xfs functions Eric Sandeen
2019-05-17 21:06   ` Allison Collins
2019-05-16 17:46 ` [PATCH 3/3] xfsprogs: remove unused flags arg from getsb interfaces Eric Sandeen
2019-05-17 21:09   ` Allison Collins
2019-05-16 20:38 ` [PATCH 4/3] libxfs: Remove XACT_DEBUG #ifdefs Eric Sandeen
2019-05-17 21:36   ` Allison Collins
2019-05-20 22:53     ` Darrick J. Wong [this message]
2019-05-16 20:39 ` [PATCH 5/3] libxfs: rename bli_format to avoid confusion with bli_formats Eric Sandeen
2019-05-17 22:29   ` Allison Collins
2019-05-17 23:01     ` Eric Sandeen
2019-05-17 23:41       ` Allison Collins
2019-05-16 20:39 ` [PATCH 6/3] libxfs: factor common xfs_trans_bjoin code Eric Sandeen
2019-05-17 22:56   ` Allison Collins
2019-05-20 22:56   ` Darrick J. Wong
2019-05-20 22:58     ` Eric Sandeen
2019-05-20 23:12       ` Darrick J. Wong
2019-05-16 20:40 ` [PATCH 7/3] libxfs: fix argument to xfs_trans_add_item Eric Sandeen
2019-05-17 22:57   ` Allison Collins
2019-05-16 20:41 ` [PATCH 8/3] xfs: factor log item initialisation Eric Sandeen
2019-05-17 23:50   ` Allison Collins
2019-05-17 19:46 ` [PATCH 9/3] libxfs: create current_time helper and sync xfs_trans_ichgtime Eric Sandeen
2019-05-17 19:50 ` [PATCH 10/3] libxfs: share kernel's xfs_trans_inode.c Eric Sandeen
2019-05-20 23:00   ` Darrick J. Wong
2019-05-20 23:03 ` [PATCH 0/3] xfsprogs: more libxfs/ spring cleaning Darrick J. Wong
2019-05-20 23:10   ` Darrick J. Wong

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=20190520225354.GF5335@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=allison.henderson@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /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