linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org, chandan.babu@oracle.com, hch@lst.de
Subject: Re: [PATCH 01/17] xfs: fix incorrect decoding in xchk_btree_cur_fsbno
Date: Thu, 14 Oct 2021 17:37:47 -0700	[thread overview]
Message-ID: <20211015003747.GN24307@magnolia> (raw)
In-Reply-To: <20211014231702.GW2361455@dread.disaster.area>

On Fri, Oct 15, 2021 at 10:17:02AM +1100, Dave Chinner wrote:
> On Thu, Oct 14, 2021 at 04:05:49PM -0700, Darrick J. Wong wrote:
> > On Fri, Oct 15, 2021 at 09:48:13AM +1100, Dave Chinner wrote:
> > > On Thu, Oct 14, 2021 at 01:17:00PM -0700, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > 
> > > > During review of subsequent patches, Dave and I noticed that this
> > > > function doesn't work quite right -- accessing cur->bc_ino depends on
> > > > the ROOT_IN_INODE flag, not LONG_PTRS.  Fix that and the parentheses
> > > > isssue.  While we're at it, remove the piece that accesses cur->bc_ag,
> > > > because block 0 of an AG is never part of a btree.
> > > > 
> > > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > > ---
> > > >  fs/xfs/scrub/trace.c |    7 ++++---
> > > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > > > 
> > > > 
> > > > diff --git a/fs/xfs/scrub/trace.c b/fs/xfs/scrub/trace.c
> > > > index c0ef53fe6611..93c13763c15e 100644
> > > > --- a/fs/xfs/scrub/trace.c
> > > > +++ b/fs/xfs/scrub/trace.c
> > > > @@ -24,10 +24,11 @@ xchk_btree_cur_fsbno(
> > > >  	if (level < cur->bc_nlevels && cur->bc_bufs[level])
> > > >  		return XFS_DADDR_TO_FSB(cur->bc_mp,
> > > >  				xfs_buf_daddr(cur->bc_bufs[level]));
> > > > -	if (level == cur->bc_nlevels - 1 && cur->bc_flags & XFS_BTREE_LONG_PTRS)
> > > > +
> > > > +	if (level == cur->bc_nlevels - 1 &&
> > > > +	    (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE))
> > > >  		return XFS_INO_TO_FSB(cur->bc_mp, cur->bc_ino.ip->i_ino);
> > > 
> > > Ok.
> > > 
> > > > -	if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS))
> > > > -		return XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_ag.pag->pag_agno, 0);
> > > > +
> > > 
> > > But doesn't this break the tracing code on short pointers as the
> > > tracing code does:
> > > 
> > > 	TP_fast_assign(
> > > 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
> > > 		...
> > > 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
> > > 
> > > 
> > > i.e. the tracing will no longer give the correct agno for per-ag
> > > cursors that don't have any buffers attached to them at the current
> > > level?
> > 
> > Hmmm.  By that logic, maybe we should get rid of the (level ==
> > cur->bc_nlevels - 1) check entirely so that any cursor without a buffer
> > attached at that level will always provide *some* kind of breadcrumb to
> > the tracepoints?
> 
> Perhaps so.
> 
> > I almost did that instead, except for the consideration that if you're
> > tracing the online fsck code, you should /probably/ have at least one of
> > xchk_stop/xrep_attempt/xchk_done included in the filter list so you can
> > be certain of what the kernel is checking.
> 
> It doesn't worry me how we resolve this - I just pointed it out
> because it's not mentioned in the commit message and I wanted to
> make sure it wasn't an oversight. If there are better ways to get
> this information from tracepoints and XFS_FSB_TO_AGNO() does
> something safe and obvious with NULLFSBLOCK (e.g. ends up as -1)
> then as long as there's mention of this change in the commit message
> I'm fine with it as it is.

Ok.  I'll add the following to the commit message:

"Note: This changes the btree scrubber tracepoints behavior -- if the
cursor has no buffer for a certain level, it will always report
NULLFSBLOCK.  It is assumed that anyone tracing the online fsck code
will also be tracing xchk_start/xchk_done or otherwise be aware of what
exactly is being scrubbed."

--D

> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

  reply	other threads:[~2021-10-15  0:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14 20:16 [PATCHSET v4 00/17] xfs: support dynamic btree cursor height Darrick J. Wong
2021-10-14 20:17 ` [PATCH 01/17] xfs: fix incorrect decoding in xchk_btree_cur_fsbno Darrick J. Wong
2021-10-14 22:48   ` Dave Chinner
2021-10-14 23:05     ` Darrick J. Wong
2021-10-14 23:17       ` Dave Chinner
2021-10-15  0:37         ` Darrick J. Wong [this message]
2021-10-15  0:42   ` [PATCH v4.1 " Darrick J. Wong
2021-10-18 22:26     ` Dave Chinner
2021-10-14 20:17 ` [PATCH 02/17] xfs: remove xfs_btree_cur.bc_blocklog Darrick J. Wong
2021-10-14 20:17 ` [PATCH 03/17] xfs: reduce the size of nr_ops for refcount btree cursors Darrick J. Wong
2021-10-14 20:17 ` [PATCH 04/17] xfs: don't track firstrec/firstkey separately in xchk_btree Darrick J. Wong
2021-10-14 20:17 ` [PATCH 05/17] xfs: dynamically allocate btree scrub context structure Darrick J. Wong
2021-10-14 22:48   ` Dave Chinner
2021-10-14 20:17 ` [PATCH 06/17] xfs: prepare xfs_btree_cur for dynamic cursor heights Darrick J. Wong
2021-10-14 22:49   ` Dave Chinner
2021-10-14 20:17 ` [PATCH 07/17] xfs: rearrange xfs_btree_cur fields for better packing Darrick J. Wong
2021-10-14 20:17 ` [PATCH 08/17] xfs: refactor btree cursor allocation function Darrick J. Wong
2021-10-14 20:17 ` [PATCH 09/17] xfs: encode the max btree height in the cursor Darrick J. Wong
2021-10-14 20:17 ` [PATCH 10/17] xfs: dynamically allocate cursors based on maxlevels Darrick J. Wong
2021-10-14 20:17 ` [PATCH 11/17] xfs: rename m_ag_maxlevels to m_allocbt_maxlevels Darrick J. Wong
2021-10-14 22:52   ` Dave Chinner
2021-10-15  0:44     ` Darrick J. Wong
2021-10-14 20:18 ` [PATCH 12/17] xfs: compute maximum AG btree height for critical reservation calculation Darrick J. Wong
2021-10-14 22:54   ` Dave Chinner
2021-10-15  0:44     ` Darrick J. Wong
2021-10-14 20:18 ` [PATCH 13/17] xfs: clean up xfs_btree_{calc_size,compute_maxlevels} Darrick J. Wong
2021-10-14 22:58   ` Dave Chinner
2021-10-14 20:18 ` [PATCH 14/17] xfs: compute the maximum height of the rmap btree when reflink enabled Darrick J. Wong
2021-10-14 23:03   ` Dave Chinner
2021-10-15  0:48     ` Darrick J. Wong
2021-10-14 20:18 ` [PATCH 15/17] xfs: kill XFS_BTREE_MAXLEVELS Darrick J. Wong
2021-10-14 20:18 ` [PATCH 16/17] xfs: compute absolute maximum nlevels for each btree type Darrick J. Wong
2021-10-14 23:08   ` Dave Chinner
2021-10-14 20:18 ` [PATCH 17/17] xfs: use separate btree cursor cache " Darrick J. Wong
2021-10-14 23:11   ` Dave Chinner

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=20211015003747.GN24307@magnolia \
    --to=djwong@kernel.org \
    --cc=chandan.babu@oracle.com \
    --cc=david@fromorbit.com \
    --cc=hch@lst.de \
    --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;
as well as URLs for NNTP newsgroup(s).