Re: [PATCH 12/21] xfs: check btree block ownership with bnobt/rmapbt when scrubbing btree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 22, 2017 at 04:44:06PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> When scanning a metadata btree block, cross-reference the block location
> with the free space btree and the reverse mapping btree to ensure that
> the rmapbt knows about the block and the bnobt does not.  Add a
> mechanism to defer checks when we happen to be scanning the bnobt/rmapbt
> itself because it's less efficient to repeatedly clone and destroy the
> cursor.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> ---
>  fs/xfs/scrub/btree.c |   92 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 92 insertions(+)
> 
> 
> diff --git a/fs/xfs/scrub/btree.c b/fs/xfs/scrub/btree.c
> index 36cff8f..9151499 100644
> --- a/fs/xfs/scrub/btree.c
> +++ b/fs/xfs/scrub/btree.c
> @@ -362,6 +362,80 @@ xfs_scrub_btree_block_check_siblings(
>  	return error;
>  }
>  
> +struct check_owner {
> +	struct list_head	list;
> +	xfs_daddr_t		daddr;
> +	int			level;
> +};
> +
> +/*
> + * Make sure this btree block isn't in the free list and that there's
> + * an rmap record for it.
> + */
> +STATIC int
> +xfs_scrub_btree_check_block_owner(
> +	struct xfs_scrub_btree		*bs,
> +	int				level,
> +	xfs_daddr_t			daddr)
> +{
> +	struct xfs_scrub_ag		sa = { 0 };
> +	struct xfs_scrub_ag		*psa;
> +	xfs_agnumber_t			agno;
> +	int				error = 0;
> +
> +	agno = xfs_daddr_to_agno(bs->cur->bc_mp, daddr);
> +
> +	if (bs->cur->bc_flags & XFS_BTREE_LONG_PTRS) {
> +		error = xfs_scrub_ag_init(bs->sc, agno, &sa);
> +		if (!xfs_scrub_btree_xref_process_error(bs->sc, bs->cur,
> +				level, &error))
> +			return error;
> +		psa = &sa;
> +	} else {
> +		psa = &bs->sc->sa;
> +	}
> +
> +	if (psa == &sa)
> +		xfs_scrub_ag_free(bs->sc, &sa);
> +
> +	return error;
> +}

I'm missing something here - where's the owner check?

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux