aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-09-27 20:58:17 -0400
committerTim Shimmin <tes@sgi.com>2006-09-27 20:58:17 -0400
commit8801bb99e4425b9a778b355153ab3254bb431d92 (patch)
tree56659910a182c468c40db7e56de7d37f940f5879 /fs/xfs/xfs_bmap_btree.c
parent576039cf3c668d5f8d97dff8a0a5817e8b3a761b (diff)
[XFS] endianess annotations for xfs_bmbt_key Trivial as there are no
incore users. SGI-PV: 954580 SGI-Modid: xfs-linux-melb:xfs-kern:26561a 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/xfs_bmap_btree.c')
-rw-r--r--fs/xfs/xfs_bmap_btree.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index f424cae96850..aab8e3f06aca 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -58,7 +58,7 @@ STATIC void xfs_bmbt_log_ptrs(xfs_btree_cur_t *, xfs_buf_t *, int, int);
58STATIC int xfs_bmbt_lshift(xfs_btree_cur_t *, int, int *); 58STATIC int xfs_bmbt_lshift(xfs_btree_cur_t *, int, int *);
59STATIC int xfs_bmbt_rshift(xfs_btree_cur_t *, int, int *); 59STATIC int xfs_bmbt_rshift(xfs_btree_cur_t *, int, int *);
60STATIC int xfs_bmbt_split(xfs_btree_cur_t *, int, xfs_fsblock_t *, 60STATIC int xfs_bmbt_split(xfs_btree_cur_t *, int, xfs_fsblock_t *,
61 xfs_bmbt_key_t *, xfs_btree_cur_t **, int *); 61 __uint64_t *, xfs_btree_cur_t **, int *);
62STATIC int xfs_bmbt_updkey(xfs_btree_cur_t *, xfs_bmbt_key_t *, int); 62STATIC int xfs_bmbt_updkey(xfs_btree_cur_t *, xfs_bmbt_key_t *, int);
63 63
64 64
@@ -192,16 +192,11 @@ xfs_bmbt_trace_argifk(
192 xfs_btree_cur_t *cur, 192 xfs_btree_cur_t *cur,
193 int i, 193 int i,
194 xfs_fsblock_t f, 194 xfs_fsblock_t f,
195 xfs_bmbt_key_t *k, 195 xfs_dfiloff_t o,
196 int line) 196 int line)
197{ 197{
198 xfs_dfsbno_t d;
199 xfs_dfiloff_t o;
200
201 d = (xfs_dfsbno_t)f;
202 o = INT_GET(k->br_startoff, ARCH_CONVERT);
203 xfs_bmbt_trace_enter(func, cur, ARGS, XFS_BMBT_KTRACE_ARGIFK, line, 198 xfs_bmbt_trace_enter(func, cur, ARGS, XFS_BMBT_KTRACE_ARGIFK, line,
204 i, d >> 32, (int)d, o >> 32, 199 i, (xfs_dfsbno_t)f >> 32, (int)f, o >> 32,
205 (int)o, 0, 0, 0, 200 (int)o, 0, 0, 0,
206 0, 0, 0); 201 0, 0, 0);
207} 202}
@@ -248,7 +243,7 @@ xfs_bmbt_trace_argik(
248{ 243{
249 xfs_dfiloff_t o; 244 xfs_dfiloff_t o;
250 245
251 o = INT_GET(k->br_startoff, ARCH_CONVERT); 246 o = be64_to_cpu(k->br_startoff);
252 xfs_bmbt_trace_enter(func, cur, ARGS, XFS_BMBT_KTRACE_ARGIFK, line, 247 xfs_bmbt_trace_enter(func, cur, ARGS, XFS_BMBT_KTRACE_ARGIFK, line,
253 i, o >> 32, (int)o, 0, 248 i, o >> 32, (int)o, 0,
254 0, 0, 0, 0, 249 0, 0, 0, 0,
@@ -286,8 +281,8 @@ xfs_bmbt_trace_cursor(
286 xfs_bmbt_trace_argfffi(fname, c, o, b, i, j, __LINE__) 281 xfs_bmbt_trace_argfffi(fname, c, o, b, i, j, __LINE__)
287#define XFS_BMBT_TRACE_ARGI(c,i) \ 282#define XFS_BMBT_TRACE_ARGI(c,i) \
288 xfs_bmbt_trace_argi(fname, c, i, __LINE__) 283 xfs_bmbt_trace_argi(fname, c, i, __LINE__)
289#define XFS_BMBT_TRACE_ARGIFK(c,i,f,k) \ 284#define XFS_BMBT_TRACE_ARGIFK(c,i,f,s) \
290 xfs_bmbt_trace_argifk(fname, c, i, f, k, __LINE__) 285 xfs_bmbt_trace_argifk(fname, c, i, f, s, __LINE__)
291#define XFS_BMBT_TRACE_ARGIFR(c,i,f,r) \ 286#define XFS_BMBT_TRACE_ARGIFR(c,i,f,r) \
292 xfs_bmbt_trace_argifr(fname, c, i, f, r, __LINE__) 287 xfs_bmbt_trace_argifr(fname, c, i, f, r, __LINE__)
293#define XFS_BMBT_TRACE_ARGIK(c,i,k) \ 288#define XFS_BMBT_TRACE_ARGIK(c,i,k) \
@@ -299,7 +294,7 @@ xfs_bmbt_trace_cursor(
299#define XFS_BMBT_TRACE_ARGBII(c,b,i,j) 294#define XFS_BMBT_TRACE_ARGBII(c,b,i,j)
300#define XFS_BMBT_TRACE_ARGFFFI(c,o,b,i,j) 295#define XFS_BMBT_TRACE_ARGFFFI(c,o,b,i,j)
301#define XFS_BMBT_TRACE_ARGI(c,i) 296#define XFS_BMBT_TRACE_ARGI(c,i)
302#define XFS_BMBT_TRACE_ARGIFK(c,i,f,k) 297#define XFS_BMBT_TRACE_ARGIFK(c,i,f,s)
303#define XFS_BMBT_TRACE_ARGIFR(c,i,f,r) 298#define XFS_BMBT_TRACE_ARGIFR(c,i,f,r)
304#define XFS_BMBT_TRACE_ARGIK(c,i,k) 299#define XFS_BMBT_TRACE_ARGIK(c,i,k)
305#define XFS_BMBT_TRACE_CURSOR(c,s) 300#define XFS_BMBT_TRACE_CURSOR(c,s)
@@ -404,7 +399,8 @@ xfs_bmbt_delrec(
404 xfs_bmbt_log_recs(cur, bp, ptr, numrecs - 1); 399 xfs_bmbt_log_recs(cur, bp, ptr, numrecs - 1);
405 } 400 }
406 if (ptr == 1) { 401 if (ptr == 1) {
407 INT_SET(key.br_startoff, ARCH_CONVERT, xfs_bmbt_disk_get_startoff(rp)); 402 key.br_startoff =
403 cpu_to_be64(xfs_bmbt_disk_get_startoff(rp));
408 kp = &key; 404 kp = &key;
409 } 405 }
410 } 406 }
@@ -748,7 +744,7 @@ xfs_bmbt_insrec(
748 int logflags; /* inode logging flags */ 744 int logflags; /* inode logging flags */
749 xfs_fsblock_t nbno; /* new block number */ 745 xfs_fsblock_t nbno; /* new block number */
750 struct xfs_btree_cur *ncur; /* new btree cursor */ 746 struct xfs_btree_cur *ncur; /* new btree cursor */
751 xfs_bmbt_key_t nkey; /* new btree key value */ 747 __uint64_t startoff; /* new btree key value */
752 xfs_bmbt_rec_t nrec; /* new record count */ 748 xfs_bmbt_rec_t nrec; /* new record count */
753 int optr; /* old key/record index */ 749 int optr; /* old key/record index */
754 xfs_bmbt_ptr_t *pp; /* pointer to bmap block addr */ 750 xfs_bmbt_ptr_t *pp; /* pointer to bmap block addr */
@@ -760,8 +756,7 @@ xfs_bmbt_insrec(
760 XFS_BMBT_TRACE_CURSOR(cur, ENTRY); 756 XFS_BMBT_TRACE_CURSOR(cur, ENTRY);
761 XFS_BMBT_TRACE_ARGIFR(cur, level, *bnop, recp); 757 XFS_BMBT_TRACE_ARGIFR(cur, level, *bnop, recp);
762 ncur = (xfs_btree_cur_t *)0; 758 ncur = (xfs_btree_cur_t *)0;
763 INT_SET(key.br_startoff, ARCH_CONVERT, 759 key.br_startoff = cpu_to_be64(xfs_bmbt_disk_get_startoff(recp));
764 xfs_bmbt_disk_get_startoff(recp));
765 optr = ptr = cur->bc_ptrs[level]; 760 optr = ptr = cur->bc_ptrs[level];
766 if (ptr == 0) { 761 if (ptr == 0) {
767 XFS_BMBT_TRACE_CURSOR(cur, EXIT); 762 XFS_BMBT_TRACE_CURSOR(cur, EXIT);
@@ -820,7 +815,7 @@ xfs_bmbt_insrec(
820 optr = ptr = cur->bc_ptrs[level]; 815 optr = ptr = cur->bc_ptrs[level];
821 } else { 816 } else {
822 if ((error = xfs_bmbt_split(cur, level, 817 if ((error = xfs_bmbt_split(cur, level,
823 &nbno, &nkey, &ncur, 818 &nbno, &startoff, &ncur,
824 &i))) { 819 &i))) {
825 XFS_BMBT_TRACE_CURSOR(cur, 820 XFS_BMBT_TRACE_CURSOR(cur,
826 ERROR); 821 ERROR);
@@ -840,7 +835,7 @@ xfs_bmbt_insrec(
840#endif 835#endif
841 ptr = cur->bc_ptrs[level]; 836 ptr = cur->bc_ptrs[level];
842 xfs_bmbt_disk_set_allf(&nrec, 837 xfs_bmbt_disk_set_allf(&nrec,
843 nkey.br_startoff, 0, 0, 838 startoff, 0, 0,
844 XFS_EXT_NORM); 839 XFS_EXT_NORM);
845 } else { 840 } else {
846 XFS_BMBT_TRACE_CURSOR(cur, 841 XFS_BMBT_TRACE_CURSOR(cur,
@@ -1169,7 +1164,7 @@ xfs_bmbt_lookup(
1169 keyno = (low + high) >> 1; 1164 keyno = (low + high) >> 1;
1170 if (level > 0) { 1165 if (level > 0) {
1171 kkp = kkbase + keyno - 1; 1166 kkp = kkbase + keyno - 1;
1172 startoff = INT_GET(kkp->br_startoff, ARCH_CONVERT); 1167 startoff = be64_to_cpu(kkp->br_startoff);
1173 } else { 1168 } else {
1174 krp = krbase + keyno - 1; 1169 krp = krbase + keyno - 1;
1175 startoff = xfs_bmbt_disk_get_startoff(krp); 1170 startoff = xfs_bmbt_disk_get_startoff(krp);
@@ -1353,8 +1348,7 @@ xfs_bmbt_lshift(
1353 } else { 1348 } else {
1354 memmove(rrp, rrp + 1, rrecs * sizeof(*rrp)); 1349 memmove(rrp, rrp + 1, rrecs * sizeof(*rrp));
1355 xfs_bmbt_log_recs(cur, rbp, 1, rrecs); 1350 xfs_bmbt_log_recs(cur, rbp, 1, rrecs);
1356 INT_SET(key.br_startoff, ARCH_CONVERT, 1351 key.br_startoff = cpu_to_be64(xfs_bmbt_disk_get_startoff(rrp));
1357 xfs_bmbt_disk_get_startoff(rrp));
1358 rkp = &key; 1352 rkp = &key;
1359 } 1353 }
1360 if ((error = xfs_bmbt_updkey(cur, rkp, level + 1))) { 1354 if ((error = xfs_bmbt_updkey(cur, rkp, level + 1))) {
@@ -1468,8 +1462,7 @@ xfs_bmbt_rshift(
1468 memmove(rrp + 1, rrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp)); 1462 memmove(rrp + 1, rrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
1469 *rrp = *lrp; 1463 *rrp = *lrp;
1470 xfs_bmbt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1); 1464 xfs_bmbt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1);
1471 INT_SET(key.br_startoff, ARCH_CONVERT, 1465 key.br_startoff = cpu_to_be64(xfs_bmbt_disk_get_startoff(rrp));
1472 xfs_bmbt_disk_get_startoff(rrp));
1473 rkp = &key; 1466 rkp = &key;
1474 } 1467 }
1475 be16_add(&left->bb_numrecs, -1); 1468 be16_add(&left->bb_numrecs, -1);
@@ -1534,7 +1527,7 @@ xfs_bmbt_split(
1534 xfs_btree_cur_t *cur, 1527 xfs_btree_cur_t *cur,
1535 int level, 1528 int level,
1536 xfs_fsblock_t *bnop, 1529 xfs_fsblock_t *bnop,
1537 xfs_bmbt_key_t *keyp, 1530 __uint64_t *startoff,
1538 xfs_btree_cur_t **curp, 1531 xfs_btree_cur_t **curp,
1539 int *stat) /* success/failure */ 1532 int *stat) /* success/failure */
1540{ 1533{
@@ -1559,7 +1552,7 @@ xfs_bmbt_split(
1559 xfs_bmbt_rec_t *rrp; /* right record pointer */ 1552 xfs_bmbt_rec_t *rrp; /* right record pointer */
1560 1553
1561 XFS_BMBT_TRACE_CURSOR(cur, ENTRY); 1554 XFS_BMBT_TRACE_CURSOR(cur, ENTRY);
1562 XFS_BMBT_TRACE_ARGIFK(cur, level, *bnop, keyp); 1555 XFS_BMBT_TRACE_ARGIFK(cur, level, *bnop, *startoff);
1563 args.tp = cur->bc_tp; 1556 args.tp = cur->bc_tp;
1564 args.mp = cur->bc_mp; 1557 args.mp = cur->bc_mp;
1565 lbp = cur->bc_bufs[level]; 1558 lbp = cur->bc_bufs[level];
@@ -1628,13 +1621,13 @@ xfs_bmbt_split(
1628 memcpy(rpp, lpp, be16_to_cpu(right->bb_numrecs) * sizeof(*rpp)); 1621 memcpy(rpp, lpp, be16_to_cpu(right->bb_numrecs) * sizeof(*rpp));
1629 xfs_bmbt_log_keys(cur, rbp, 1, be16_to_cpu(right->bb_numrecs)); 1622 xfs_bmbt_log_keys(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1630 xfs_bmbt_log_ptrs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs)); 1623 xfs_bmbt_log_ptrs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1631 keyp->br_startoff = INT_GET(rkp->br_startoff, ARCH_CONVERT); 1624 *startoff = be64_to_cpu(rkp->br_startoff);
1632 } else { 1625 } else {
1633 lrp = XFS_BMAP_REC_IADDR(left, i, cur); 1626 lrp = XFS_BMAP_REC_IADDR(left, i, cur);
1634 rrp = XFS_BMAP_REC_IADDR(right, 1, cur); 1627 rrp = XFS_BMAP_REC_IADDR(right, 1, cur);
1635 memcpy(rrp, lrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp)); 1628 memcpy(rrp, lrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
1636 xfs_bmbt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs)); 1629 xfs_bmbt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1637 keyp->br_startoff = xfs_bmbt_disk_get_startoff(rrp); 1630 *startoff = xfs_bmbt_disk_get_startoff(rrp);
1638 } 1631 }
1639 be16_add(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs))); 1632 be16_add(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs)));
1640 right->bb_rightsib = left->bb_rightsib; 1633 right->bb_rightsib = left->bb_rightsib;
@@ -2738,7 +2731,7 @@ xfs_bmbt_update(
2738 XFS_BMBT_TRACE_CURSOR(cur, EXIT); 2731 XFS_BMBT_TRACE_CURSOR(cur, EXIT);
2739 return 0; 2732 return 0;
2740 } 2733 }
2741 INT_SET(key.br_startoff, ARCH_CONVERT, off); 2734 key.br_startoff = cpu_to_be64(off);
2742 if ((error = xfs_bmbt_updkey(cur, &key, 1))) { 2735 if ((error = xfs_bmbt_updkey(cur, &key, 1))) {
2743 XFS_BMBT_TRACE_CURSOR(cur, ERROR); 2736 XFS_BMBT_TRACE_CURSOR(cur, ERROR);
2744 return error; 2737 return error;