aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-09-27 20:57:42 -0400
committerTim Shimmin <tes@sgi.com>2006-09-27 20:57:42 -0400
commitb113bcb83efb411f3cc6c7692fbf933ed01b67d8 (patch)
tree8b414cbdc2f8fdffbaa7a93e8e11d0d1679a5bc5 /fs/xfs
parentc38e5e84dbbeda9a92ea878ec9f6255b519a69e7 (diff)
[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: Christoph Hellwig <hch@lst.de> Signed-off-by: Nathan Scott <nathans@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_bmap.c2
-rw-r--r--fs/xfs/xfs_bmap_btree.c24
-rw-r--r--fs/xfs/xfs_btree.h3
3 files changed, 16 insertions, 13 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index bf46fae303af..b1efb906dbbd 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -3013,7 +3013,7 @@ xfs_bmap_btree_to_extents(
3013 pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes); 3013 pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes);
3014 *logflagsp = 0; 3014 *logflagsp = 0;
3015#ifdef DEBUG 3015#ifdef DEBUG
3016 if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), 1))) 3016 if ((error = xfs_btree_check_lptr_disk(cur, *pp, 1)))
3017 return error; 3017 return error;
3018#endif 3018#endif
3019 cbno = INT_GET(*pp, ARCH_CONVERT); 3019 cbno = INT_GET(*pp, ARCH_CONVERT);
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 18fb7385d719..270cfe380504 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -382,7 +382,7 @@ xfs_bmbt_delrec(
382 pp = XFS_BMAP_PTR_IADDR(block, 1, cur); 382 pp = XFS_BMAP_PTR_IADDR(block, 1, cur);
383#ifdef DEBUG 383#ifdef DEBUG
384 for (i = ptr; i < numrecs; i++) { 384 for (i = ptr; i < numrecs; i++) {
385 if ((error = xfs_btree_check_lptr(cur, INT_GET(pp[i], ARCH_CONVERT), level))) { 385 if ((error = xfs_btree_check_lptr_disk(cur, pp[i], level))) {
386 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 386 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
387 goto error0; 387 goto error0;
388 } 388 }
@@ -621,7 +621,7 @@ xfs_bmbt_delrec(
621 rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); 621 rpp = XFS_BMAP_PTR_IADDR(right, 1, cur);
622#ifdef DEBUG 622#ifdef DEBUG
623 for (i = 0; i < numrrecs; i++) { 623 for (i = 0; i < numrrecs; i++) {
624 if ((error = xfs_btree_check_lptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) { 624 if ((error = xfs_btree_check_lptr_disk(cur, rpp[i], level))) {
625 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 625 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
626 goto error0; 626 goto error0;
627 } 627 }
@@ -858,7 +858,7 @@ xfs_bmbt_insrec(
858 pp = XFS_BMAP_PTR_IADDR(block, 1, cur); 858 pp = XFS_BMAP_PTR_IADDR(block, 1, cur);
859#ifdef DEBUG 859#ifdef DEBUG
860 for (i = numrecs; i >= ptr; i--) { 860 for (i = numrecs; i >= ptr; i--) {
861 if ((error = xfs_btree_check_lptr(cur, INT_GET(pp[i - 1], ARCH_CONVERT), 861 if ((error = xfs_btree_check_lptr_disk(cur, pp[i - 1],
862 level))) { 862 level))) {
863 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 863 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
864 return error; 864 return error;
@@ -988,7 +988,7 @@ xfs_bmbt_killroot(
988 cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur); 988 cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur);
989#ifdef DEBUG 989#ifdef DEBUG
990 for (i = 0; i < be16_to_cpu(cblock->bb_numrecs); i++) { 990 for (i = 0; i < be16_to_cpu(cblock->bb_numrecs); i++) {
991 if ((error = xfs_btree_check_lptr(cur, INT_GET(cpp[i], ARCH_CONVERT), level - 1))) { 991 if ((error = xfs_btree_check_lptr_disk(cur, cpp[i], level - 1))) {
992 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 992 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
993 return error; 993 return error;
994 } 994 }
@@ -1190,7 +1190,7 @@ xfs_bmbt_lookup(
1190 keyno = 1; 1190 keyno = 1;
1191 pp = XFS_BMAP_PTR_IADDR(block, keyno, cur); 1191 pp = XFS_BMAP_PTR_IADDR(block, keyno, cur);
1192#ifdef DEBUG 1192#ifdef DEBUG
1193 if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), level))) { 1193 if ((error = xfs_btree_check_lptr_disk(cur, *pp, level))) {
1194 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 1194 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
1195 return error; 1195 return error;
1196 } 1196 }
@@ -1313,7 +1313,7 @@ xfs_bmbt_lshift(
1313 lpp = XFS_BMAP_PTR_IADDR(left, lrecs, cur); 1313 lpp = XFS_BMAP_PTR_IADDR(left, lrecs, cur);
1314 rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); 1314 rpp = XFS_BMAP_PTR_IADDR(right, 1, cur);
1315#ifdef DEBUG 1315#ifdef DEBUG
1316 if ((error = xfs_btree_check_lptr(cur, INT_GET(*rpp, ARCH_CONVERT), level))) { 1316 if ((error = xfs_btree_check_lptr_disk(cur, *rpp, level))) {
1317 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 1317 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
1318 return error; 1318 return error;
1319 } 1319 }
@@ -1340,7 +1340,7 @@ xfs_bmbt_lshift(
1340 if (level > 0) { 1340 if (level > 0) {
1341#ifdef DEBUG 1341#ifdef DEBUG
1342 for (i = 0; i < rrecs; i++) { 1342 for (i = 0; i < rrecs; i++) {
1343 if ((error = xfs_btree_check_lptr(cur, INT_GET(rpp[i + 1], ARCH_CONVERT), 1343 if ((error = xfs_btree_check_lptr_disk(cur, rpp[i + 1],
1344 level))) { 1344 level))) {
1345 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 1345 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
1346 return error; 1346 return error;
@@ -1445,7 +1445,7 @@ xfs_bmbt_rshift(
1445 rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); 1445 rpp = XFS_BMAP_PTR_IADDR(right, 1, cur);
1446#ifdef DEBUG 1446#ifdef DEBUG
1447 for (i = be16_to_cpu(right->bb_numrecs) - 1; i >= 0; i--) { 1447 for (i = be16_to_cpu(right->bb_numrecs) - 1; i >= 0; i--) {
1448 if ((error = xfs_btree_check_lptr(cur, INT_GET(rpp[i], ARCH_CONVERT), level))) { 1448 if ((error = xfs_btree_check_lptr_disk(cur, rpp[i] level))) {
1449 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 1449 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
1450 return error; 1450 return error;
1451 } 1451 }
@@ -1454,7 +1454,7 @@ xfs_bmbt_rshift(
1454 memmove(rkp + 1, rkp, be16_to_cpu(right->bb_numrecs) * sizeof(*rkp)); 1454 memmove(rkp + 1, rkp, be16_to_cpu(right->bb_numrecs) * sizeof(*rkp));
1455 memmove(rpp + 1, rpp, be16_to_cpu(right->bb_numrecs) * sizeof(*rpp)); 1455 memmove(rpp + 1, rpp, be16_to_cpu(right->bb_numrecs) * sizeof(*rpp));
1456#ifdef DEBUG 1456#ifdef DEBUG
1457 if ((error = xfs_btree_check_lptr(cur, INT_GET(*lpp, ARCH_CONVERT), level))) { 1457 if ((error = xfs_btree_check_lptr_disk(cur, *lpp, level))) {
1458 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 1458 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
1459 return error; 1459 return error;
1460 } 1460 }
@@ -1619,7 +1619,7 @@ xfs_bmbt_split(
1619 rpp = XFS_BMAP_PTR_IADDR(right, 1, cur); 1619 rpp = XFS_BMAP_PTR_IADDR(right, 1, cur);
1620#ifdef DEBUG 1620#ifdef DEBUG
1621 for (i = 0; i < be16_to_cpu(right->bb_numrecs); i++) { 1621 for (i = 0; i < be16_to_cpu(right->bb_numrecs); i++) {
1622 if ((error = xfs_btree_check_lptr(cur, INT_GET(lpp[i], ARCH_CONVERT), level))) { 1622 if ((error = xfs_btree_check_lptr_disk(cur, lpp[i], level))) {
1623 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 1623 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
1624 return error; 1624 return error;
1625 } 1625 }
@@ -2356,7 +2356,7 @@ xfs_bmbt_newroot(
2356 args.firstblock = args.fsbno; 2356 args.firstblock = args.fsbno;
2357 if (args.fsbno == NULLFSBLOCK) { 2357 if (args.fsbno == NULLFSBLOCK) {
2358#ifdef DEBUG 2358#ifdef DEBUG
2359 if ((error = xfs_btree_check_lptr(cur, INT_GET(*pp, ARCH_CONVERT), level))) { 2359 if ((error = xfs_btree_check_lptr_disk(cur, *pp, level))) {
2360 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 2360 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
2361 return error; 2361 return error;
2362 } 2362 }
@@ -2393,7 +2393,7 @@ xfs_bmbt_newroot(
2393 cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur); 2393 cpp = XFS_BMAP_PTR_IADDR(cblock, 1, cur);
2394#ifdef DEBUG 2394#ifdef DEBUG
2395 for (i = 0; i < be16_to_cpu(cblock->bb_numrecs); i++) { 2395 for (i = 0; i < be16_to_cpu(cblock->bb_numrecs); i++) {
2396 if ((error = xfs_btree_check_lptr(cur, INT_GET(pp[i], ARCH_CONVERT), level))) { 2396 if ((error = xfs_btree_check_lptr_disk(cur, pp[i], level))) {
2397 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 2397 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
2398 return error; 2398 return error;
2399 } 2399 }
diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h
index 2ab156506aca..8bbcfeba1a9e 100644
--- a/fs/xfs/xfs_btree.h
+++ b/fs/xfs/xfs_btree.h
@@ -243,6 +243,9 @@ xfs_btree_check_lptr(
243 xfs_dfsbno_t ptr, /* btree block disk address */ 243 xfs_dfsbno_t ptr, /* btree block disk address */
244 int level); /* btree block level */ 244 int level); /* btree block level */
245 245
246#define xfs_btree_check_lptr_disk(cur, ptr, level) \
247 xfs_btree_check_lptr(cur, INT_GET(ptr, ARCH_CONVERT), level)
248
246/* 249/*
247 * Checking routine: check that short form block header is ok. 250 * Checking routine: check that short form block header is ok.
248 */ 251 */