Commit b113bcb8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Tim Shimmin

[XFS] add xfs_btree_check_lptr_disk variant which handles endian

conversion

SGI-PV: 954580
SGI-Modid: xfs-linux-melb:xfs-kern:26558a
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
Signed-off-by: default avatarTim Shimmin <tes@sgi.com>
parent c38e5e84
...@@ -3013,7 +3013,7 @@ xfs_bmap_btree_to_extents( ...@@ -3013,7 +3013,7 @@ xfs_bmap_btree_to_extents(
pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes); pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes);
*logflagsp = 0; *logflagsp = 0;
#ifdef DEBUG #ifdef DEBUG
if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), 1))) if ((error = xfs_btree_check_lptr_disk(cur, *pp, 1)))
return error; return error;
#endif #endif
cbno = INT_GET(*pp, ARCH_CONVERT); cbno = INT_GET(*pp, ARCH_CONVERT);
......
...@@ -382,7 +382,7 @@ xfs_bmbt_delrec( ...@@ -382,7 +382,7 @@ xfs_bmbt_delrec(
pp = XFS_BMAP_PTR_IADDR(block, 1, cur); pp = XFS_BMAP_PTR_IADDR(block, 1, cur);
#ifdef DEBUG #ifdef DEBUG
for (i = ptr; i < numrecs; i++) { for (i = ptr; i < numrecs; i++) {
if ((error = xfs_btree_check_lptr(cur, INT_GET(pp[i], ARCH_CONVERT), level))) { if ((error = xfs_btree_check_lptr_disk(cur, pp[i], level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
goto error0; goto error0;
} }
...@@ -621,7 +621,7 @@ xfs_bmbt_delrec( ...@@ -621,7 +621,7 @@ xfs_bmbt_delrec(
rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); rpp = XFS_BMAP_PTR_IADDR(right, 1, cur);
#ifdef DEBUG #ifdef DEBUG
for (i = 0; i < numrrecs; i++) { for (i = 0; i < numrrecs; i++) {
if ((error = xfs_btree_check_lptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) { if ((error = xfs_btree_check_lptr_disk(cur, rpp[i], level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
goto error0; goto error0;
} }
...@@ -858,7 +858,7 @@ xfs_bmbt_insrec( ...@@ -858,7 +858,7 @@ xfs_bmbt_insrec(
pp = XFS_BMAP_PTR_IADDR(block, 1, cur); pp = XFS_BMAP_PTR_IADDR(block, 1, cur);
#ifdef DEBUG #ifdef DEBUG
for (i = numrecs; i >= ptr; i--) { for (i = numrecs; i >= ptr; i--) {
if ((error = xfs_btree_check_lptr(cur, INT_GET(pp[i - 1], ARCH_CONVERT), if ((error = xfs_btree_check_lptr_disk(cur, pp[i - 1],
level))) { level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
return error; return error;
...@@ -988,7 +988,7 @@ xfs_bmbt_killroot( ...@@ -988,7 +988,7 @@ xfs_bmbt_killroot(
cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur); cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur);
#ifdef DEBUG #ifdef DEBUG
for (i = 0; i < be16_to_cpu(cblock->bb_numrecs); i++) { for (i = 0; i < be16_to_cpu(cblock->bb_numrecs); i++) {
if ((error = xfs_btree_check_lptr(cur, INT_GET(cpp[i], ARCH_CONVERT), level - 1))) { if ((error = xfs_btree_check_lptr_disk(cur, cpp[i], level - 1))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
return error; return error;
} }
...@@ -1190,7 +1190,7 @@ xfs_bmbt_lookup( ...@@ -1190,7 +1190,7 @@ xfs_bmbt_lookup(
keyno = 1; keyno = 1;
pp = XFS_BMAP_PTR_IADDR(block, keyno, cur); pp = XFS_BMAP_PTR_IADDR(block, keyno, cur);
#ifdef DEBUG #ifdef DEBUG
if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), level))) { if ((error = xfs_btree_check_lptr_disk(cur, *pp, level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
return error; return error;
} }
...@@ -1313,7 +1313,7 @@ xfs_bmbt_lshift( ...@@ -1313,7 +1313,7 @@ xfs_bmbt_lshift(
lpp = XFS_BMAP_PTR_IADDR(left, lrecs, cur); lpp = XFS_BMAP_PTR_IADDR(left, lrecs, cur);
rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); rpp = XFS_BMAP_PTR_IADDR(right, 1, cur);
#ifdef DEBUG #ifdef DEBUG
if ((error = xfs_btree_check_lptr(cur, INT_GET(*rpp, ARCH_CONVERT), level))) { if ((error = xfs_btree_check_lptr_disk(cur, *rpp, level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
return error; return error;
} }
...@@ -1340,7 +1340,7 @@ xfs_bmbt_lshift( ...@@ -1340,7 +1340,7 @@ xfs_bmbt_lshift(
if (level > 0) { if (level > 0) {
#ifdef DEBUG #ifdef DEBUG
for (i = 0; i < rrecs; i++) { for (i = 0; i < rrecs; i++) {
if ((error = xfs_btree_check_lptr(cur, INT_GET(rpp[i + 1], ARCH_CONVERT), if ((error = xfs_btree_check_lptr_disk(cur, rpp[i + 1],
level))) { level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
return error; return error;
...@@ -1445,7 +1445,7 @@ xfs_bmbt_rshift( ...@@ -1445,7 +1445,7 @@ xfs_bmbt_rshift(
rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); rpp = XFS_BMAP_PTR_IADDR(right, 1, cur);
#ifdef DEBUG #ifdef DEBUG
for (i = be16_to_cpu(right->bb_numrecs) - 1; i >= 0; i--) { for (i = be16_to_cpu(right->bb_numrecs) - 1; i >= 0; i--) {
if ((error = xfs_btree_check_lptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) { if ((error = xfs_btree_check_lptr_disk(cur, rpp[i] level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
return error; return error;
} }
...@@ -1454,7 +1454,7 @@ xfs_bmbt_rshift( ...@@ -1454,7 +1454,7 @@ xfs_bmbt_rshift(
memmove(rkp + 1, rkp, be16_to_cpu(right->bb_numrecs) * sizeof(*rkp)); memmove(rkp + 1, rkp, be16_to_cpu(right->bb_numrecs) * sizeof(*rkp));
memmove(rpp + 1, rpp, be16_to_cpu(right->bb_numrecs) * sizeof(*rpp)); memmove(rpp + 1, rpp, be16_to_cpu(right->bb_numrecs) * sizeof(*rpp));
#ifdef DEBUG #ifdef DEBUG
if ((error = xfs_btree_check_lptr(cur, INT_GET(*lpp, ARCH_CONVERT), level))) { if ((error = xfs_btree_check_lptr_disk(cur, *lpp, level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
return error; return error;
} }
...@@ -1619,7 +1619,7 @@ xfs_bmbt_split( ...@@ -1619,7 +1619,7 @@ xfs_bmbt_split(
rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); rpp = XFS_BMAP_PTR_IADDR(right, 1, cur);
#ifdef DEBUG #ifdef DEBUG
for (i = 0; i < be16_to_cpu(right->bb_numrecs); i++) { for (i = 0; i < be16_to_cpu(right->bb_numrecs); i++) {
if ((error = xfs_btree_check_lptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level))) { if ((error = xfs_btree_check_lptr_disk(cur, lpp[i], level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
return error; return error;
} }
...@@ -2356,7 +2356,7 @@ xfs_bmbt_newroot( ...@@ -2356,7 +2356,7 @@ xfs_bmbt_newroot(
args.firstblock = args.fsbno; args.firstblock = args.fsbno;
if (args.fsbno == NULLFSBLOCK) { if (args.fsbno == NULLFSBLOCK) {
#ifdef DEBUG #ifdef DEBUG
if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), level))) { if ((error = xfs_btree_check_lptr_disk(cur, *pp, level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
return error; return error;
} }
...@@ -2393,7 +2393,7 @@ xfs_bmbt_newroot( ...@@ -2393,7 +2393,7 @@ xfs_bmbt_newroot(
cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur); cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur);
#ifdef DEBUG #ifdef DEBUG
for (i = 0; i < be16_to_cpu(cblock->bb_numrecs); i++) { for (i = 0; i < be16_to_cpu(cblock->bb_numrecs); i++) {
if ((error = xfs_btree_check_lptr(cur, INT_GET(pp[i], ARCH_CONVERT), level))) { if ((error = xfs_btree_check_lptr_disk(cur, pp[i], level))) {
XFS_BMBT_TRACE_CURSOR(cur, ERROR); XFS_BMBT_TRACE_CURSOR(cur, ERROR);
return error; return error;
} }
......
...@@ -243,6 +243,9 @@ xfs_btree_check_lptr( ...@@ -243,6 +243,9 @@ xfs_btree_check_lptr(
xfs_dfsbno_t ptr, /* btree block disk address */ xfs_dfsbno_t ptr, /* btree block disk address */
int level); /* btree block level */ int level); /* btree block level */
#define xfs_btree_check_lptr_disk(cur, ptr, level) \
xfs_btree_check_lptr(cur, INT_GET(ptr, ARCH_CONVERT), level)
/* /*
* Checking routine: check that short form block header is ok. * Checking routine: check that short form block header is ok.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment