All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 07/27] xfs: create helpers to scrub a metadata btree
Date: Fri, 22 Sep 2017 17:23:22 +1000	[thread overview]
Message-ID: <20170922072322.GH10955@dastard> (raw)
In-Reply-To: <150595310060.18473.12973800380739754286.stgit@magnolia>

On Wed, Sep 20, 2017 at 05:18:20PM -0700, Darrick J. Wong wrote:
> +/* Check for btree operation errors . */
> +bool
> +xfs_scrub_btree_op_ok(
> +	struct xfs_scrub_context	*sc,
> +	struct xfs_btree_cur		*cur,
> +	int				level,
> +	int				*error)
> +{
> +	if (*error == 0)
> +		return true;
> +
> +	switch (*error) {
> +	case -EDEADLOCK:
> +		/* Used to restart an op with deadlock avoidance. */
> +		trace_xfs_scrub_deadlock_retry(sc->ip, sc->sm, *error);
> +		break;
> +	case -EFSBADCRC:
> +	case -EFSCORRUPTED:
> +		/* Note the badness but don't abort. */
> +		sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
> +		*error = 0;
> +		/* fall through */
> +	default:
> +		if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE)
> +			trace_xfs_scrub_ifork_btree_op_error(sc, cur, level,
> +					*error, __return_address);
> +		else
> +			trace_xfs_scrub_btree_op_error(sc, cur, level,
> +					*error, __return_address);

Why different tracepoints when you could just output the
cur->bc_flags in the trace output and use the same tracepoint?
Doing that looks like it would simplify the tracepoint code
in this patch....

> +/* Figure out which block the btree cursor was pointing to. */
> +static inline xfs_fsblock_t
> +xfs_scrub_btree_cur_fsbno(
> +	struct xfs_btree_cur		*cur,
> +	int				level)
> +{
> +	if (level < cur->bc_nlevels && cur->bc_bufs[level])
> +		return XFS_DADDR_TO_FSB(cur->bc_mp, cur->bc_bufs[level]->b_bn);
> +	else if (cur->bc_flags & XFS_BTREE_LONG_PTRS)

no need for "else if", just "if" will do.

> +		return XFS_INO_TO_FSB(cur->bc_mp, cur->bc_private.b.ip->i_ino);

This makes no sense to me. Why are we returning the block address of
the inode here? It's not part of the btree....


> +	return XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_private.a.agno, 0);

Nor is the first block of the AG....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2017-09-22  7:23 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21  0:17 [PATCH v10 00/27] xfs: online scrub support Darrick J. Wong
2017-09-21  0:17 ` [PATCH 01/27] xfs: return a distinct error code value for IGET_INCORE cache misses Darrick J. Wong
2017-09-21 14:36   ` Brian Foster
2017-09-21  0:17 ` [PATCH 02/27] xfs: query the per-AG reservation counters Darrick J. Wong
2017-09-21 14:36   ` Brian Foster
2017-09-21 17:30     ` Darrick J. Wong
2017-09-21  0:17 ` [PATCH 03/27] xfs: create an ioctl to scrub AG metadata Darrick J. Wong
2017-09-21 14:36   ` Brian Foster
2017-09-21 17:35     ` Darrick J. Wong
2017-09-21 17:52       ` Brian Foster
2017-09-22  3:26         ` Darrick J. Wong
2017-09-21  0:18 ` [PATCH 04/27] xfs: dispatch metadata scrub subcommands Darrick J. Wong
2017-09-21 14:37   ` Brian Foster
2017-09-21 18:08     ` Darrick J. Wong
2017-09-21  0:18 ` [PATCH 05/27] xfs: test the scrub ioctl Darrick J. Wong
2017-09-21  6:04   ` Dave Chinner
2017-09-21 18:14     ` Darrick J. Wong
2017-09-21  0:18 ` [PATCH 06/27] xfs: create helpers to record and deal with scrub problems Darrick J. Wong
2017-09-22  7:16   ` Dave Chinner
2017-09-22 16:44     ` Darrick J. Wong
2017-09-23  7:22       ` Dave Chinner
2017-09-23  7:24         ` Darrick J. Wong
2017-09-21  0:18 ` [PATCH 07/27] xfs: create helpers to scrub a metadata btree Darrick J. Wong
2017-09-22  7:23   ` Dave Chinner [this message]
2017-09-22 16:59     ` Darrick J. Wong
2017-09-21  0:18 ` [PATCH 08/27] xfs: scrub the shape of " Darrick J. Wong
2017-09-22 15:22   ` Brian Foster
2017-09-22 17:22     ` Darrick J. Wong
2017-09-22 19:13       ` Brian Foster
2017-09-22 20:14         ` Darrick J. Wong
2017-09-22 21:15           ` Brian Foster
2017-09-21  0:18 ` [PATCH 09/27] xfs: scrub btree keys and records Darrick J. Wong
2017-09-21  0:18 ` [PATCH 10/27] xfs: create helpers to scan an allocation group Darrick J. Wong
2017-09-21  0:18 ` [PATCH 11/27] xfs: scrub the backup superblocks Darrick J. Wong
2017-09-21  0:18 ` [PATCH 12/27] xfs: scrub AGF and AGFL Darrick J. Wong
2017-09-21  0:18 ` [PATCH 13/27] xfs: scrub the AGI Darrick J. Wong
2017-09-21  0:19 ` [PATCH 14/27] xfs: scrub free space btrees Darrick J. Wong
2017-09-21  0:19 ` [PATCH 15/27] xfs: scrub inode btrees Darrick J. Wong
2017-09-21  0:19 ` [PATCH 16/27] xfs: scrub rmap btrees Darrick J. Wong
2017-09-21  0:19 ` [PATCH 17/27] xfs: scrub refcount btrees Darrick J. Wong
2017-09-21  0:19 ` [PATCH 18/27] xfs: scrub inodes Darrick J. Wong
2017-09-21  0:19 ` [PATCH 19/27] xfs: scrub inode block mappings Darrick J. Wong
2017-09-21  0:19 ` [PATCH 20/27] xfs: scrub directory/attribute btrees Darrick J. Wong
2017-09-21  0:19 ` [PATCH 21/27] xfs: scrub directory metadata Darrick J. Wong
2017-09-21  0:19 ` [PATCH 22/27] xfs: scrub directory freespace Darrick J. Wong
2017-09-21  0:20 ` [PATCH 23/27] xfs: scrub extended attributes Darrick J. Wong
2017-09-21  0:20 ` [PATCH 24/27] xfs: scrub symbolic links Darrick J. Wong
2017-09-21  0:20 ` [PATCH 25/27] xfs: scrub parent pointers Darrick J. Wong
2017-09-21  0:20 ` [PATCH 26/27] xfs: scrub realtime bitmap/summary Darrick J. Wong
2017-09-21  0:20 ` [PATCH 27/27] xfs: scrub quota information Darrick J. Wong
2017-09-22  3:27 ` [PATCH] man: describe the metadata scrubbing ioctl 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=20170922072322.GH10955@dastard \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.