2 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "xfs_types.h"
24 #include "xfs_trans.h"
28 #include "xfs_dmapi.h"
29 #include "xfs_mount.h"
30 #include "xfs_bmap_btree.h"
31 #include "xfs_alloc_btree.h"
32 #include "xfs_ialloc_btree.h"
33 #include "xfs_dir2_sf.h"
34 #include "xfs_attr_sf.h"
35 #include "xfs_dinode.h"
36 #include "xfs_inode.h"
37 #include "xfs_btree.h"
38 #include "xfs_ialloc.h"
39 #include "xfs_error.h"
42 * Cursor allocation zone.
44 kmem_zone_t *xfs_btree_cur_zone;
47 * Btree magic numbers.
49 const __uint32_t xfs_magics[XFS_BTNUM_MAX] = {
50 XFS_ABTB_MAGIC, XFS_ABTC_MAGIC, XFS_BMAP_MAGIC, XFS_IBT_MAGIC
54 * Checking routine: return maxrecs for the block.
56 STATIC int /* number of records fitting in block */
58 xfs_btree_cur_t *cur, /* btree cursor */
59 xfs_btree_block_t *block) /* generic btree block pointer */
61 switch (cur->bc_btnum) {
64 return (int)XFS_ALLOC_BLOCK_MAXRECS(
65 be16_to_cpu(block->bb_level), cur);
67 return (int)XFS_BMAP_BLOCK_IMAXRECS(
68 be16_to_cpu(block->bb_level), cur);
70 return (int)XFS_INOBT_BLOCK_MAXRECS(
71 be16_to_cpu(block->bb_level), cur);
84 * Debug routine: check that block header is ok.
87 xfs_btree_check_block(
88 xfs_btree_cur_t *cur, /* btree cursor */
89 xfs_btree_block_t *block, /* generic btree block pointer */
90 int level, /* level of the btree block */
91 xfs_buf_t *bp) /* buffer containing block, if any */
93 if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
94 xfs_btree_check_lblock(cur, (xfs_btree_lblock_t *)block, level,
97 xfs_btree_check_sblock(cur, (xfs_btree_sblock_t *)block, level,
102 * Debug routine: check that keys are in the right order.
106 xfs_btnum_t btnum, /* btree identifier */
107 void *ak1, /* pointer to left (lower) key */
108 void *ak2) /* pointer to right (higher) key */
111 case XFS_BTNUM_BNO: {
117 ASSERT(be32_to_cpu(k1->ar_startblock) < be32_to_cpu(k2->ar_startblock));
120 case XFS_BTNUM_CNT: {
126 ASSERT(be32_to_cpu(k1->ar_blockcount) < be32_to_cpu(k2->ar_blockcount) ||
127 (k1->ar_blockcount == k2->ar_blockcount &&
128 be32_to_cpu(k1->ar_startblock) < be32_to_cpu(k2->ar_startblock)));
131 case XFS_BTNUM_BMAP: {
137 ASSERT(be64_to_cpu(k1->br_startoff) < be64_to_cpu(k2->br_startoff));
140 case XFS_BTNUM_INO: {
146 ASSERT(be32_to_cpu(k1->ir_startino) < be32_to_cpu(k2->ir_startino));
156 * Checking routine: check that long form block header is ok.
159 int /* error (0 or EFSCORRUPTED) */
160 xfs_btree_check_lblock(
161 xfs_btree_cur_t *cur, /* btree cursor */
162 xfs_btree_lblock_t *block, /* btree long form block pointer */
163 int level, /* level of the btree block */
164 xfs_buf_t *bp) /* buffer for block, if any */
166 int lblock_ok; /* block passes checks */
167 xfs_mount_t *mp; /* file system mount point */
171 be32_to_cpu(block->bb_magic) == xfs_magics[cur->bc_btnum] &&
172 be16_to_cpu(block->bb_level) == level &&
173 be16_to_cpu(block->bb_numrecs) <=
174 xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) &&
176 (be64_to_cpu(block->bb_leftsib) == NULLDFSBNO ||
177 XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_leftsib))) &&
178 block->bb_rightsib &&
179 (be64_to_cpu(block->bb_rightsib) == NULLDFSBNO ||
180 XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_rightsib)));
181 if (unlikely(XFS_TEST_ERROR(!lblock_ok, mp, XFS_ERRTAG_BTREE_CHECK_LBLOCK,
182 XFS_RANDOM_BTREE_CHECK_LBLOCK))) {
184 xfs_buftrace("LBTREE ERROR", bp);
185 XFS_ERROR_REPORT("xfs_btree_check_lblock", XFS_ERRLEVEL_LOW,
187 return XFS_ERROR(EFSCORRUPTED);
193 * Checking routine: check that (long) pointer is ok.
195 int /* error (0 or EFSCORRUPTED) */
196 xfs_btree_check_lptr(
197 xfs_btree_cur_t *cur, /* btree cursor */
198 xfs_dfsbno_t ptr, /* btree block disk address */
199 int level) /* btree block level */
201 xfs_mount_t *mp; /* file system mount point */
204 XFS_WANT_CORRUPTED_RETURN(
207 XFS_FSB_SANITY_CHECK(mp, ptr));
213 * Debug routine: check that records are in the right order.
217 xfs_btnum_t btnum, /* btree identifier */
218 void *ar1, /* pointer to left (lower) record */
219 void *ar2) /* pointer to right (higher) record */
222 case XFS_BTNUM_BNO: {
228 ASSERT(be32_to_cpu(r1->ar_startblock) +
229 be32_to_cpu(r1->ar_blockcount) <=
230 be32_to_cpu(r2->ar_startblock));
233 case XFS_BTNUM_CNT: {
239 ASSERT(be32_to_cpu(r1->ar_blockcount) < be32_to_cpu(r2->ar_blockcount) ||
240 (r1->ar_blockcount == r2->ar_blockcount &&
241 be32_to_cpu(r1->ar_startblock) < be32_to_cpu(r2->ar_startblock)));
244 case XFS_BTNUM_BMAP: {
250 ASSERT(xfs_bmbt_disk_get_startoff(r1) +
251 xfs_bmbt_disk_get_blockcount(r1) <=
252 xfs_bmbt_disk_get_startoff(r2));
255 case XFS_BTNUM_INO: {
261 ASSERT(be32_to_cpu(r1->ir_startino) + XFS_INODES_PER_CHUNK <=
262 be32_to_cpu(r2->ir_startino));
272 * Checking routine: check that block header is ok.
275 int /* error (0 or EFSCORRUPTED) */
276 xfs_btree_check_sblock(
277 xfs_btree_cur_t *cur, /* btree cursor */
278 xfs_btree_sblock_t *block, /* btree short form block pointer */
279 int level, /* level of the btree block */
280 xfs_buf_t *bp) /* buffer containing block */
282 xfs_buf_t *agbp; /* buffer for ag. freespace struct */
283 xfs_agf_t *agf; /* ag. freespace structure */
284 xfs_agblock_t agflen; /* native ag. freespace length */
285 int sblock_ok; /* block passes checks */
287 agbp = cur->bc_private.a.agbp;
288 agf = XFS_BUF_TO_AGF(agbp);
289 agflen = be32_to_cpu(agf->agf_length);
291 be32_to_cpu(block->bb_magic) == xfs_magics[cur->bc_btnum] &&
292 be16_to_cpu(block->bb_level) == level &&
293 be16_to_cpu(block->bb_numrecs) <=
294 xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) &&
295 (be32_to_cpu(block->bb_leftsib) == NULLAGBLOCK ||
296 be32_to_cpu(block->bb_leftsib) < agflen) &&
298 (be32_to_cpu(block->bb_rightsib) == NULLAGBLOCK ||
299 be32_to_cpu(block->bb_rightsib) < agflen) &&
301 if (unlikely(XFS_TEST_ERROR(!sblock_ok, cur->bc_mp,
302 XFS_ERRTAG_BTREE_CHECK_SBLOCK,
303 XFS_RANDOM_BTREE_CHECK_SBLOCK))) {
305 xfs_buftrace("SBTREE ERROR", bp);
306 XFS_ERROR_REPORT("xfs_btree_check_sblock", XFS_ERRLEVEL_LOW,
308 return XFS_ERROR(EFSCORRUPTED);
314 * Checking routine: check that (short) pointer is ok.
316 int /* error (0 or EFSCORRUPTED) */
317 xfs_btree_check_sptr(
318 xfs_btree_cur_t *cur, /* btree cursor */
319 xfs_agblock_t ptr, /* btree block disk address */
320 int level) /* btree block level */
322 xfs_buf_t *agbp; /* buffer for ag. freespace struct */
323 xfs_agf_t *agf; /* ag. freespace structure */
325 agbp = cur->bc_private.a.agbp;
326 agf = XFS_BUF_TO_AGF(agbp);
327 XFS_WANT_CORRUPTED_RETURN(
329 ptr != NULLAGBLOCK && ptr != 0 &&
330 ptr < be32_to_cpu(agf->agf_length));
335 * Delete the btree cursor.
338 xfs_btree_del_cursor(
339 xfs_btree_cur_t *cur, /* btree cursor */
340 int error) /* del because of error */
342 int i; /* btree level */
345 * Clear the buffer pointers, and release the buffers.
346 * If we're doing this in the face of an error, we
347 * need to make sure to inspect all of the entries
348 * in the bc_bufs array for buffers to be unlocked.
349 * This is because some of the btree code works from
350 * level n down to 0, and if we get an error along
351 * the way we won't have initialized all the entries
354 for (i = 0; i < cur->bc_nlevels; i++) {
356 xfs_btree_setbuf(cur, i, NULL);
361 * Can't free a bmap cursor without having dealt with the
362 * allocated indirect blocks' accounting.
364 ASSERT(cur->bc_btnum != XFS_BTNUM_BMAP ||
365 cur->bc_private.b.allocated == 0);
369 kmem_zone_free(xfs_btree_cur_zone, cur);
373 * Duplicate the btree cursor.
374 * Allocate a new one, copy the record, re-get the buffers.
377 xfs_btree_dup_cursor(
378 xfs_btree_cur_t *cur, /* input cursor */
379 xfs_btree_cur_t **ncur) /* output cursor */
381 xfs_buf_t *bp; /* btree block's buffer pointer */
382 int error; /* error return value */
383 int i; /* level number of btree block */
384 xfs_mount_t *mp; /* mount structure for filesystem */
385 xfs_btree_cur_t *new; /* new cursor value */
386 xfs_trans_t *tp; /* transaction pointer, can be NULL */
392 * Allocate a new cursor like the old one.
394 new = cur->bc_ops->dup_cursor(cur);
397 * Copy the record currently in the cursor.
399 new->bc_rec = cur->bc_rec;
402 * For each level current, re-get the buffer and copy the ptr value.
404 for (i = 0; i < new->bc_nlevels; i++) {
405 new->bc_ptrs[i] = cur->bc_ptrs[i];
406 new->bc_ra[i] = cur->bc_ra[i];
407 if ((bp = cur->bc_bufs[i])) {
408 if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
409 XFS_BUF_ADDR(bp), mp->m_bsize, 0, &bp))) {
410 xfs_btree_del_cursor(new, error);
414 new->bc_bufs[i] = bp;
416 ASSERT(!XFS_BUF_GETERROR(bp));
418 new->bc_bufs[i] = NULL;
425 * Get a the root block which is stored in the inode.
427 * For now this btree implementation assumes the btree root is always
428 * stored in the if_broot field of an inode fork.
430 STATIC struct xfs_btree_block *
432 struct xfs_btree_cur *cur)
434 struct xfs_ifork *ifp;
436 ifp = XFS_IFORK_PTR(cur->bc_private.b.ip, cur->bc_private.b.whichfork);
437 return (struct xfs_btree_block *)ifp->if_broot;
441 * Retrieve the block pointer from the cursor at the given level.
442 * This may be an inode btree root or from a buffer.
444 STATIC struct xfs_btree_block * /* generic btree block pointer */
446 struct xfs_btree_cur *cur, /* btree cursor */
447 int level, /* level in btree */
448 struct xfs_buf **bpp) /* buffer containing the block */
450 if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) &&
451 (level == cur->bc_nlevels - 1)) {
453 return xfs_btree_get_iroot(cur);
456 *bpp = cur->bc_bufs[level];
457 return XFS_BUF_TO_BLOCK(*bpp);
461 * Get a buffer for the block, return it with no data read.
462 * Long-form addressing.
464 xfs_buf_t * /* buffer for fsbno */
466 xfs_mount_t *mp, /* file system mount point */
467 xfs_trans_t *tp, /* transaction pointer */
468 xfs_fsblock_t fsbno, /* file system block number */
469 uint lock) /* lock flags for get_buf */
471 xfs_buf_t *bp; /* buffer pointer (return value) */
472 xfs_daddr_t d; /* real disk block address */
474 ASSERT(fsbno != NULLFSBLOCK);
475 d = XFS_FSB_TO_DADDR(mp, fsbno);
476 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock);
478 ASSERT(!XFS_BUF_GETERROR(bp));
483 * Get a buffer for the block, return it with no data read.
484 * Short-form addressing.
486 xfs_buf_t * /* buffer for agno/agbno */
488 xfs_mount_t *mp, /* file system mount point */
489 xfs_trans_t *tp, /* transaction pointer */
490 xfs_agnumber_t agno, /* allocation group number */
491 xfs_agblock_t agbno, /* allocation group block number */
492 uint lock) /* lock flags for get_buf */
494 xfs_buf_t *bp; /* buffer pointer (return value) */
495 xfs_daddr_t d; /* real disk block address */
497 ASSERT(agno != NULLAGNUMBER);
498 ASSERT(agbno != NULLAGBLOCK);
499 d = XFS_AGB_TO_DADDR(mp, agno, agbno);
500 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock);
502 ASSERT(!XFS_BUF_GETERROR(bp));
507 * Check for the cursor referring to the last block at the given level.
509 int /* 1=is last block, 0=not last block */
510 xfs_btree_islastblock(
511 xfs_btree_cur_t *cur, /* btree cursor */
512 int level) /* level to check */
514 xfs_btree_block_t *block; /* generic btree block pointer */
515 xfs_buf_t *bp; /* buffer containing block */
517 block = xfs_btree_get_block(cur, level, &bp);
518 xfs_btree_check_block(cur, block, level, bp);
519 if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
520 return be64_to_cpu(block->bb_u.l.bb_rightsib) == NULLDFSBNO;
522 return be32_to_cpu(block->bb_u.s.bb_rightsib) == NULLAGBLOCK;
526 * Change the cursor to point to the first record at the given level.
527 * Other levels are unaffected.
529 int /* success=1, failure=0 */
531 xfs_btree_cur_t *cur, /* btree cursor */
532 int level) /* level to change */
534 xfs_btree_block_t *block; /* generic btree block pointer */
535 xfs_buf_t *bp; /* buffer containing block */
538 * Get the block pointer for this level.
540 block = xfs_btree_get_block(cur, level, &bp);
541 xfs_btree_check_block(cur, block, level, bp);
543 * It's empty, there is no such record.
545 if (!block->bb_numrecs)
548 * Set the ptr value to 1, that's the first record/key.
550 cur->bc_ptrs[level] = 1;
555 * Change the cursor to point to the last record in the current block
556 * at the given level. Other levels are unaffected.
558 int /* success=1, failure=0 */
560 xfs_btree_cur_t *cur, /* btree cursor */
561 int level) /* level to change */
563 xfs_btree_block_t *block; /* generic btree block pointer */
564 xfs_buf_t *bp; /* buffer containing block */
567 * Get the block pointer for this level.
569 block = xfs_btree_get_block(cur, level, &bp);
570 xfs_btree_check_block(cur, block, level, bp);
572 * It's empty, there is no such record.
574 if (!block->bb_numrecs)
577 * Set the ptr value to numrecs, that's the last record/key.
579 cur->bc_ptrs[level] = be16_to_cpu(block->bb_numrecs);
584 * Compute first and last byte offsets for the fields given.
585 * Interprets the offsets table, which contains struct field offsets.
589 __int64_t fields, /* bitmask of fields */
590 const short *offsets, /* table of field offsets */
591 int nbits, /* number of bits to inspect */
592 int *first, /* output: first byte offset */
593 int *last) /* output: last byte offset */
595 int i; /* current bit number */
596 __int64_t imask; /* mask for current bit number */
600 * Find the lowest bit, so the first byte offset.
602 for (i = 0, imask = 1LL; ; i++, imask <<= 1) {
603 if (imask & fields) {
609 * Find the highest bit, so the last byte offset.
611 for (i = nbits - 1, imask = 1LL << i; ; i--, imask >>= 1) {
612 if (imask & fields) {
613 *last = offsets[i + 1] - 1;
620 * Get a buffer for the block, return it read in.
621 * Long-form addressing.
625 xfs_mount_t *mp, /* file system mount point */
626 xfs_trans_t *tp, /* transaction pointer */
627 xfs_fsblock_t fsbno, /* file system block number */
628 uint lock, /* lock flags for read_buf */
629 xfs_buf_t **bpp, /* buffer for fsbno */
630 int refval) /* ref count value for buffer */
632 xfs_buf_t *bp; /* return value */
633 xfs_daddr_t d; /* real disk block address */
636 ASSERT(fsbno != NULLFSBLOCK);
637 d = XFS_FSB_TO_DADDR(mp, fsbno);
638 if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d,
639 mp->m_bsize, lock, &bp))) {
642 ASSERT(!bp || !XFS_BUF_GETERROR(bp));
644 XFS_BUF_SET_VTYPE_REF(bp, B_FS_MAP, refval);
651 * Get a buffer for the block, return it read in.
652 * Short-form addressing.
656 xfs_mount_t *mp, /* file system mount point */
657 xfs_trans_t *tp, /* transaction pointer */
658 xfs_agnumber_t agno, /* allocation group number */
659 xfs_agblock_t agbno, /* allocation group block number */
660 uint lock, /* lock flags for read_buf */
661 xfs_buf_t **bpp, /* buffer for agno/agbno */
662 int refval) /* ref count value for buffer */
664 xfs_buf_t *bp; /* return value */
665 xfs_daddr_t d; /* real disk block address */
668 ASSERT(agno != NULLAGNUMBER);
669 ASSERT(agbno != NULLAGBLOCK);
670 d = XFS_AGB_TO_DADDR(mp, agno, agbno);
671 if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d,
672 mp->m_bsize, lock, &bp))) {
675 ASSERT(!bp || !XFS_BUF_GETERROR(bp));
678 case XFS_ALLOC_BTREE_REF:
679 XFS_BUF_SET_VTYPE_REF(bp, B_FS_MAP, refval);
681 case XFS_INO_BTREE_REF:
682 XFS_BUF_SET_VTYPE_REF(bp, B_FS_INOMAP, refval);
691 * Read-ahead the block, don't wait for it, don't return a buffer.
692 * Long-form addressing.
696 xfs_btree_reada_bufl(
697 xfs_mount_t *mp, /* file system mount point */
698 xfs_fsblock_t fsbno, /* file system block number */
699 xfs_extlen_t count) /* count of filesystem blocks */
703 ASSERT(fsbno != NULLFSBLOCK);
704 d = XFS_FSB_TO_DADDR(mp, fsbno);
705 xfs_baread(mp->m_ddev_targp, d, mp->m_bsize * count);
709 * Read-ahead the block, don't wait for it, don't return a buffer.
710 * Short-form addressing.
714 xfs_btree_reada_bufs(
715 xfs_mount_t *mp, /* file system mount point */
716 xfs_agnumber_t agno, /* allocation group number */
717 xfs_agblock_t agbno, /* allocation group block number */
718 xfs_extlen_t count) /* count of filesystem blocks */
722 ASSERT(agno != NULLAGNUMBER);
723 ASSERT(agbno != NULLAGBLOCK);
724 d = XFS_AGB_TO_DADDR(mp, agno, agbno);
725 xfs_baread(mp->m_ddev_targp, d, mp->m_bsize * count);
729 xfs_btree_readahead_lblock(
730 struct xfs_btree_cur *cur,
732 struct xfs_btree_block *block)
735 xfs_fsblock_t left = be64_to_cpu(block->bb_u.l.bb_leftsib);
736 xfs_fsblock_t right = be64_to_cpu(block->bb_u.l.bb_rightsib);
738 if ((lr & XFS_BTCUR_LEFTRA) && left != NULLDFSBNO) {
739 xfs_btree_reada_bufl(cur->bc_mp, left, 1);
743 if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLDFSBNO) {
744 xfs_btree_reada_bufl(cur->bc_mp, right, 1);
752 xfs_btree_readahead_sblock(
753 struct xfs_btree_cur *cur,
755 struct xfs_btree_block *block)
758 xfs_agblock_t left = be32_to_cpu(block->bb_u.s.bb_leftsib);
759 xfs_agblock_t right = be32_to_cpu(block->bb_u.s.bb_rightsib);
762 if ((lr & XFS_BTCUR_LEFTRA) && left != NULLAGBLOCK) {
763 xfs_btree_reada_bufs(cur->bc_mp, cur->bc_private.a.agno,
768 if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLAGBLOCK) {
769 xfs_btree_reada_bufs(cur->bc_mp, cur->bc_private.a.agno,
778 * Read-ahead btree blocks, at the given level.
779 * Bits in lr are set from XFS_BTCUR_{LEFT,RIGHT}RA.
783 struct xfs_btree_cur *cur, /* btree cursor */
784 int lev, /* level in btree */
785 int lr) /* left/right bits */
787 struct xfs_btree_block *block;
790 * No readahead needed if we are at the root level and the
791 * btree root is stored in the inode.
793 if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) &&
794 (lev == cur->bc_nlevels - 1))
797 if ((cur->bc_ra[lev] | lr) == cur->bc_ra[lev])
800 cur->bc_ra[lev] |= lr;
801 block = XFS_BUF_TO_BLOCK(cur->bc_bufs[lev]);
803 if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
804 return xfs_btree_readahead_lblock(cur, lr, block);
805 return xfs_btree_readahead_sblock(cur, lr, block);
809 * Set the buffer for level "lev" in the cursor to bp, releasing
810 * any previous buffer.
814 xfs_btree_cur_t *cur, /* btree cursor */
815 int lev, /* level in btree */
816 xfs_buf_t *bp) /* new buffer to set */
818 xfs_btree_block_t *b; /* btree block */
819 xfs_buf_t *obp; /* old buffer pointer */
821 obp = cur->bc_bufs[lev];
823 xfs_trans_brelse(cur->bc_tp, obp);
824 cur->bc_bufs[lev] = bp;
828 b = XFS_BUF_TO_BLOCK(bp);
829 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
830 if (be64_to_cpu(b->bb_u.l.bb_leftsib) == NULLDFSBNO)
831 cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
832 if (be64_to_cpu(b->bb_u.l.bb_rightsib) == NULLDFSBNO)
833 cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA;
835 if (be32_to_cpu(b->bb_u.s.bb_leftsib) == NULLAGBLOCK)
836 cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
837 if (be32_to_cpu(b->bb_u.s.bb_rightsib) == NULLAGBLOCK)
838 cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA;