Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c29aad41 authored by Eric Sandeen's avatar Eric Sandeen Committed by Dave Chinner
Browse files

xfs: pass mp to XFS_WANT_CORRUPTED_GOTO



Today, if we hit an XFS_WANT_CORRUPTED_GOTO we don't print any
information about which filesystem hit it.  Passing in the mp allows
us to print the filesystem (device) name, which is a pretty critical
piece of information.

Tested by running fsfuzzer 'til I hit some.

Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 58c90473
Loading
Loading
Loading
Loading
+36 −35
Original line number Original line Diff line number Diff line
@@ -682,7 +682,7 @@ xfs_alloc_ag_vextent_exact(
	error = xfs_alloc_get_rec(bno_cur, &fbno, &flen, &i);
	error = xfs_alloc_get_rec(bno_cur, &fbno, &flen, &i);
	if (error)
	if (error)
		goto error0;
		goto error0;
	XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
	XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
	ASSERT(fbno <= args->agbno);
	ASSERT(fbno <= args->agbno);


	/*
	/*
@@ -783,7 +783,7 @@ xfs_alloc_find_best_extent(
		error = xfs_alloc_get_rec(*scur, sbno, slen, &i);
		error = xfs_alloc_get_rec(*scur, sbno, slen, &i);
		if (error)
		if (error)
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
		xfs_alloc_compute_aligned(args, *sbno, *slen, sbnoa, slena);
		xfs_alloc_compute_aligned(args, *sbno, *slen, sbnoa, slena);


		/*
		/*
@@ -946,7 +946,7 @@ xfs_alloc_ag_vextent_near(
				if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno,
				if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno,
						&ltlen, &i)))
						&ltlen, &i)))
					goto error0;
					goto error0;
				XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
				XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
				if (ltlen >= args->minlen)
				if (ltlen >= args->minlen)
					break;
					break;
				if ((error = xfs_btree_increment(cnt_cur, 0, &i)))
				if ((error = xfs_btree_increment(cnt_cur, 0, &i)))
@@ -966,7 +966,7 @@ xfs_alloc_ag_vextent_near(
			 */
			 */
			if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i)))
			if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i)))
				goto error0;
				goto error0;
			XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
			XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
			xfs_alloc_compute_aligned(args, ltbno, ltlen,
			xfs_alloc_compute_aligned(args, ltbno, ltlen,
						  &ltbnoa, &ltlena);
						  &ltbnoa, &ltlena);
			if (ltlena < args->minlen)
			if (ltlena < args->minlen)
@@ -999,7 +999,7 @@ xfs_alloc_ag_vextent_near(
		cnt_cur->bc_ptrs[0] = besti;
		cnt_cur->bc_ptrs[0] = besti;
		if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i)))
		if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
		ASSERT(ltbno + ltlen <= be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length));
		ASSERT(ltbno + ltlen <= be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length));
		args->len = blen;
		args->len = blen;
		if (!xfs_alloc_fix_minleft(args)) {
		if (!xfs_alloc_fix_minleft(args)) {
@@ -1088,7 +1088,7 @@ xfs_alloc_ag_vextent_near(
		if (bno_cur_lt) {
		if (bno_cur_lt) {
			if ((error = xfs_alloc_get_rec(bno_cur_lt, &ltbno, &ltlen, &i)))
			if ((error = xfs_alloc_get_rec(bno_cur_lt, &ltbno, &ltlen, &i)))
				goto error0;
				goto error0;
			XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
			XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
			xfs_alloc_compute_aligned(args, ltbno, ltlen,
			xfs_alloc_compute_aligned(args, ltbno, ltlen,
						  &ltbnoa, &ltlena);
						  &ltbnoa, &ltlena);
			if (ltlena >= args->minlen)
			if (ltlena >= args->minlen)
@@ -1104,7 +1104,7 @@ xfs_alloc_ag_vextent_near(
		if (bno_cur_gt) {
		if (bno_cur_gt) {
			if ((error = xfs_alloc_get_rec(bno_cur_gt, &gtbno, &gtlen, &i)))
			if ((error = xfs_alloc_get_rec(bno_cur_gt, &gtbno, &gtlen, &i)))
				goto error0;
				goto error0;
			XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
			XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
			xfs_alloc_compute_aligned(args, gtbno, gtlen,
			xfs_alloc_compute_aligned(args, gtbno, gtlen,
						  &gtbnoa, &gtlena);
						  &gtbnoa, &gtlena);
			if (gtlena >= args->minlen)
			if (gtlena >= args->minlen)
@@ -1303,7 +1303,7 @@ xfs_alloc_ag_vextent_size(
			error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen, &i);
			error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen, &i);
			if (error)
			if (error)
				goto error0;
				goto error0;
			XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
			XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);


			xfs_alloc_compute_aligned(args, fbno, flen,
			xfs_alloc_compute_aligned(args, fbno, flen,
						  &rbno, &rlen);
						  &rbno, &rlen);
@@ -1342,7 +1342,7 @@ xfs_alloc_ag_vextent_size(
	 * This can't happen in the second case above.
	 * This can't happen in the second case above.
	 */
	 */
	rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
	rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
	XFS_WANT_CORRUPTED_GOTO(rlen == 0 ||
	XFS_WANT_CORRUPTED_GOTO(args->mp, rlen == 0 ||
			(rlen <= flen && rbno + rlen <= fbno + flen), error0);
			(rlen <= flen && rbno + rlen <= fbno + flen), error0);
	if (rlen < args->maxlen) {
	if (rlen < args->maxlen) {
		xfs_agblock_t	bestfbno;
		xfs_agblock_t	bestfbno;
@@ -1362,13 +1362,13 @@ xfs_alloc_ag_vextent_size(
			if ((error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen,
			if ((error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen,
					&i)))
					&i)))
				goto error0;
				goto error0;
			XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
			XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
			if (flen < bestrlen)
			if (flen < bestrlen)
				break;
				break;
			xfs_alloc_compute_aligned(args, fbno, flen,
			xfs_alloc_compute_aligned(args, fbno, flen,
						  &rbno, &rlen);
						  &rbno, &rlen);
			rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
			rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
			XFS_WANT_CORRUPTED_GOTO(rlen == 0 ||
			XFS_WANT_CORRUPTED_GOTO(args->mp, rlen == 0 ||
				(rlen <= flen && rbno + rlen <= fbno + flen),
				(rlen <= flen && rbno + rlen <= fbno + flen),
				error0);
				error0);
			if (rlen > bestrlen) {
			if (rlen > bestrlen) {
@@ -1383,7 +1383,7 @@ xfs_alloc_ag_vextent_size(
		if ((error = xfs_alloc_lookup_eq(cnt_cur, bestfbno, bestflen,
		if ((error = xfs_alloc_lookup_eq(cnt_cur, bestfbno, bestflen,
				&i)))
				&i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
		rlen = bestrlen;
		rlen = bestrlen;
		rbno = bestrbno;
		rbno = bestrbno;
		flen = bestflen;
		flen = bestflen;
@@ -1408,7 +1408,7 @@ xfs_alloc_ag_vextent_size(
	if (!xfs_alloc_fix_minleft(args))
	if (!xfs_alloc_fix_minleft(args))
		goto out_nominleft;
		goto out_nominleft;
	rlen = args->len;
	rlen = args->len;
	XFS_WANT_CORRUPTED_GOTO(rlen <= flen, error0);
	XFS_WANT_CORRUPTED_GOTO(args->mp, rlen <= flen, error0);
	/*
	/*
	 * Allocate and initialize a cursor for the by-block tree.
	 * Allocate and initialize a cursor for the by-block tree.
	 */
	 */
@@ -1422,7 +1422,7 @@ xfs_alloc_ag_vextent_size(
	cnt_cur = bno_cur = NULL;
	cnt_cur = bno_cur = NULL;
	args->len = rlen;
	args->len = rlen;
	args->agbno = rbno;
	args->agbno = rbno;
	XFS_WANT_CORRUPTED_GOTO(
	XFS_WANT_CORRUPTED_GOTO(args->mp,
		args->agbno + args->len <=
		args->agbno + args->len <=
			be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length),
			be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length),
		error0);
		error0);
@@ -1467,7 +1467,7 @@ xfs_alloc_ag_vextent_small(
	if (i) {
	if (i) {
		if ((error = xfs_alloc_get_rec(ccur, &fbno, &flen, &i)))
		if ((error = xfs_alloc_get_rec(ccur, &fbno, &flen, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(args->mp, i == 1, error0);
	}
	}
	/*
	/*
	 * Nothing in the btree, try the freelist.  Make sure
	 * Nothing in the btree, try the freelist.  Make sure
@@ -1493,7 +1493,7 @@ xfs_alloc_ag_vextent_small(
			}
			}
			args->len = 1;
			args->len = 1;
			args->agbno = fbno;
			args->agbno = fbno;
			XFS_WANT_CORRUPTED_GOTO(
			XFS_WANT_CORRUPTED_GOTO(args->mp,
				args->agbno + args->len <=
				args->agbno + args->len <=
				be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length),
				be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length),
				error0);
				error0);
@@ -1579,7 +1579,7 @@ xfs_free_ag_extent(
		 */
		 */
		if ((error = xfs_alloc_get_rec(bno_cur, &ltbno, &ltlen, &i)))
		if ((error = xfs_alloc_get_rec(bno_cur, &ltbno, &ltlen, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		/*
		/*
		 * It's not contiguous, though.
		 * It's not contiguous, though.
		 */
		 */
@@ -1591,7 +1591,8 @@ xfs_free_ag_extent(
			 * space was invalid, it's (partly) already free.
			 * space was invalid, it's (partly) already free.
			 * Very bad.
			 * Very bad.
			 */
			 */
			XFS_WANT_CORRUPTED_GOTO(ltbno + ltlen <= bno, error0);
			XFS_WANT_CORRUPTED_GOTO(mp,
						ltbno + ltlen <= bno, error0);
		}
		}
	}
	}
	/*
	/*
@@ -1606,7 +1607,7 @@ xfs_free_ag_extent(
		 */
		 */
		if ((error = xfs_alloc_get_rec(bno_cur, &gtbno, &gtlen, &i)))
		if ((error = xfs_alloc_get_rec(bno_cur, &gtbno, &gtlen, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		/*
		/*
		 * It's not contiguous, though.
		 * It's not contiguous, though.
		 */
		 */
@@ -1618,7 +1619,7 @@ xfs_free_ag_extent(
			 * space was invalid, it's (partly) already free.
			 * space was invalid, it's (partly) already free.
			 * Very bad.
			 * Very bad.
			 */
			 */
			XFS_WANT_CORRUPTED_GOTO(gtbno >= bno + len, error0);
			XFS_WANT_CORRUPTED_GOTO(mp, gtbno >= bno + len, error0);
		}
		}
	}
	}
	/*
	/*
@@ -1635,31 +1636,31 @@ xfs_free_ag_extent(
		 */
		 */
		if ((error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i)))
		if ((error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		if ((error = xfs_btree_delete(cnt_cur, &i)))
		if ((error = xfs_btree_delete(cnt_cur, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		/*
		/*
		 * Delete the old by-size entry on the right.
		 * Delete the old by-size entry on the right.
		 */
		 */
		if ((error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i)))
		if ((error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		if ((error = xfs_btree_delete(cnt_cur, &i)))
		if ((error = xfs_btree_delete(cnt_cur, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		/*
		/*
		 * Delete the old by-block entry for the right block.
		 * Delete the old by-block entry for the right block.
		 */
		 */
		if ((error = xfs_btree_delete(bno_cur, &i)))
		if ((error = xfs_btree_delete(bno_cur, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		/*
		/*
		 * Move the by-block cursor back to the left neighbor.
		 * Move the by-block cursor back to the left neighbor.
		 */
		 */
		if ((error = xfs_btree_decrement(bno_cur, 0, &i)))
		if ((error = xfs_btree_decrement(bno_cur, 0, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
#ifdef DEBUG
#ifdef DEBUG
		/*
		/*
		 * Check that this is the right record: delete didn't
		 * Check that this is the right record: delete didn't
@@ -1672,7 +1673,7 @@ xfs_free_ag_extent(
			if ((error = xfs_alloc_get_rec(bno_cur, &xxbno, &xxlen,
			if ((error = xfs_alloc_get_rec(bno_cur, &xxbno, &xxlen,
					&i)))
					&i)))
				goto error0;
				goto error0;
			XFS_WANT_CORRUPTED_GOTO(
			XFS_WANT_CORRUPTED_GOTO(mp,
				i == 1 && xxbno == ltbno && xxlen == ltlen,
				i == 1 && xxbno == ltbno && xxlen == ltlen,
				error0);
				error0);
		}
		}
@@ -1695,17 +1696,17 @@ xfs_free_ag_extent(
		 */
		 */
		if ((error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i)))
		if ((error = xfs_alloc_lookup_eq(cnt_cur, ltbno, ltlen, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		if ((error = xfs_btree_delete(cnt_cur, &i)))
		if ((error = xfs_btree_delete(cnt_cur, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		/*
		/*
		 * Back up the by-block cursor to the left neighbor, and
		 * Back up the by-block cursor to the left neighbor, and
		 * update its length.
		 * update its length.
		 */
		 */
		if ((error = xfs_btree_decrement(bno_cur, 0, &i)))
		if ((error = xfs_btree_decrement(bno_cur, 0, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		nbno = ltbno;
		nbno = ltbno;
		nlen = len + ltlen;
		nlen = len + ltlen;
		if ((error = xfs_alloc_update(bno_cur, nbno, nlen)))
		if ((error = xfs_alloc_update(bno_cur, nbno, nlen)))
@@ -1721,10 +1722,10 @@ xfs_free_ag_extent(
		 */
		 */
		if ((error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i)))
		if ((error = xfs_alloc_lookup_eq(cnt_cur, gtbno, gtlen, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		if ((error = xfs_btree_delete(cnt_cur, &i)))
		if ((error = xfs_btree_delete(cnt_cur, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
		/*
		/*
		 * Update the starting block and length of the right
		 * Update the starting block and length of the right
		 * neighbor in the by-block tree.
		 * neighbor in the by-block tree.
@@ -1743,7 +1744,7 @@ xfs_free_ag_extent(
		nlen = len;
		nlen = len;
		if ((error = xfs_btree_insert(bno_cur, &i)))
		if ((error = xfs_btree_insert(bno_cur, &i)))
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
	}
	}
	xfs_btree_del_cursor(bno_cur, XFS_BTREE_NOERROR);
	xfs_btree_del_cursor(bno_cur, XFS_BTREE_NOERROR);
	bno_cur = NULL;
	bno_cur = NULL;
@@ -1752,10 +1753,10 @@ xfs_free_ag_extent(
	 */
	 */
	if ((error = xfs_alloc_lookup_eq(cnt_cur, nbno, nlen, &i)))
	if ((error = xfs_alloc_lookup_eq(cnt_cur, nbno, nlen, &i)))
		goto error0;
		goto error0;
	XFS_WANT_CORRUPTED_GOTO(i == 0, error0);
	XFS_WANT_CORRUPTED_GOTO(mp, i == 0, error0);
	if ((error = xfs_btree_insert(cnt_cur, &i)))
	if ((error = xfs_btree_insert(cnt_cur, &i)))
		goto error0;
		goto error0;
	XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
	XFS_WANT_CORRUPTED_GOTO(mp, i == 1, error0);
	xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR);
	xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR);
	cnt_cur = NULL;
	cnt_cur = NULL;


+64 −57
Original line number Original line Diff line number Diff line
@@ -410,7 +410,7 @@ xfs_bmap_check_leaf_extents(
				goto error_norelse;
				goto error_norelse;
		}
		}
		block = XFS_BUF_TO_BLOCK(bp);
		block = XFS_BUF_TO_BLOCK(bp);
		XFS_WANT_CORRUPTED_GOTO(
		XFS_WANT_CORRUPTED_GOTO(mp,
			xfs_bmap_sanity_check(mp, bp, level),
			xfs_bmap_sanity_check(mp, bp, level),
			error0);
			error0);
		if (level == 0)
		if (level == 0)
@@ -424,7 +424,8 @@ xfs_bmap_check_leaf_extents(
		xfs_check_block(block, mp, 0, 0);
		xfs_check_block(block, mp, 0, 0);
		pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]);
		pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]);
		bno = be64_to_cpu(*pp);
		bno = be64_to_cpu(*pp);
		XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, bno), error0);
		XFS_WANT_CORRUPTED_GOTO(mp,
					XFS_FSB_SANITY_CHECK(mp, bno), error0);
		if (bp_release) {
		if (bp_release) {
			bp_release = 0;
			bp_release = 0;
			xfs_trans_brelse(NULL, bp);
			xfs_trans_brelse(NULL, bp);
@@ -1029,7 +1030,7 @@ xfs_bmap_add_attrfork_btree(
		if ((error = xfs_bmbt_lookup_ge(cur, 0, 0, 0, &stat)))
		if ((error = xfs_bmbt_lookup_ge(cur, 0, 0, 0, &stat)))
			goto error0;
			goto error0;
		/* must be at least one entry */
		/* must be at least one entry */
		XFS_WANT_CORRUPTED_GOTO(stat == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(mp, stat == 1, error0);
		if ((error = xfs_btree_new_iroot(cur, flags, &stat)))
		if ((error = xfs_btree_new_iroot(cur, flags, &stat)))
			goto error0;
			goto error0;
		if (stat == 0) {
		if (stat == 0) {
@@ -1311,14 +1312,14 @@ xfs_bmap_read_extents(
		if (error)
		if (error)
			return error;
			return error;
		block = XFS_BUF_TO_BLOCK(bp);
		block = XFS_BUF_TO_BLOCK(bp);
		XFS_WANT_CORRUPTED_GOTO(
		XFS_WANT_CORRUPTED_GOTO(mp,
			xfs_bmap_sanity_check(mp, bp, level),
			xfs_bmap_sanity_check(mp, bp, level), error0);
			error0);
		if (level == 0)
		if (level == 0)
			break;
			break;
		pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]);
		pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]);
		bno = be64_to_cpu(*pp);
		bno = be64_to_cpu(*pp);
		XFS_WANT_CORRUPTED_GOTO(XFS_FSB_SANITY_CHECK(mp, bno), error0);
		XFS_WANT_CORRUPTED_GOTO(mp,
			XFS_FSB_SANITY_CHECK(mp, bno), error0);
		xfs_trans_brelse(tp, bp);
		xfs_trans_brelse(tp, bp);
	}
	}
	/*
	/*
@@ -1345,7 +1346,7 @@ xfs_bmap_read_extents(
				XFS_ERRLEVEL_LOW, ip->i_mount, block);
				XFS_ERRLEVEL_LOW, ip->i_mount, block);
			goto error0;
			goto error0;
		}
		}
		XFS_WANT_CORRUPTED_GOTO(
		XFS_WANT_CORRUPTED_GOTO(mp,
			xfs_bmap_sanity_check(mp, bp, 0),
			xfs_bmap_sanity_check(mp, bp, 0),
			error0);
			error0);
		/*
		/*
@@ -1755,7 +1756,9 @@ xfs_bmap_add_extent_delay_real(
	xfs_filblks_t		temp=0;	/* value for da_new calculations */
	xfs_filblks_t		temp=0;	/* value for da_new calculations */
	xfs_filblks_t		temp2=0;/* value for da_new calculations */
	xfs_filblks_t		temp2=0;/* value for da_new calculations */
	int			tmp_rval;	/* partial logging flags */
	int			tmp_rval;	/* partial logging flags */
	struct xfs_mount	*mp;


	mp  = bma->tp ? bma->tp->t_mountp : NULL;
	ifp = XFS_IFORK_PTR(bma->ip, XFS_DATA_FORK);
	ifp = XFS_IFORK_PTR(bma->ip, XFS_DATA_FORK);


	ASSERT(bma->idx >= 0);
	ASSERT(bma->idx >= 0);
@@ -1866,15 +1869,15 @@ xfs_bmap_add_extent_delay_real(
					RIGHT.br_blockcount, &i);
					RIGHT.br_blockcount, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_btree_delete(bma->cur, &i);
			error = xfs_btree_delete(bma->cur, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_btree_decrement(bma->cur, 0, &i);
			error = xfs_btree_decrement(bma->cur, 0, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_bmbt_update(bma->cur, LEFT.br_startoff,
			error = xfs_bmbt_update(bma->cur, LEFT.br_startoff,
					LEFT.br_startblock,
					LEFT.br_startblock,
					LEFT.br_blockcount +
					LEFT.br_blockcount +
@@ -1907,7 +1910,7 @@ xfs_bmap_add_extent_delay_real(
					&i);
					&i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_bmbt_update(bma->cur, LEFT.br_startoff,
			error = xfs_bmbt_update(bma->cur, LEFT.br_startoff,
					LEFT.br_startblock,
					LEFT.br_startblock,
					LEFT.br_blockcount +
					LEFT.br_blockcount +
@@ -1938,7 +1941,7 @@ xfs_bmap_add_extent_delay_real(
					RIGHT.br_blockcount, &i);
					RIGHT.br_blockcount, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_bmbt_update(bma->cur, PREV.br_startoff,
			error = xfs_bmbt_update(bma->cur, PREV.br_startoff,
					new->br_startblock,
					new->br_startblock,
					PREV.br_blockcount +
					PREV.br_blockcount +
@@ -1968,12 +1971,12 @@ xfs_bmap_add_extent_delay_real(
					&i);
					&i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 0, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
			bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
			bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
			error = xfs_btree_insert(bma->cur, &i);
			error = xfs_btree_insert(bma->cur, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
		}
		}
		break;
		break;


@@ -2001,7 +2004,7 @@ xfs_bmap_add_extent_delay_real(
					&i);
					&i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_bmbt_update(bma->cur, LEFT.br_startoff,
			error = xfs_bmbt_update(bma->cur, LEFT.br_startoff,
					LEFT.br_startblock,
					LEFT.br_startblock,
					LEFT.br_blockcount +
					LEFT.br_blockcount +
@@ -2038,12 +2041,12 @@ xfs_bmap_add_extent_delay_real(
					&i);
					&i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 0, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
			bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
			bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
			error = xfs_btree_insert(bma->cur, &i);
			error = xfs_btree_insert(bma->cur, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
		}
		}


		if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) {
		if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) {
@@ -2084,7 +2087,7 @@ xfs_bmap_add_extent_delay_real(
					RIGHT.br_blockcount, &i);
					RIGHT.br_blockcount, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_bmbt_update(bma->cur, new->br_startoff,
			error = xfs_bmbt_update(bma->cur, new->br_startoff,
					new->br_startblock,
					new->br_startblock,
					new->br_blockcount +
					new->br_blockcount +
@@ -2122,12 +2125,12 @@ xfs_bmap_add_extent_delay_real(
					&i);
					&i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 0, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
			bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
			bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
			error = xfs_btree_insert(bma->cur, &i);
			error = xfs_btree_insert(bma->cur, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
		}
		}


		if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) {
		if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) {
@@ -2191,12 +2194,12 @@ xfs_bmap_add_extent_delay_real(
					&i);
					&i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 0, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
			bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
			bma->cur->bc_rec.b.br_state = XFS_EXT_NORM;
			error = xfs_btree_insert(bma->cur, &i);
			error = xfs_btree_insert(bma->cur, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
		}
		}


		if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) {
		if (xfs_bmap_needs_btree(bma->ip, XFS_DATA_FORK)) {
@@ -2309,6 +2312,7 @@ xfs_bmap_add_extent_unwritten_real(
					/* left is 0, right is 1, prev is 2 */
					/* left is 0, right is 1, prev is 2 */
	int			rval=0;	/* return value (logging flags) */
	int			rval=0;	/* return value (logging flags) */
	int			state = 0;/* state bits, accessed thru macros */
	int			state = 0;/* state bits, accessed thru macros */
	struct xfs_mount	*mp = tp->t_mountp;


	*logflagsp = 0;
	*logflagsp = 0;


@@ -2421,19 +2425,19 @@ xfs_bmap_add_extent_unwritten_real(
					RIGHT.br_startblock,
					RIGHT.br_startblock,
					RIGHT.br_blockcount, &i)))
					RIGHT.br_blockcount, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_btree_delete(cur, &i)))
			if ((error = xfs_btree_delete(cur, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_btree_decrement(cur, 0, &i)))
			if ((error = xfs_btree_decrement(cur, 0, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_btree_delete(cur, &i)))
			if ((error = xfs_btree_delete(cur, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_btree_decrement(cur, 0, &i)))
			if ((error = xfs_btree_decrement(cur, 0, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
			if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
				LEFT.br_startblock,
				LEFT.br_startblock,
				LEFT.br_blockcount + PREV.br_blockcount +
				LEFT.br_blockcount + PREV.br_blockcount +
@@ -2464,13 +2468,13 @@ xfs_bmap_add_extent_unwritten_real(
					PREV.br_startblock, PREV.br_blockcount,
					PREV.br_startblock, PREV.br_blockcount,
					&i)))
					&i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_btree_delete(cur, &i)))
			if ((error = xfs_btree_delete(cur, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_btree_decrement(cur, 0, &i)))
			if ((error = xfs_btree_decrement(cur, 0, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
			if ((error = xfs_bmbt_update(cur, LEFT.br_startoff,
				LEFT.br_startblock,
				LEFT.br_startblock,
				LEFT.br_blockcount + PREV.br_blockcount,
				LEFT.br_blockcount + PREV.br_blockcount,
@@ -2499,13 +2503,13 @@ xfs_bmap_add_extent_unwritten_real(
					RIGHT.br_startblock,
					RIGHT.br_startblock,
					RIGHT.br_blockcount, &i)))
					RIGHT.br_blockcount, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_btree_delete(cur, &i)))
			if ((error = xfs_btree_delete(cur, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_btree_decrement(cur, 0, &i)))
			if ((error = xfs_btree_decrement(cur, 0, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_bmbt_update(cur, new->br_startoff,
			if ((error = xfs_bmbt_update(cur, new->br_startoff,
				new->br_startblock,
				new->br_startblock,
				new->br_blockcount + RIGHT.br_blockcount,
				new->br_blockcount + RIGHT.br_blockcount,
@@ -2532,7 +2536,7 @@ xfs_bmap_add_extent_unwritten_real(
					new->br_startblock, new->br_blockcount,
					new->br_startblock, new->br_blockcount,
					&i)))
					&i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_bmbt_update(cur, new->br_startoff,
			if ((error = xfs_bmbt_update(cur, new->br_startoff,
				new->br_startblock, new->br_blockcount,
				new->br_startblock, new->br_blockcount,
				newext)))
				newext)))
@@ -2569,7 +2573,7 @@ xfs_bmap_add_extent_unwritten_real(
					PREV.br_startblock, PREV.br_blockcount,
					PREV.br_startblock, PREV.br_blockcount,
					&i)))
					&i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_bmbt_update(cur,
			if ((error = xfs_bmbt_update(cur,
				PREV.br_startoff + new->br_blockcount,
				PREV.br_startoff + new->br_blockcount,
				PREV.br_startblock + new->br_blockcount,
				PREV.br_startblock + new->br_blockcount,
@@ -2611,7 +2615,7 @@ xfs_bmap_add_extent_unwritten_real(
					PREV.br_startblock, PREV.br_blockcount,
					PREV.br_startblock, PREV.br_blockcount,
					&i)))
					&i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_bmbt_update(cur,
			if ((error = xfs_bmbt_update(cur,
				PREV.br_startoff + new->br_blockcount,
				PREV.br_startoff + new->br_blockcount,
				PREV.br_startblock + new->br_blockcount,
				PREV.br_startblock + new->br_blockcount,
@@ -2621,7 +2625,7 @@ xfs_bmap_add_extent_unwritten_real(
			cur->bc_rec.b = *new;
			cur->bc_rec.b = *new;
			if ((error = xfs_btree_insert(cur, &i)))
			if ((error = xfs_btree_insert(cur, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
		}
		}
		break;
		break;


@@ -2651,7 +2655,7 @@ xfs_bmap_add_extent_unwritten_real(
					PREV.br_startblock,
					PREV.br_startblock,
					PREV.br_blockcount, &i)))
					PREV.br_blockcount, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
			if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
				PREV.br_startblock,
				PREV.br_startblock,
				PREV.br_blockcount - new->br_blockcount,
				PREV.br_blockcount - new->br_blockcount,
@@ -2689,7 +2693,7 @@ xfs_bmap_add_extent_unwritten_real(
					PREV.br_startblock, PREV.br_blockcount,
					PREV.br_startblock, PREV.br_blockcount,
					&i)))
					&i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
			if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
				PREV.br_startblock,
				PREV.br_startblock,
				PREV.br_blockcount - new->br_blockcount,
				PREV.br_blockcount - new->br_blockcount,
@@ -2699,11 +2703,11 @@ xfs_bmap_add_extent_unwritten_real(
					new->br_startblock, new->br_blockcount,
					new->br_startblock, new->br_blockcount,
					&i)))
					&i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 0, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
			cur->bc_rec.b.br_state = XFS_EXT_NORM;
			cur->bc_rec.b.br_state = XFS_EXT_NORM;
			if ((error = xfs_btree_insert(cur, &i)))
			if ((error = xfs_btree_insert(cur, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
		}
		}
		break;
		break;


@@ -2737,7 +2741,7 @@ xfs_bmap_add_extent_unwritten_real(
					PREV.br_startblock, PREV.br_blockcount,
					PREV.br_startblock, PREV.br_blockcount,
					&i)))
					&i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			/* new right extent - oldext */
			/* new right extent - oldext */
			if ((error = xfs_bmbt_update(cur, r[1].br_startoff,
			if ((error = xfs_bmbt_update(cur, r[1].br_startoff,
				r[1].br_startblock, r[1].br_blockcount,
				r[1].br_startblock, r[1].br_blockcount,
@@ -2749,7 +2753,7 @@ xfs_bmap_add_extent_unwritten_real(
				new->br_startoff - PREV.br_startoff;
				new->br_startoff - PREV.br_startoff;
			if ((error = xfs_btree_insert(cur, &i)))
			if ((error = xfs_btree_insert(cur, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			/*
			/*
			 * Reset the cursor to the position of the new extent
			 * Reset the cursor to the position of the new extent
			 * we are about to insert as we can't trust it after
			 * we are about to insert as we can't trust it after
@@ -2759,12 +2763,12 @@ xfs_bmap_add_extent_unwritten_real(
					new->br_startblock, new->br_blockcount,
					new->br_startblock, new->br_blockcount,
					&i)))
					&i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 0, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
			/* new middle extent - newext */
			/* new middle extent - newext */
			cur->bc_rec.b.br_state = new->br_state;
			cur->bc_rec.b.br_state = new->br_state;
			if ((error = xfs_btree_insert(cur, &i)))
			if ((error = xfs_btree_insert(cur, &i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
		}
		}
		break;
		break;


@@ -2968,7 +2972,9 @@ xfs_bmap_add_extent_hole_real(
	xfs_bmbt_irec_t		right;	/* right neighbor extent entry */
	xfs_bmbt_irec_t		right;	/* right neighbor extent entry */
	int			rval=0;	/* return value (logging flags) */
	int			rval=0;	/* return value (logging flags) */
	int			state;	/* state bits, accessed thru macros */
	int			state;	/* state bits, accessed thru macros */
	struct xfs_mount	*mp;


	mp = bma->tp ? bma->tp->t_mountp : NULL;
	ifp = XFS_IFORK_PTR(bma->ip, whichfork);
	ifp = XFS_IFORK_PTR(bma->ip, whichfork);


	ASSERT(bma->idx >= 0);
	ASSERT(bma->idx >= 0);
@@ -3056,15 +3062,15 @@ xfs_bmap_add_extent_hole_real(
					&i);
					&i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_btree_delete(bma->cur, &i);
			error = xfs_btree_delete(bma->cur, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_btree_decrement(bma->cur, 0, &i);
			error = xfs_btree_decrement(bma->cur, 0, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_bmbt_update(bma->cur, left.br_startoff,
			error = xfs_bmbt_update(bma->cur, left.br_startoff,
					left.br_startblock,
					left.br_startblock,
					left.br_blockcount +
					left.br_blockcount +
@@ -3097,7 +3103,7 @@ xfs_bmap_add_extent_hole_real(
					&i);
					&i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_bmbt_update(bma->cur, left.br_startoff,
			error = xfs_bmbt_update(bma->cur, left.br_startoff,
					left.br_startblock,
					left.br_startblock,
					left.br_blockcount +
					left.br_blockcount +
@@ -3131,7 +3137,7 @@ xfs_bmap_add_extent_hole_real(
					right.br_blockcount, &i);
					right.br_blockcount, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			error = xfs_bmbt_update(bma->cur, new->br_startoff,
			error = xfs_bmbt_update(bma->cur, new->br_startoff,
					new->br_startblock,
					new->br_startblock,
					new->br_blockcount +
					new->br_blockcount +
@@ -3161,12 +3167,12 @@ xfs_bmap_add_extent_hole_real(
					new->br_blockcount, &i);
					new->br_blockcount, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 0, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 0, done);
			bma->cur->bc_rec.b.br_state = new->br_state;
			bma->cur->bc_rec.b.br_state = new->br_state;
			error = xfs_btree_insert(bma->cur, &i);
			error = xfs_btree_insert(bma->cur, &i);
			if (error)
			if (error)
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
		}
		}
		break;
		break;
	}
	}
@@ -4801,7 +4807,7 @@ xfs_bmap_del_extent(
					got.br_startblock, got.br_blockcount,
					got.br_startblock, got.br_blockcount,
					&i)))
					&i)))
				goto done;
				goto done;
			XFS_WANT_CORRUPTED_GOTO(i == 1, done);
			XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
		}
		}
		da_old = da_new = 0;
		da_old = da_new = 0;
	} else {
	} else {
@@ -4835,7 +4841,7 @@ xfs_bmap_del_extent(
		}
		}
		if ((error = xfs_btree_delete(cur, &i)))
		if ((error = xfs_btree_delete(cur, &i)))
			goto done;
			goto done;
		XFS_WANT_CORRUPTED_GOTO(i == 1, done);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
		break;
		break;


	case 2:
	case 2:
@@ -4935,7 +4941,8 @@ xfs_bmap_del_extent(
							got.br_startblock,
							got.br_startblock,
							temp, &i)))
							temp, &i)))
						goto done;
						goto done;
					XFS_WANT_CORRUPTED_GOTO(i == 1, done);
					XFS_WANT_CORRUPTED_GOTO(mp,
								i == 1, done);
					/*
					/*
					 * Update the btree record back
					 * Update the btree record back
					 * to the original value.
					 * to the original value.
@@ -4956,7 +4963,7 @@ xfs_bmap_del_extent(
					error = -ENOSPC;
					error = -ENOSPC;
					goto done;
					goto done;
				}
				}
				XFS_WANT_CORRUPTED_GOTO(i == 1, done);
				XFS_WANT_CORRUPTED_GOTO(mp, i == 1, done);
			} else
			} else
				flags |= xfs_ilog_fext(whichfork);
				flags |= xfs_ilog_fext(whichfork);
			XFS_IFORK_NEXT_SET(ip, whichfork,
			XFS_IFORK_NEXT_SET(ip, whichfork,
+9 −9
Original line number Original line Diff line number Diff line
@@ -2285,7 +2285,7 @@ xfs_btree_rshift(
	if (error)
	if (error)
		goto error0;
		goto error0;
	i = xfs_btree_lastrec(tcur, level);
	i = xfs_btree_lastrec(tcur, level);
	XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
	XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);


	error = xfs_btree_increment(tcur, level, &i);
	error = xfs_btree_increment(tcur, level, &i);
	if (error)
	if (error)
@@ -3138,7 +3138,7 @@ xfs_btree_insert(
			goto error0;
			goto error0;
		}
		}


		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
		level++;
		level++;


		/*
		/*
@@ -3582,15 +3582,15 @@ xfs_btree_delrec(
		 * Actually any entry but the first would suffice.
		 * Actually any entry but the first would suffice.
		 */
		 */
		i = xfs_btree_lastrec(tcur, level);
		i = xfs_btree_lastrec(tcur, level);
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);


		error = xfs_btree_increment(tcur, level, &i);
		error = xfs_btree_increment(tcur, level, &i);
		if (error)
		if (error)
			goto error0;
			goto error0;
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);


		i = xfs_btree_lastrec(tcur, level);
		i = xfs_btree_lastrec(tcur, level);
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);


		/* Grab a pointer to the block. */
		/* Grab a pointer to the block. */
		right = xfs_btree_get_block(tcur, level, &rbp);
		right = xfs_btree_get_block(tcur, level, &rbp);
@@ -3634,12 +3634,12 @@ xfs_btree_delrec(
		rrecs = xfs_btree_get_numrecs(right);
		rrecs = xfs_btree_get_numrecs(right);
		if (!xfs_btree_ptr_is_null(cur, &lptr)) {
		if (!xfs_btree_ptr_is_null(cur, &lptr)) {
			i = xfs_btree_firstrec(tcur, level);
			i = xfs_btree_firstrec(tcur, level);
			XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
			XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);


			error = xfs_btree_decrement(tcur, level, &i);
			error = xfs_btree_decrement(tcur, level, &i);
			if (error)
			if (error)
				goto error0;
				goto error0;
			XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
			XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);
		}
		}
	}
	}


@@ -3653,13 +3653,13 @@ xfs_btree_delrec(
		 * previous block.
		 * previous block.
		 */
		 */
		i = xfs_btree_firstrec(tcur, level);
		i = xfs_btree_firstrec(tcur, level);
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);


		error = xfs_btree_decrement(tcur, level, &i);
		error = xfs_btree_decrement(tcur, level, &i);
		if (error)
		if (error)
			goto error0;
			goto error0;
		i = xfs_btree_firstrec(tcur, level);
		i = xfs_btree_firstrec(tcur, level);
		XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
		XFS_WANT_CORRUPTED_GOTO(cur->bc_mp, i == 1, error0);


		/* Grab a pointer to the block. */
		/* Grab a pointer to the block. */
		left = xfs_btree_get_block(tcur, level, &lbp);
		left = xfs_btree_get_block(tcur, level, &lbp);
+12 −12

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Original line Diff line number Diff line
@@ -84,7 +84,7 @@ xfs_trim_extents(
		error = xfs_alloc_get_rec(cur, &fbno, &flen, &i);
		error = xfs_alloc_get_rec(cur, &fbno, &flen, &i);
		if (error)
		if (error)
			goto out_del_cursor;
			goto out_del_cursor;
		XFS_WANT_CORRUPTED_GOTO(i == 1, out_del_cursor);
		XFS_WANT_CORRUPTED_GOTO(mp, i == 1, out_del_cursor);
		ASSERT(flen <= be32_to_cpu(XFS_BUF_TO_AGF(agbp)->agf_longest));
		ASSERT(flen <= be32_to_cpu(XFS_BUF_TO_AGF(agbp)->agf_longest));


		/*
		/*
Loading