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 keys are in the right order.
88 xfs_btnum_t btnum, /* btree identifier */
89 void *ak1, /* pointer to left (lower) key */
90 void *ak2) /* pointer to right (higher) key */
99 ASSERT(be32_to_cpu(k1->ar_startblock) < be32_to_cpu(k2->ar_startblock));
102 case XFS_BTNUM_CNT: {
108 ASSERT(be32_to_cpu(k1->ar_blockcount) < be32_to_cpu(k2->ar_blockcount) ||
109 (k1->ar_blockcount == k2->ar_blockcount &&
110 be32_to_cpu(k1->ar_startblock) < be32_to_cpu(k2->ar_startblock)));
113 case XFS_BTNUM_BMAP: {
119 ASSERT(be64_to_cpu(k1->br_startoff) < be64_to_cpu(k2->br_startoff));
122 case XFS_BTNUM_INO: {
128 ASSERT(be32_to_cpu(k1->ir_startino) < be32_to_cpu(k2->ir_startino));
137 * Debug routine: check that records are in the right order.
141 xfs_btnum_t btnum, /* btree identifier */
142 void *ar1, /* pointer to left (lower) record */
143 void *ar2) /* pointer to right (higher) record */
146 case XFS_BTNUM_BNO: {
152 ASSERT(be32_to_cpu(r1->ar_startblock) +
153 be32_to_cpu(r1->ar_blockcount) <=
154 be32_to_cpu(r2->ar_startblock));
157 case XFS_BTNUM_CNT: {
163 ASSERT(be32_to_cpu(r1->ar_blockcount) < be32_to_cpu(r2->ar_blockcount) ||
164 (r1->ar_blockcount == r2->ar_blockcount &&
165 be32_to_cpu(r1->ar_startblock) < be32_to_cpu(r2->ar_startblock)));
168 case XFS_BTNUM_BMAP: {
174 ASSERT(xfs_bmbt_disk_get_startoff(r1) +
175 xfs_bmbt_disk_get_blockcount(r1) <=
176 xfs_bmbt_disk_get_startoff(r2));
179 case XFS_BTNUM_INO: {
185 ASSERT(be32_to_cpu(r1->ir_startino) + XFS_INODES_PER_CHUNK <=
186 be32_to_cpu(r2->ir_startino));
195 int /* error (0 or EFSCORRUPTED) */
196 xfs_btree_check_lblock(
197 struct xfs_btree_cur *cur, /* btree cursor */
198 struct xfs_btree_lblock *block, /* btree long form block pointer */
199 int level, /* level of the btree block */
200 struct xfs_buf *bp) /* buffer for block, if any */
202 int lblock_ok; /* block passes checks */
203 struct xfs_mount *mp; /* file system mount point */
207 be32_to_cpu(block->bb_magic) == xfs_magics[cur->bc_btnum] &&
208 be16_to_cpu(block->bb_level) == level &&
209 be16_to_cpu(block->bb_numrecs) <=
210 xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) &&
212 (be64_to_cpu(block->bb_leftsib) == NULLDFSBNO ||
213 XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_leftsib))) &&
214 block->bb_rightsib &&
215 (be64_to_cpu(block->bb_rightsib) == NULLDFSBNO ||
216 XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_rightsib)));
217 if (unlikely(XFS_TEST_ERROR(!lblock_ok, mp,
218 XFS_ERRTAG_BTREE_CHECK_LBLOCK,
219 XFS_RANDOM_BTREE_CHECK_LBLOCK))) {
221 xfs_buftrace("LBTREE ERROR", bp);
222 XFS_ERROR_REPORT("xfs_btree_check_lblock", XFS_ERRLEVEL_LOW,
224 return XFS_ERROR(EFSCORRUPTED);
229 int /* error (0 or EFSCORRUPTED) */
230 xfs_btree_check_sblock(
231 struct xfs_btree_cur *cur, /* btree cursor */
232 struct xfs_btree_sblock *block, /* btree short form block pointer */
233 int level, /* level of the btree block */
234 struct xfs_buf *bp) /* buffer containing block */
236 struct xfs_buf *agbp; /* buffer for ag. freespace struct */
237 struct xfs_agf *agf; /* ag. freespace structure */
238 xfs_agblock_t agflen; /* native ag. freespace length */
239 int sblock_ok; /* block passes checks */
241 agbp = cur->bc_private.a.agbp;
242 agf = XFS_BUF_TO_AGF(agbp);
243 agflen = be32_to_cpu(agf->agf_length);
245 be32_to_cpu(block->bb_magic) == xfs_magics[cur->bc_btnum] &&
246 be16_to_cpu(block->bb_level) == level &&
247 be16_to_cpu(block->bb_numrecs) <=
248 xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) &&
249 (be32_to_cpu(block->bb_leftsib) == NULLAGBLOCK ||
250 be32_to_cpu(block->bb_leftsib) < agflen) &&
252 (be32_to_cpu(block->bb_rightsib) == NULLAGBLOCK ||
253 be32_to_cpu(block->bb_rightsib) < agflen) &&
255 if (unlikely(XFS_TEST_ERROR(!sblock_ok, cur->bc_mp,
256 XFS_ERRTAG_BTREE_CHECK_SBLOCK,
257 XFS_RANDOM_BTREE_CHECK_SBLOCK))) {
259 xfs_buftrace("SBTREE ERROR", bp);
260 XFS_ERROR_REPORT("xfs_btree_check_sblock", XFS_ERRLEVEL_LOW,
262 return XFS_ERROR(EFSCORRUPTED);
268 * Debug routine: check that block header is ok.
271 xfs_btree_check_block(
272 struct xfs_btree_cur *cur, /* btree cursor */
273 struct xfs_btree_block *block, /* generic btree block pointer */
274 int level, /* level of the btree block */
275 struct xfs_buf *bp) /* buffer containing block, if any */
277 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
278 return xfs_btree_check_lblock(cur,
279 (struct xfs_btree_lblock *)block, level, bp);
281 return xfs_btree_check_sblock(cur,
282 (struct xfs_btree_sblock *)block, level, bp);
287 * Check that (long) pointer is ok.
289 int /* error (0 or EFSCORRUPTED) */
290 xfs_btree_check_lptr(
291 struct xfs_btree_cur *cur, /* btree cursor */
292 xfs_dfsbno_t bno, /* btree block disk address */
293 int level) /* btree block level */
295 XFS_WANT_CORRUPTED_RETURN(
298 XFS_FSB_SANITY_CHECK(cur->bc_mp, bno));
303 * Check that (short) pointer is ok.
305 int /* error (0 or EFSCORRUPTED) */
306 xfs_btree_check_sptr(
307 struct xfs_btree_cur *cur, /* btree cursor */
308 xfs_agblock_t bno, /* btree block disk address */
309 int level) /* btree block level */
311 xfs_agblock_t agblocks = cur->bc_mp->m_sb.sb_agblocks;
313 XFS_WANT_CORRUPTED_RETURN(
315 bno != NULLAGBLOCK &&
322 * Check that block ptr is ok.
324 int /* error (0 or EFSCORRUPTED) */
326 struct xfs_btree_cur *cur, /* btree cursor */
327 union xfs_btree_ptr *ptr, /* btree block disk address */
328 int index, /* offset from ptr to check */
329 int level) /* btree block level */
331 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
332 return xfs_btree_check_lptr(cur,
333 be64_to_cpu((&ptr->l)[index]), level);
335 return xfs_btree_check_sptr(cur,
336 be32_to_cpu((&ptr->s)[index]), level);
341 * Delete the btree cursor.
344 xfs_btree_del_cursor(
345 xfs_btree_cur_t *cur, /* btree cursor */
346 int error) /* del because of error */
348 int i; /* btree level */
351 * Clear the buffer pointers, and release the buffers.
352 * If we're doing this in the face of an error, we
353 * need to make sure to inspect all of the entries
354 * in the bc_bufs array for buffers to be unlocked.
355 * This is because some of the btree code works from
356 * level n down to 0, and if we get an error along
357 * the way we won't have initialized all the entries
360 for (i = 0; i < cur->bc_nlevels; i++) {
362 xfs_btree_setbuf(cur, i, NULL);
367 * Can't free a bmap cursor without having dealt with the
368 * allocated indirect blocks' accounting.
370 ASSERT(cur->bc_btnum != XFS_BTNUM_BMAP ||
371 cur->bc_private.b.allocated == 0);
375 kmem_zone_free(xfs_btree_cur_zone, cur);
379 * Duplicate the btree cursor.
380 * Allocate a new one, copy the record, re-get the buffers.
383 xfs_btree_dup_cursor(
384 xfs_btree_cur_t *cur, /* input cursor */
385 xfs_btree_cur_t **ncur) /* output cursor */
387 xfs_buf_t *bp; /* btree block's buffer pointer */
388 int error; /* error return value */
389 int i; /* level number of btree block */
390 xfs_mount_t *mp; /* mount structure for filesystem */
391 xfs_btree_cur_t *new; /* new cursor value */
392 xfs_trans_t *tp; /* transaction pointer, can be NULL */
398 * Allocate a new cursor like the old one.
400 new = cur->bc_ops->dup_cursor(cur);
403 * Copy the record currently in the cursor.
405 new->bc_rec = cur->bc_rec;
408 * For each level current, re-get the buffer and copy the ptr value.
410 for (i = 0; i < new->bc_nlevels; i++) {
411 new->bc_ptrs[i] = cur->bc_ptrs[i];
412 new->bc_ra[i] = cur->bc_ra[i];
413 if ((bp = cur->bc_bufs[i])) {
414 if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
415 XFS_BUF_ADDR(bp), mp->m_bsize, 0, &bp))) {
416 xfs_btree_del_cursor(new, error);
420 new->bc_bufs[i] = bp;
422 ASSERT(!XFS_BUF_GETERROR(bp));
424 new->bc_bufs[i] = NULL;
431 * Get a the root block which is stored in the inode.
433 * For now this btree implementation assumes the btree root is always
434 * stored in the if_broot field of an inode fork.
436 STATIC struct xfs_btree_block *
438 struct xfs_btree_cur *cur)
440 struct xfs_ifork *ifp;
442 ifp = XFS_IFORK_PTR(cur->bc_private.b.ip, cur->bc_private.b.whichfork);
443 return (struct xfs_btree_block *)ifp->if_broot;
447 * Retrieve the block pointer from the cursor at the given level.
448 * This may be an inode btree root or from a buffer.
450 STATIC struct xfs_btree_block * /* generic btree block pointer */
452 struct xfs_btree_cur *cur, /* btree cursor */
453 int level, /* level in btree */
454 struct xfs_buf **bpp) /* buffer containing the block */
456 if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) &&
457 (level == cur->bc_nlevels - 1)) {
459 return xfs_btree_get_iroot(cur);
462 *bpp = cur->bc_bufs[level];
463 return XFS_BUF_TO_BLOCK(*bpp);
467 * Get a buffer for the block, return it with no data read.
468 * Long-form addressing.
470 xfs_buf_t * /* buffer for fsbno */
472 xfs_mount_t *mp, /* file system mount point */
473 xfs_trans_t *tp, /* transaction pointer */
474 xfs_fsblock_t fsbno, /* file system block number */
475 uint lock) /* lock flags for get_buf */
477 xfs_buf_t *bp; /* buffer pointer (return value) */
478 xfs_daddr_t d; /* real disk block address */
480 ASSERT(fsbno != NULLFSBLOCK);
481 d = XFS_FSB_TO_DADDR(mp, fsbno);
482 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock);
484 ASSERT(!XFS_BUF_GETERROR(bp));
489 * Get a buffer for the block, return it with no data read.
490 * Short-form addressing.
492 xfs_buf_t * /* buffer for agno/agbno */
494 xfs_mount_t *mp, /* file system mount point */
495 xfs_trans_t *tp, /* transaction pointer */
496 xfs_agnumber_t agno, /* allocation group number */
497 xfs_agblock_t agbno, /* allocation group block number */
498 uint lock) /* lock flags for get_buf */
500 xfs_buf_t *bp; /* buffer pointer (return value) */
501 xfs_daddr_t d; /* real disk block address */
503 ASSERT(agno != NULLAGNUMBER);
504 ASSERT(agbno != NULLAGBLOCK);
505 d = XFS_AGB_TO_DADDR(mp, agno, agbno);
506 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock);
508 ASSERT(!XFS_BUF_GETERROR(bp));
513 * Check for the cursor referring to the last block at the given level.
515 int /* 1=is last block, 0=not last block */
516 xfs_btree_islastblock(
517 xfs_btree_cur_t *cur, /* btree cursor */
518 int level) /* level to check */
520 xfs_btree_block_t *block; /* generic btree block pointer */
521 xfs_buf_t *bp; /* buffer containing block */
523 block = xfs_btree_get_block(cur, level, &bp);
524 xfs_btree_check_block(cur, block, level, bp);
525 if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
526 return be64_to_cpu(block->bb_u.l.bb_rightsib) == NULLDFSBNO;
528 return be32_to_cpu(block->bb_u.s.bb_rightsib) == NULLAGBLOCK;
532 * Change the cursor to point to the first record at the given level.
533 * Other levels are unaffected.
535 int /* success=1, failure=0 */
537 xfs_btree_cur_t *cur, /* btree cursor */
538 int level) /* level to change */
540 xfs_btree_block_t *block; /* generic btree block pointer */
541 xfs_buf_t *bp; /* buffer containing block */
544 * Get the block pointer for this level.
546 block = xfs_btree_get_block(cur, level, &bp);
547 xfs_btree_check_block(cur, block, level, bp);
549 * It's empty, there is no such record.
551 if (!block->bb_numrecs)
554 * Set the ptr value to 1, that's the first record/key.
556 cur->bc_ptrs[level] = 1;
561 * Change the cursor to point to the last record in the current block
562 * at the given level. Other levels are unaffected.
564 int /* success=1, failure=0 */
566 xfs_btree_cur_t *cur, /* btree cursor */
567 int level) /* level to change */
569 xfs_btree_block_t *block; /* generic btree block pointer */
570 xfs_buf_t *bp; /* buffer containing block */
573 * Get the block pointer for this level.
575 block = xfs_btree_get_block(cur, level, &bp);
576 xfs_btree_check_block(cur, block, level, bp);
578 * It's empty, there is no such record.
580 if (!block->bb_numrecs)
583 * Set the ptr value to numrecs, that's the last record/key.
585 cur->bc_ptrs[level] = be16_to_cpu(block->bb_numrecs);
590 * Compute first and last byte offsets for the fields given.
591 * Interprets the offsets table, which contains struct field offsets.
595 __int64_t fields, /* bitmask of fields */
596 const short *offsets, /* table of field offsets */
597 int nbits, /* number of bits to inspect */
598 int *first, /* output: first byte offset */
599 int *last) /* output: last byte offset */
601 int i; /* current bit number */
602 __int64_t imask; /* mask for current bit number */
606 * Find the lowest bit, so the first byte offset.
608 for (i = 0, imask = 1LL; ; i++, imask <<= 1) {
609 if (imask & fields) {
615 * Find the highest bit, so the last byte offset.
617 for (i = nbits - 1, imask = 1LL << i; ; i--, imask >>= 1) {
618 if (imask & fields) {
619 *last = offsets[i + 1] - 1;
626 * Get a buffer for the block, return it read in.
627 * Long-form addressing.
631 xfs_mount_t *mp, /* file system mount point */
632 xfs_trans_t *tp, /* transaction pointer */
633 xfs_fsblock_t fsbno, /* file system block number */
634 uint lock, /* lock flags for read_buf */
635 xfs_buf_t **bpp, /* buffer for fsbno */
636 int refval) /* ref count value for buffer */
638 xfs_buf_t *bp; /* return value */
639 xfs_daddr_t d; /* real disk block address */
642 ASSERT(fsbno != NULLFSBLOCK);
643 d = XFS_FSB_TO_DADDR(mp, fsbno);
644 if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d,
645 mp->m_bsize, lock, &bp))) {
648 ASSERT(!bp || !XFS_BUF_GETERROR(bp));
650 XFS_BUF_SET_VTYPE_REF(bp, B_FS_MAP, refval);
657 * Get a buffer for the block, return it read in.
658 * Short-form addressing.
662 xfs_mount_t *mp, /* file system mount point */
663 xfs_trans_t *tp, /* transaction pointer */
664 xfs_agnumber_t agno, /* allocation group number */
665 xfs_agblock_t agbno, /* allocation group block number */
666 uint lock, /* lock flags for read_buf */
667 xfs_buf_t **bpp, /* buffer for agno/agbno */
668 int refval) /* ref count value for buffer */
670 xfs_buf_t *bp; /* return value */
671 xfs_daddr_t d; /* real disk block address */
674 ASSERT(agno != NULLAGNUMBER);
675 ASSERT(agbno != NULLAGBLOCK);
676 d = XFS_AGB_TO_DADDR(mp, agno, agbno);
677 if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d,
678 mp->m_bsize, lock, &bp))) {
681 ASSERT(!bp || !XFS_BUF_GETERROR(bp));
684 case XFS_ALLOC_BTREE_REF:
685 XFS_BUF_SET_VTYPE_REF(bp, B_FS_MAP, refval);
687 case XFS_INO_BTREE_REF:
688 XFS_BUF_SET_VTYPE_REF(bp, B_FS_INOMAP, refval);
697 * Read-ahead the block, don't wait for it, don't return a buffer.
698 * Long-form addressing.
702 xfs_btree_reada_bufl(
703 xfs_mount_t *mp, /* file system mount point */
704 xfs_fsblock_t fsbno, /* file system block number */
705 xfs_extlen_t count) /* count of filesystem blocks */
709 ASSERT(fsbno != NULLFSBLOCK);
710 d = XFS_FSB_TO_DADDR(mp, fsbno);
711 xfs_baread(mp->m_ddev_targp, d, mp->m_bsize * count);
715 * Read-ahead the block, don't wait for it, don't return a buffer.
716 * Short-form addressing.
720 xfs_btree_reada_bufs(
721 xfs_mount_t *mp, /* file system mount point */
722 xfs_agnumber_t agno, /* allocation group number */
723 xfs_agblock_t agbno, /* allocation group block number */
724 xfs_extlen_t count) /* count of filesystem blocks */
728 ASSERT(agno != NULLAGNUMBER);
729 ASSERT(agbno != NULLAGBLOCK);
730 d = XFS_AGB_TO_DADDR(mp, agno, agbno);
731 xfs_baread(mp->m_ddev_targp, d, mp->m_bsize * count);
735 xfs_btree_readahead_lblock(
736 struct xfs_btree_cur *cur,
738 struct xfs_btree_block *block)
741 xfs_fsblock_t left = be64_to_cpu(block->bb_u.l.bb_leftsib);
742 xfs_fsblock_t right = be64_to_cpu(block->bb_u.l.bb_rightsib);
744 if ((lr & XFS_BTCUR_LEFTRA) && left != NULLDFSBNO) {
745 xfs_btree_reada_bufl(cur->bc_mp, left, 1);
749 if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLDFSBNO) {
750 xfs_btree_reada_bufl(cur->bc_mp, right, 1);
758 xfs_btree_readahead_sblock(
759 struct xfs_btree_cur *cur,
761 struct xfs_btree_block *block)
764 xfs_agblock_t left = be32_to_cpu(block->bb_u.s.bb_leftsib);
765 xfs_agblock_t right = be32_to_cpu(block->bb_u.s.bb_rightsib);
768 if ((lr & XFS_BTCUR_LEFTRA) && left != NULLAGBLOCK) {
769 xfs_btree_reada_bufs(cur->bc_mp, cur->bc_private.a.agno,
774 if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLAGBLOCK) {
775 xfs_btree_reada_bufs(cur->bc_mp, cur->bc_private.a.agno,
784 * Read-ahead btree blocks, at the given level.
785 * Bits in lr are set from XFS_BTCUR_{LEFT,RIGHT}RA.
789 struct xfs_btree_cur *cur, /* btree cursor */
790 int lev, /* level in btree */
791 int lr) /* left/right bits */
793 struct xfs_btree_block *block;
796 * No readahead needed if we are at the root level and the
797 * btree root is stored in the inode.
799 if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) &&
800 (lev == cur->bc_nlevels - 1))
803 if ((cur->bc_ra[lev] | lr) == cur->bc_ra[lev])
806 cur->bc_ra[lev] |= lr;
807 block = XFS_BUF_TO_BLOCK(cur->bc_bufs[lev]);
809 if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
810 return xfs_btree_readahead_lblock(cur, lr, block);
811 return xfs_btree_readahead_sblock(cur, lr, block);
815 * Set the buffer for level "lev" in the cursor to bp, releasing
816 * any previous buffer.
820 xfs_btree_cur_t *cur, /* btree cursor */
821 int lev, /* level in btree */
822 xfs_buf_t *bp) /* new buffer to set */
824 xfs_btree_block_t *b; /* btree block */
825 xfs_buf_t *obp; /* old buffer pointer */
827 obp = cur->bc_bufs[lev];
829 xfs_trans_brelse(cur->bc_tp, obp);
830 cur->bc_bufs[lev] = bp;
834 b = XFS_BUF_TO_BLOCK(bp);
835 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
836 if (be64_to_cpu(b->bb_u.l.bb_leftsib) == NULLDFSBNO)
837 cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
838 if (be64_to_cpu(b->bb_u.l.bb_rightsib) == NULLDFSBNO)
839 cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA;
841 if (be32_to_cpu(b->bb_u.s.bb_leftsib) == NULLAGBLOCK)
842 cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
843 if (be32_to_cpu(b->bb_u.s.bb_rightsib) == NULLAGBLOCK)
844 cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA;