Re: [PATCH 06/21] xfs: add scrub cross-referencing helpers for the free space btrees

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

 



On Fri, Dec 22, 2017 at 04:43:29PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> Add a couple of functions to the free space btrees that will be used
> to cross-reference metadata against the bnobt/cntbt, and a generic
> btree function that provides the real implementation.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

minor nit:
> +/* Is there a record covering a given range of keys? */
> +int
> +xfs_btree_has_record(
> +	struct xfs_btree_cur	*cur,
> +	union xfs_btree_irec	*low,
> +	union xfs_btree_irec	*high,
> +	bool			*exists)
> +{
> +	int			error;
> +
> +	error = xfs_btree_query_range(cur, low, high,
> +			&xfs_btree_has_record_helper, NULL);
> +	if (error && error != XFS_BTREE_QUERY_RANGE_ABORT)
> +		return error;
> +	*exists = error == XFS_BTREE_QUERY_RANGE_ABORT;
> +
> +	return 0;

Error handling logic is a bit tortured. This seems a bit clearer
to me:

	if (error == XFS_BTREE_QUERY_RANGE_ABORT) {
		*exists = true;
		return 0;
	}
	*exists = false;
	return error;

Otherwise it looks ok.

Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>
-- 
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