Commit 41f33d82 authored by Dave Chinner's avatar Dave Chinner Committed by Darrick J. Wong
Browse files

xfs: consolidate realtime allocation arguments



Consolidate the arguments passed around the rt allocator into a
struct xfs_rtalloc_arg similar to how the btree allocator arguments
are consolidated in a struct xfs_alloc_arg....

Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 663b8db7
Loading
Loading
Loading
Loading
+187 −179
Original line number Diff line number Diff line
@@ -53,17 +53,17 @@ const struct xfs_buf_ops xfs_rtbuf_ops = {
 */
int
xfs_rtbuf_get(
	xfs_mount_t	*mp,		/* file system mount structure */
	xfs_trans_t	*tp,		/* transaction pointer */
	struct xfs_rtalloc_args	*args,
	xfs_fileoff_t		block,	/* block number in bitmap or summary */
	int			issum,	/* is summary not bitmap */
	struct xfs_buf		**bpp)	/* output: buffer for the block */
{
	struct xfs_mount	*mp = args->mp;
	struct xfs_buf		*bp;	/* block buffer, result */
	xfs_inode_t	*ip;		/* bitmap or summary inode */
	xfs_bmbt_irec_t	map;
	struct xfs_inode	*ip;	/* bitmap or summary inode */
	struct xfs_bmbt_irec	map;
	int			nmap = 1;
	int		error;		/* error value */
	int			error;

	ip = issum ? mp->m_rsumip : mp->m_rbmip;

@@ -75,13 +75,13 @@ xfs_rtbuf_get(
		return -EFSCORRUPTED;

	ASSERT(map.br_startblock != NULLFSBLOCK);
	error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
	error = xfs_trans_read_buf(mp, args->tp, mp->m_ddev_targp,
				   XFS_FSB_TO_DADDR(mp, map.br_startblock),
				   mp->m_bsize, 0, &bp, &xfs_rtbuf_ops);
	if (error)
		return error;

	xfs_trans_buf_set_type(tp, bp, issum ? XFS_BLFT_RTSUMMARY_BUF
	xfs_trans_buf_set_type(args->tp, bp, issum ? XFS_BLFT_RTSUMMARY_BUF
					     : XFS_BLFT_RTBITMAP_BUF);
	*bpp = bp;
	return 0;
@@ -93,12 +93,12 @@ xfs_rtbuf_get(
 */
int
xfs_rtfind_back(
	xfs_mount_t	*mp,		/* file system mount point */
	xfs_trans_t	*tp,		/* transaction pointer */
	struct xfs_rtalloc_args	*args,
	xfs_rtxnum_t		start,	/* starting rtext to look at */
	xfs_rtxnum_t		limit,	/* last rtext to look at */
	xfs_rtxnum_t		*rtx)	/* out: start rtext found */
{
	struct xfs_mount	*mp = args->mp;
	int			bit;	/* bit number in the word */
	xfs_fileoff_t		block;	/* bitmap block number */
	struct xfs_buf		*bp;	/* buf for the block */
@@ -116,7 +116,7 @@ xfs_rtfind_back(
	 * Compute and read in starting bitmap block for starting block.
	 */
	block = xfs_rtx_to_rbmblock(mp, start);
	error = xfs_rtbuf_get(mp, tp, block, 0, &bp);
	error = xfs_rtbuf_get(args, block, 0, &bp);
	if (error) {
		return error;
	}
@@ -153,7 +153,7 @@ xfs_rtfind_back(
			/*
			 * Different.  Mark where we are and return.
			 */
			xfs_trans_brelse(tp, bp);
			xfs_trans_brelse(args->tp, bp);
			i = bit - XFS_RTHIBIT(wdiff);
			*rtx = start - i + 1;
			return 0;
@@ -167,8 +167,8 @@ xfs_rtfind_back(
			/*
			 * If done with this block, get the previous one.
			 */
			xfs_trans_brelse(tp, bp);
			error = xfs_rtbuf_get(mp, tp, --block, 0, &bp);
			xfs_trans_brelse(args->tp, bp);
			error = xfs_rtbuf_get(args, --block, 0, &bp);
			if (error) {
				return error;
			}
@@ -194,7 +194,7 @@ xfs_rtfind_back(
			/*
			 * Different, mark where we are and return.
			 */
			xfs_trans_brelse(tp, bp);
			xfs_trans_brelse(args->tp, bp);
			i += XFS_NBWORD - 1 - XFS_RTHIBIT(wdiff);
			*rtx = start - i + 1;
			return 0;
@@ -208,8 +208,8 @@ xfs_rtfind_back(
			/*
			 * If done with this block, get the previous one.
			 */
			xfs_trans_brelse(tp, bp);
			error = xfs_rtbuf_get(mp, tp, --block, 0, &bp);
			xfs_trans_brelse(args->tp, bp);
			error = xfs_rtbuf_get(args, --block, 0, &bp);
			if (error) {
				return error;
			}
@@ -236,7 +236,7 @@ xfs_rtfind_back(
			/*
			 * Different, mark where we are and return.
			 */
			xfs_trans_brelse(tp, bp);
			xfs_trans_brelse(args->tp, bp);
			i += XFS_NBWORD - 1 - XFS_RTHIBIT(wdiff);
			*rtx = start - i + 1;
			return 0;
@@ -246,7 +246,7 @@ xfs_rtfind_back(
	/*
	 * No match, return that we scanned the whole area.
	 */
	xfs_trans_brelse(tp, bp);
	xfs_trans_brelse(args->tp, bp);
	*rtx = start - i + 1;
	return 0;
}
@@ -257,16 +257,16 @@ xfs_rtfind_back(
 */
int
xfs_rtfind_forw(
	xfs_mount_t	*mp,		/* file system mount point */
	xfs_trans_t	*tp,		/* transaction pointer */
	struct xfs_rtalloc_args	*args,
	xfs_rtxnum_t		start,	/* starting rtext to look at */
	xfs_rtxnum_t		limit,	/* last rtext to look at */
	xfs_rtxnum_t		*rtx)	/* out: start rtext found */
{
	struct xfs_mount	*mp = args->mp;
	int			bit;	/* bit number in the word */
	xfs_fileoff_t		block;	/* bitmap block number */
	struct xfs_buf		*bp;	/* buf for the block */
	int		error;		/* error value */
	int			error;
	xfs_rtxnum_t		i;	/* current bit number rel. to start */
	xfs_rtxnum_t		lastbit;/* last useful bit in the word */
	xfs_rtxnum_t		len;	/* length of inspected area */
@@ -280,7 +280,7 @@ xfs_rtfind_forw(
	 * Compute and read in starting bitmap block for starting block.
	 */
	block = xfs_rtx_to_rbmblock(mp, start);
	error = xfs_rtbuf_get(mp, tp, block, 0, &bp);
	error = xfs_rtbuf_get(args, block, 0, &bp);
	if (error) {
		return error;
	}
@@ -316,7 +316,7 @@ xfs_rtfind_forw(
			/*
			 * Different.  Mark where we are and return.
			 */
			xfs_trans_brelse(tp, bp);
			xfs_trans_brelse(args->tp, bp);
			i = XFS_RTLOBIT(wdiff) - bit;
			*rtx = start + i - 1;
			return 0;
@@ -330,8 +330,8 @@ xfs_rtfind_forw(
			/*
			 * If done with this block, get the previous one.
			 */
			xfs_trans_brelse(tp, bp);
			error = xfs_rtbuf_get(mp, tp, ++block, 0, &bp);
			xfs_trans_brelse(args->tp, bp);
			error = xfs_rtbuf_get(args, ++block, 0, &bp);
			if (error) {
				return error;
			}
@@ -357,7 +357,7 @@ xfs_rtfind_forw(
			/*
			 * Different, mark where we are and return.
			 */
			xfs_trans_brelse(tp, bp);
			xfs_trans_brelse(args->tp, bp);
			i += XFS_RTLOBIT(wdiff);
			*rtx = start + i - 1;
			return 0;
@@ -371,8 +371,8 @@ xfs_rtfind_forw(
			/*
			 * If done with this block, get the next one.
			 */
			xfs_trans_brelse(tp, bp);
			error = xfs_rtbuf_get(mp, tp, ++block, 0, &bp);
			xfs_trans_brelse(args->tp, bp);
			error = xfs_rtbuf_get(args, ++block, 0, &bp);
			if (error) {
				return error;
			}
@@ -397,7 +397,7 @@ xfs_rtfind_forw(
			/*
			 * Different, mark where we are and return.
			 */
			xfs_trans_brelse(tp, bp);
			xfs_trans_brelse(args->tp, bp);
			i += XFS_RTLOBIT(wdiff);
			*rtx = start + i - 1;
			return 0;
@@ -407,7 +407,7 @@ xfs_rtfind_forw(
	/*
	 * No match, return that we scanned the whole area.
	 */
	xfs_trans_brelse(tp, bp);
	xfs_trans_brelse(args->tp, bp);
	*rtx = start + i - 1;
	return 0;
}
@@ -438,8 +438,7 @@ xfs_trans_log_rtsummary(
 */
int
xfs_rtmodify_summary_int(
	xfs_mount_t	*mp,		/* file system mount structure */
	xfs_trans_t	*tp,		/* transaction pointer */
	struct xfs_rtalloc_args	*args,
	int			log,	/* log2 of extent size */
	xfs_fileoff_t		bbno,	/* bitmap block number */
	int			delta,	/* change to make to summary info */
@@ -447,8 +446,9 @@ xfs_rtmodify_summary_int(
	xfs_fileoff_t		*rsb,	/* in/out: summary block number */
	xfs_suminfo_t		*sum)	/* out: summary info for this block */
{
	struct xfs_mount	*mp = args->mp;
	struct xfs_buf		*bp;	/* buffer for the summary block */
	int		error;		/* error value */
	int			error;
	xfs_fileoff_t		sb;	/* summary fsblock */
	xfs_rtsumoff_t		so;	/* index into the summary file */
	unsigned int		infoword;
@@ -474,8 +474,8 @@ xfs_rtmodify_summary_int(
		 * If there was an old one, get rid of it first.
		 */
		if (*rbpp)
			xfs_trans_brelse(tp, *rbpp);
		error = xfs_rtbuf_get(mp, tp, sb, 1, &bp);
			xfs_trans_brelse(args->tp, *rbpp);
		error = xfs_rtbuf_get(args, sb, 1, &bp);
		if (error) {
			return error;
		}
@@ -498,7 +498,7 @@ xfs_rtmodify_summary_int(
			if (val != 0 && log < mp->m_rsum_cache[bbno])
				mp->m_rsum_cache[bbno] = log;
		}
		xfs_trans_log_rtsummary(tp, bp, infoword);
		xfs_trans_log_rtsummary(args->tp, bp, infoword);
		if (sum)
			*sum = val;
	} else if (sum) {
@@ -509,16 +509,14 @@ xfs_rtmodify_summary_int(

int
xfs_rtmodify_summary(
	xfs_mount_t	*mp,		/* file system mount structure */
	xfs_trans_t	*tp,		/* transaction pointer */
	struct xfs_rtalloc_args	*args,
	int			log,	/* log2 of extent size */
	xfs_fileoff_t		bbno,	/* bitmap block number */
	int			delta,	/* change to make to summary info */
	struct xfs_buf		**rbpp,	/* in/out: summary block buffer */
	xfs_fileoff_t		*rsb)	/* in/out: summary block number */
{
	return xfs_rtmodify_summary_int(mp, tp, log, bbno,
					delta, rbpp, rsb, NULL);
	return xfs_rtmodify_summary_int(args, log, bbno, delta, rbpp, rsb, NULL);
}

/* Log rtbitmap block from the word @from to the byte before @next. */
@@ -543,16 +541,16 @@ xfs_trans_log_rtbitmap(
 */
int
xfs_rtmodify_range(
	xfs_mount_t	*mp,		/* file system mount point */
	xfs_trans_t	*tp,		/* transaction pointer */
	struct xfs_rtalloc_args	*args,
	xfs_rtxnum_t		start,	/* starting rtext to modify */
	xfs_rtxlen_t		len,	/* length of extent to modify */
	int			val)	/* 1 for free, 0 for allocated */
{
	struct xfs_mount	*mp = args->mp;
	int			bit;	/* bit number in the word */
	xfs_fileoff_t		block;	/* bitmap block number */
	struct xfs_buf		*bp;	/* buf for the block */
	int		error;		/* error value */
	int			error;
	int			i;	/* current bit number rel. to start */
	int			lastbit; /* last useful bit in word */
	xfs_rtword_t		mask;	 /* mask of relevant bits for value */
@@ -567,7 +565,7 @@ xfs_rtmodify_range(
	/*
	 * Read the bitmap block, and point to its data.
	 */
	error = xfs_rtbuf_get(mp, tp, block, 0, &bp);
	error = xfs_rtbuf_get(args, block, 0, &bp);
	if (error) {
		return error;
	}
@@ -610,8 +608,9 @@ xfs_rtmodify_range(
			 * Log the changed part of this block.
			 * Get the next one.
			 */
			xfs_trans_log_rtbitmap(tp, bp, firstword, word);
			error = xfs_rtbuf_get(mp, tp, ++block, 0, &bp);
			xfs_trans_log_rtbitmap(args->tp, bp, firstword,
					word);
			error = xfs_rtbuf_get(args, ++block, 0, &bp);
			if (error) {
				return error;
			}
@@ -643,11 +642,11 @@ xfs_rtmodify_range(
			 * Log the changed part of this block.
			 * Get the next one.
			 */
			xfs_trans_log_rtbitmap(tp, bp, firstword, word);
			error = xfs_rtbuf_get(mp, tp, ++block, 0, &bp);
			if (error) {
			xfs_trans_log_rtbitmap(args->tp, bp, firstword,
					word);
			error = xfs_rtbuf_get(args, ++block, 0, &bp);
			if (error)
				return error;
			}

			firstword = word = 0;
		}
@@ -676,7 +675,7 @@ xfs_rtmodify_range(
	 * Log any remaining changed bytes.
	 */
	if (word > firstword)
		xfs_trans_log_rtbitmap(tp, bp, firstword, word);
		xfs_trans_log_rtbitmap(args->tp, bp, firstword, word);
	return 0;
}

@@ -686,13 +685,13 @@ xfs_rtmodify_range(
 */
int
xfs_rtfree_range(
	xfs_mount_t	*mp,		/* file system mount point */
	xfs_trans_t	*tp,		/* transaction pointer */
	struct xfs_rtalloc_args	*args,
	xfs_rtxnum_t		start,	/* starting rtext to free */
	xfs_rtxlen_t		len,	/* length to free */
	struct xfs_buf		**rbpp,	/* in/out: summary block buffer */
	xfs_fileoff_t		*rsb)	/* in/out: summary block number */
{
	struct xfs_mount	*mp = args->mp;
	xfs_rtxnum_t		end;	/* end of the freed extent */
	int			error;	/* error value */
	xfs_rtxnum_t		postblock; /* first rtext freed > end */
@@ -702,7 +701,7 @@ xfs_rtfree_range(
	/*
	 * Modify the bitmap to mark this extent freed.
	 */
	error = xfs_rtmodify_range(mp, tp, start, len, 1);
	error = xfs_rtmodify_range(args, start, len, 1);
	if (error) {
		return error;
	}
@@ -711,14 +710,14 @@ xfs_rtfree_range(
	 * We need to find the beginning and end of the extent so we can
	 * properly update the summary.
	 */
	error = xfs_rtfind_back(mp, tp, start, 0, &preblock);
	error = xfs_rtfind_back(args, start, 0, &preblock);
	if (error) {
		return error;
	}
	/*
	 * Find the next allocated block (end of allocated extent).
	 */
	error = xfs_rtfind_forw(mp, tp, end, mp->m_sb.sb_rextents - 1,
	error = xfs_rtfind_forw(args, end, mp->m_sb.sb_rextents - 1,
		&postblock);
	if (error)
		return error;
@@ -727,7 +726,7 @@ xfs_rtfree_range(
	 * old extent, add summary data for them to be allocated.
	 */
	if (preblock < start) {
		error = xfs_rtmodify_summary(mp, tp,
		error = xfs_rtmodify_summary(args,
			XFS_RTBLOCKLOG(start - preblock),
			xfs_rtx_to_rbmblock(mp, preblock), -1, rbpp, rsb);
		if (error) {
@@ -739,7 +738,7 @@ xfs_rtfree_range(
	 * old extent, add summary data for them to be allocated.
	 */
	if (postblock > end) {
		error = xfs_rtmodify_summary(mp, tp,
		error = xfs_rtmodify_summary(args,
			XFS_RTBLOCKLOG(postblock - end),
			xfs_rtx_to_rbmblock(mp, end + 1), -1, rbpp, rsb);
		if (error) {
@@ -750,7 +749,7 @@ xfs_rtfree_range(
	 * Increment the summary information corresponding to the entire
	 * (new) free extent.
	 */
	error = xfs_rtmodify_summary(mp, tp,
	error = xfs_rtmodify_summary(args,
		XFS_RTBLOCKLOG(postblock + 1 - preblock),
		xfs_rtx_to_rbmblock(mp, preblock), 1, rbpp, rsb);
	return error;
@@ -762,18 +761,18 @@ xfs_rtfree_range(
 */
int
xfs_rtcheck_range(
	xfs_mount_t	*mp,		/* file system mount point */
	xfs_trans_t	*tp,		/* transaction pointer */
	struct xfs_rtalloc_args	*args,
	xfs_rtxnum_t		start,	/* starting rtext number of extent */
	xfs_rtxlen_t		len,	/* length of extent */
	int			val,	/* 1 for free, 0 for allocated */
	xfs_rtxnum_t		*new,	/* out: first rtext not matching */
	int			*stat)	/* out: 1 for matches, 0 for not */
{
	struct xfs_mount	*mp = args->mp;
	int			bit;	/* bit number in the word */
	xfs_fileoff_t		block;	/* bitmap block number */
	struct xfs_buf		*bp;	/* buf for the block */
	int		error;		/* error value */
	int			error;
	xfs_rtxnum_t		i;	/* current bit number rel. to start */
	xfs_rtxnum_t		lastbit; /* last useful bit in word */
	xfs_rtword_t		mask;	/* mask of relevant bits for value */
@@ -788,7 +787,7 @@ xfs_rtcheck_range(
	/*
	 * Read the bitmap block.
	 */
	error = xfs_rtbuf_get(mp, tp, block, 0, &bp);
	error = xfs_rtbuf_get(args, block, 0, &bp);
	if (error) {
		return error;
	}
@@ -823,7 +822,7 @@ xfs_rtcheck_range(
			/*
			 * Different, compute first wrong bit and return.
			 */
			xfs_trans_brelse(tp, bp);
			xfs_trans_brelse(args->tp, bp);
			i = XFS_RTLOBIT(wdiff) - bit;
			*new = start + i;
			*stat = 0;
@@ -838,8 +837,8 @@ xfs_rtcheck_range(
			/*
			 * If done with this block, get the next one.
			 */
			xfs_trans_brelse(tp, bp);
			error = xfs_rtbuf_get(mp, tp, ++block, 0, &bp);
			xfs_trans_brelse(args->tp, bp);
			error = xfs_rtbuf_get(args, ++block, 0, &bp);
			if (error) {
				return error;
			}
@@ -865,7 +864,7 @@ xfs_rtcheck_range(
			/*
			 * Different, compute first wrong bit and return.
			 */
			xfs_trans_brelse(tp, bp);
			xfs_trans_brelse(args->tp, bp);
			i += XFS_RTLOBIT(wdiff);
			*new = start + i;
			*stat = 0;
@@ -880,8 +879,8 @@ xfs_rtcheck_range(
			/*
			 * If done with this block, get the next one.
			 */
			xfs_trans_brelse(tp, bp);
			error = xfs_rtbuf_get(mp, tp, ++block, 0, &bp);
			xfs_trans_brelse(args->tp, bp);
			error = xfs_rtbuf_get(args, ++block, 0, &bp);
			if (error) {
				return error;
			}
@@ -906,7 +905,7 @@ xfs_rtcheck_range(
			/*
			 * Different, compute first wrong bit and return.
			 */
			xfs_trans_brelse(tp, bp);
			xfs_trans_brelse(args->tp, bp);
			i += XFS_RTLOBIT(wdiff);
			*new = start + i;
			*stat = 0;
@@ -917,7 +916,7 @@ xfs_rtcheck_range(
	/*
	 * Successful, return.
	 */
	xfs_trans_brelse(tp, bp);
	xfs_trans_brelse(args->tp, bp);
	*new = start + i;
	*stat = 1;
	return 0;
@@ -927,10 +926,9 @@ xfs_rtcheck_range(
/*
 * Check that the given extent (block range) is allocated already.
 */
STATIC int				/* error */
STATIC int
xfs_rtcheck_alloc_range(
	xfs_mount_t	*mp,		/* file system mount point */
	xfs_trans_t	*tp,		/* transaction pointer */
	struct xfs_rtalloc_args	*args,
	xfs_rtxnum_t		start,	/* starting rtext number of extent */
	xfs_rtxlen_t		len)	/* length of extent */
{
@@ -938,43 +936,45 @@ xfs_rtcheck_alloc_range(
	int			stat;
	int			error;

	error = xfs_rtcheck_range(mp, tp, start, len, 0, &new, &stat);
	error = xfs_rtcheck_range(args, start, len, 0, &new, &stat);
	if (error)
		return error;
	ASSERT(stat);
	return 0;
}
#else
#define xfs_rtcheck_alloc_range(m,t,b,l)	(0)
#define xfs_rtcheck_alloc_range(a,b,l)	(0)
#endif
/*
 * Free an extent in the realtime subvolume.  Length is expressed in
 * realtime extents, as is the block number.
 */
int					/* error */
int
xfs_rtfree_extent(
	xfs_trans_t	*tp,		/* transaction pointer */
	struct xfs_trans	*tp,	/* transaction pointer */
	xfs_rtxnum_t		start,	/* starting rtext number to free */
	xfs_rtxlen_t		len)	/* length of extent freed */
{
	int		error;		/* error value */
	xfs_mount_t	*mp;		/* file system mount structure */
	struct xfs_mount	*mp = tp->t_mountp;
	struct xfs_rtalloc_args	args = {
		.mp		= mp,
		.tp		= tp,
	};
	int			error;
	xfs_fsblock_t		sb;	/* summary file block number */
	struct xfs_buf		*sumbp = NULL; /* summary file block buffer */

	mp = tp->t_mountp;

	ASSERT(mp->m_rbmip->i_itemp != NULL);
	ASSERT(xfs_isilocked(mp->m_rbmip, XFS_ILOCK_EXCL));

	error = xfs_rtcheck_alloc_range(mp, tp, start, len);
	error = xfs_rtcheck_alloc_range(&args, start, len);
	if (error)
		return error;

	/*
	 * Free the range of realtime blocks.
	 */
	error = xfs_rtfree_range(mp, tp, start, len, &sumbp, &sb);
	error = xfs_rtfree_range(&args, start, len, &sumbp, &sb);
	if (error) {
		return error;
	}
@@ -1039,6 +1039,10 @@ xfs_rtalloc_query_range(
	xfs_rtalloc_query_range_fn	fn,
	void				*priv)
{
	struct xfs_rtalloc_args		args = {
		.mp			= mp,
		.tp			= tp,
	};
	struct xfs_rtalloc_rec		rec;
	xfs_rtxnum_t			rtstart;
	xfs_rtxnum_t			rtend;
@@ -1058,13 +1062,13 @@ xfs_rtalloc_query_range(
	rtstart = low_rec->ar_startext;
	while (rtstart <= high_key) {
		/* Is the first block free? */
		error = xfs_rtcheck_range(mp, tp, rtstart, 1, 1, &rtend,
		error = xfs_rtcheck_range(&args, rtstart, 1, 1, &rtend,
				&is_free);
		if (error)
			break;

		/* How long does the extent go for? */
		error = xfs_rtfind_forw(mp, tp, rtstart, high_key, &rtend);
		error = xfs_rtfind_forw(&args, rtstart, high_key, &rtend);
		if (error)
			break;

@@ -1109,11 +1113,15 @@ xfs_rtalloc_extent_is_free(
	xfs_rtxlen_t			len,
	bool				*is_free)
{
	struct xfs_rtalloc_args		args = {
		.mp			= mp,
		.tp			= tp,
	};
	xfs_rtxnum_t			end;
	int				matches;
	int				error;

	error = xfs_rtcheck_range(mp, tp, start, len, 1, &end, &matches);
	error = xfs_rtcheck_range(&args, start, len, 1, &end, &matches);
	if (error)
		return error;

+23 −23
Original line number Diff line number Diff line
@@ -6,6 +6,11 @@
#ifndef __XFS_RTBITMAP_H__
#define	__XFS_RTBITMAP_H__

struct xfs_rtalloc_args {
	struct xfs_mount	*mp;
	struct xfs_trans	*tp;
};

static inline xfs_rtblock_t
xfs_rtx_to_rtb(
	struct xfs_mount	*mp,
@@ -281,29 +286,24 @@ typedef int (*xfs_rtalloc_query_range_fn)(
	void				*priv);

#ifdef CONFIG_XFS_RT
int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp,
		  xfs_fileoff_t block, int issum, struct xfs_buf **bpp);
int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp,
		      xfs_rtxnum_t start, xfs_rtxlen_t len, int val,
		      xfs_rtxnum_t *new, int *stat);
int xfs_rtfind_back(struct xfs_mount *mp, struct xfs_trans *tp,
		    xfs_rtxnum_t start, xfs_rtxnum_t limit,
		    xfs_rtxnum_t *rtblock);
int xfs_rtfind_forw(struct xfs_mount *mp, struct xfs_trans *tp,
		    xfs_rtxnum_t start, xfs_rtxnum_t limit,
		    xfs_rtxnum_t *rtblock);
int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp,
		       xfs_rtxnum_t start, xfs_rtxlen_t len, int val);
int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp,
			     int log, xfs_fileoff_t bbno, int delta,
			     struct xfs_buf **rbpp, xfs_fileoff_t *rsb,
			     xfs_suminfo_t *sum);
int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log,
int xfs_rtbuf_get(struct xfs_rtalloc_args *args, xfs_fileoff_t block,
		int issum, struct xfs_buf **bpp);
int xfs_rtcheck_range(struct xfs_rtalloc_args *args, xfs_rtxnum_t start,
		xfs_rtxlen_t len, int val, xfs_rtxnum_t *new, int *stat);
int xfs_rtfind_back(struct xfs_rtalloc_args *args, xfs_rtxnum_t start,
		xfs_rtxnum_t limit, xfs_rtxnum_t *rtblock);
int xfs_rtfind_forw(struct xfs_rtalloc_args *args, xfs_rtxnum_t start,
		xfs_rtxnum_t limit, xfs_rtxnum_t *rtblock);
int xfs_rtmodify_range(struct xfs_rtalloc_args *args, xfs_rtxnum_t start,
		xfs_rtxlen_t len, int val);
int xfs_rtmodify_summary_int(struct xfs_rtalloc_args *args, int log,
		xfs_fileoff_t bbno, int delta, struct xfs_buf **rbpp,
		xfs_fileoff_t *rsb, xfs_suminfo_t *sum);
int xfs_rtmodify_summary(struct xfs_rtalloc_args *args, int log,
		xfs_fileoff_t bbno, int delta, struct xfs_buf **rbpp,
		xfs_fileoff_t *rsb);
int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp,
		     xfs_rtxnum_t start, xfs_rtxlen_t len,
		     struct xfs_buf **rbpp, xfs_fileoff_t *rsb);
int xfs_rtfree_range(struct xfs_rtalloc_args *args, xfs_rtxnum_t start,
		xfs_rtxlen_t len, struct xfs_buf **rbpp, xfs_fileoff_t *rsb);
int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp,
		const struct xfs_rtalloc_rec *low_rec,
		const struct xfs_rtalloc_rec *high_rec,
+5 −1
Original line number Diff line number Diff line
@@ -188,6 +188,10 @@ STATIC int
xchk_rtsum_compare(
	struct xfs_scrub	*sc)
{
	struct xfs_rtalloc_args args = {
		.mp		= sc->mp,
		.tp		= sc->tp,
	};
	struct xfs_mount	*mp = sc->mp;
	struct xfs_buf		*bp;
	struct xfs_bmbt_irec	map;
@@ -217,7 +221,7 @@ xchk_rtsum_compare(
		}

		/* Read a block's worth of ondisk rtsummary file. */
		error = xfs_rtbuf_get(mp, sc->tp, off, 1, &bp);
		error = xfs_rtbuf_get(&args, off, 1, &bp);
		if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, off, &error))
			return error;

+171 −162

File changed.

Preview size limit exceeded, changes collapsed.