xfs: convert bp->b_bn references to xfs_buf_daddr()
authorDave Chinner <dchinner@redhat.com>
Thu, 19 Aug 2021 01:47:05 +0000 (18:47 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 19 Aug 2021 17:07:15 +0000 (10:07 -0700)
Stop directly referencing b_bn in code outside the buffer cache, as
b_bn is supposed to be used only as an internal cache index.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
21 files changed:
fs/xfs/libxfs/xfs_ag.c
fs/xfs/libxfs/xfs_attr_leaf.c
fs/xfs/libxfs/xfs_attr_remote.c
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_btree.c
fs/xfs/libxfs/xfs_da_btree.c
fs/xfs/libxfs/xfs_dir2_block.c
fs/xfs/libxfs/xfs_dir2_data.c
fs/xfs/libxfs/xfs_dir2_leaf.c
fs/xfs/libxfs/xfs_dir2_node.c
fs/xfs/libxfs/xfs_inode_buf.c
fs/xfs/libxfs/xfs_sb.c
fs/xfs/libxfs/xfs_symlink_remote.c
fs/xfs/scrub/bitmap.c
fs/xfs/scrub/common.c
fs/xfs/scrub/trace.c
fs/xfs/xfs_attr_inactive.c
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_buf_item_recover.c
fs/xfs/xfs_error.c
fs/xfs/xfs_trace.h

index 92033c4672a4b1616b3b1d2000d22e544fb13764..005abfd9fd3474668c3a4a25312c6e45417c6950 100644 (file)
@@ -313,7 +313,6 @@ xfs_get_aghdr_buf(
        if (error)
                return error;
 
-       bp->b_bn = blkno;
        bp->b_maps[0].bm_bn = blkno;
        bp->b_ops = ops;
 
index 7975b36fe6a371835d78069653aa1d5ab2c056b9..e1d11e314228e478a9b8c156040cecccbc0badee 100644 (file)
@@ -1206,7 +1206,7 @@ xfs_attr3_leaf_to_node(
        memcpy(bp2->b_addr, bp1->b_addr, args->geo->blksize);
        if (xfs_has_crc(mp)) {
                struct xfs_da3_blkinfo *hdr3 = bp2->b_addr;
-               hdr3->blkno = cpu_to_be64(bp2->b_bn);
+               hdr3->blkno = cpu_to_be64(xfs_buf_daddr(bp2));
        }
        xfs_trans_log_buf(args->trans, bp2, 0, args->geo->blksize - 1);
 
@@ -1274,7 +1274,7 @@ xfs_attr3_leaf_create(
 
                ichdr.magic = XFS_ATTR3_LEAF_MAGIC;
 
-               hdr3->blkno = cpu_to_be64(bp->b_bn);
+               hdr3->blkno = cpu_to_be64(xfs_buf_daddr(bp));
                hdr3->owner = cpu_to_be64(dp->i_ino);
                uuid_copy(&hdr3->uuid, &mp->m_sb.sb_meta_uuid);
 
index 8429395ad5f1248825d26589d604a89cf8b2da0b..83b95be9ded8a4a9a615fcaa2289f76d7a69beb4 100644 (file)
@@ -130,7 +130,7 @@ __xfs_attr3_rmt_read_verify(
                return 0;
 
        ptr = bp->b_addr;
-       bno = bp->b_bn;
+       bno = xfs_buf_daddr(bp);
        len = BBTOB(bp->b_length);
        ASSERT(len >= blksize);
 
@@ -195,7 +195,7 @@ xfs_attr3_rmt_write_verify(
                return;
 
        ptr = bp->b_addr;
-       bno = bp->b_bn;
+       bno = xfs_buf_daddr(bp);
        len = BBTOB(bp->b_length);
        ASSERT(len >= blksize);
 
@@ -284,7 +284,7 @@ xfs_attr_rmtval_copyout(
        uint8_t         **dst)
 {
        char            *src = bp->b_addr;
-       xfs_daddr_t     bno = bp->b_bn;
+       xfs_daddr_t     bno = xfs_buf_daddr(bp);
        int             len = BBTOB(bp->b_length);
        int             blksize = mp->m_attr_geo->blksize;
 
@@ -332,7 +332,7 @@ xfs_attr_rmtval_copyin(
        uint8_t         **src)
 {
        char            *dst = bp->b_addr;
-       xfs_daddr_t     bno = bp->b_bn;
+       xfs_daddr_t     bno = xfs_buf_daddr(bp);
        int             len = BBTOB(bp->b_length);
        int             blksize = mp->m_attr_geo->blksize;
 
index d0bfa9a1f549ecf8b9329a494d40cb3d490162ed..b48230f1a361958e672561f83835dcd2f29b085c 100644 (file)
@@ -739,7 +739,7 @@ xfs_bmap_extents_to_btree(
         */
        abp->b_ops = &xfs_bmbt_buf_ops;
        ablock = XFS_BUF_TO_BLOCK(abp);
-       xfs_btree_init_block_int(mp, ablock, abp->b_bn,
+       xfs_btree_init_block_int(mp, ablock, xfs_buf_daddr(abp),
                                XFS_BTNUM_BMAP, 0, 0, ip->i_ino,
                                XFS_BTREE_LONG_PTRS);
 
index 16a71465cb0b47b76a1452c4b5791ed06a1c46f1..2983954817135b1c9b3115c30550491ca134b4be 100644 (file)
@@ -70,7 +70,7 @@ __xfs_btree_check_lblock(
                if (!uuid_equal(&block->bb_u.l.bb_uuid, &mp->m_sb.sb_meta_uuid))
                        return __this_address;
                if (block->bb_u.l.bb_blkno !=
-                   cpu_to_be64(bp ? bp->b_bn : XFS_BUF_DADDR_NULL))
+                   cpu_to_be64(bp ? xfs_buf_daddr(bp) : XFS_BUF_DADDR_NULL))
                        return __this_address;
                if (block->bb_u.l.bb_pad != cpu_to_be32(0))
                        return __this_address;
@@ -135,7 +135,7 @@ __xfs_btree_check_sblock(
                if (!uuid_equal(&block->bb_u.s.bb_uuid, &mp->m_sb.sb_meta_uuid))
                        return __this_address;
                if (block->bb_u.s.bb_blkno !=
-                   cpu_to_be64(bp ? bp->b_bn : XFS_BUF_DADDR_NULL))
+                   cpu_to_be64(bp ? xfs_buf_daddr(bp) : XFS_BUF_DADDR_NULL))
                        return __this_address;
        }
 
@@ -1131,7 +1131,7 @@ xfs_btree_init_block(
        __u16           numrecs,
        __u64           owner)
 {
-       xfs_btree_init_block_int(mp, XFS_BUF_TO_BLOCK(bp), bp->b_bn,
+       xfs_btree_init_block_int(mp, XFS_BUF_TO_BLOCK(bp), xfs_buf_daddr(bp),
                                 btnum, level, numrecs, owner, 0);
 }
 
@@ -1155,9 +1155,9 @@ xfs_btree_init_block_cur(
        else
                owner = cur->bc_ag.pag->pag_agno;
 
-       xfs_btree_init_block_int(cur->bc_mp, XFS_BUF_TO_BLOCK(bp), bp->b_bn,
-                                cur->bc_btnum, level, numrecs,
-                                owner, cur->bc_flags);
+       xfs_btree_init_block_int(cur->bc_mp, XFS_BUF_TO_BLOCK(bp),
+                               xfs_buf_daddr(bp), cur->bc_btnum, level,
+                               numrecs, owner, cur->bc_flags);
 }
 
 /*
@@ -2923,10 +2923,11 @@ xfs_btree_new_iroot(
         */
        memcpy(cblock, block, xfs_btree_block_len(cur));
        if (cur->bc_flags & XFS_BTREE_CRC_BLOCKS) {
+               __be64 bno = cpu_to_be64(xfs_buf_daddr(cbp));
                if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
-                       cblock->bb_u.l.bb_blkno = cpu_to_be64(cbp->b_bn);
+                       cblock->bb_u.l.bb_blkno = bno;
                else
-                       cblock->bb_u.s.bb_blkno = cpu_to_be64(cbp->b_bn);
+                       cblock->bb_u.s.bb_blkno = bno;
        }
 
        be16_add_cpu(&block->bb_level, 1);
@@ -3225,7 +3226,7 @@ xfs_btree_insrec(
 
        /* Get pointers to the btree buffer and block. */
        block = xfs_btree_get_block(cur, level, &bp);
-       old_bn = bp ? bp->b_bn : XFS_BUF_DADDR_NULL;
+       old_bn = bp ? xfs_buf_daddr(bp) : XFS_BUF_DADDR_NULL;
        numrecs = xfs_btree_get_numrecs(block);
 
 #ifdef DEBUG
@@ -3341,7 +3342,7 @@ xfs_btree_insrec(
         * some records into the new tree block), so use the regular key
         * update mechanism.
         */
-       if (bp && bp->b_bn != old_bn) {
+       if (bp && xfs_buf_daddr(bp) != old_bn) {
                xfs_btree_get_keys(cur, block, lkey);
        } else if (xfs_btree_needs_key_update(cur, optr)) {
                error = xfs_btree_update_keys(cur, level);
@@ -4422,7 +4423,7 @@ xfs_btree_lblock_v5hdr_verify(
                return __this_address;
        if (!uuid_equal(&block->bb_u.l.bb_uuid, &mp->m_sb.sb_meta_uuid))
                return __this_address;
-       if (block->bb_u.l.bb_blkno != cpu_to_be64(bp->b_bn))
+       if (block->bb_u.l.bb_blkno != cpu_to_be64(xfs_buf_daddr(bp)))
                return __this_address;
        if (owner != XFS_RMAP_OWN_UNKNOWN &&
            be64_to_cpu(block->bb_u.l.bb_owner) != owner)
@@ -4472,7 +4473,7 @@ xfs_btree_sblock_v5hdr_verify(
                return __this_address;
        if (!uuid_equal(&block->bb_u.s.bb_uuid, &mp->m_sb.sb_meta_uuid))
                return __this_address;
-       if (block->bb_u.s.bb_blkno != cpu_to_be64(bp->b_bn))
+       if (block->bb_u.s.bb_blkno != cpu_to_be64(xfs_buf_daddr(bp)))
                return __this_address;
        if (pag && be32_to_cpu(block->bb_u.s.bb_owner) != pag->pag_agno)
                return __this_address;
index 99f81f6bb30689f9c267a8e72b4a3ad83e7d75f3..c062e2c8517873d9146b95c40dbf3843feaed275 100644 (file)
@@ -194,7 +194,7 @@ xfs_da3_blkinfo_verify(
        if (xfs_has_crc(mp)) {
                if (!uuid_equal(&hdr3->uuid, &mp->m_sb.sb_meta_uuid))
                        return __this_address;
-               if (be64_to_cpu(hdr3->blkno) != bp->b_bn)
+               if (be64_to_cpu(hdr3->blkno) != xfs_buf_daddr(bp))
                        return __this_address;
                if (!xfs_log_check_lsn(mp, be64_to_cpu(hdr3->lsn)))
                        return __this_address;
@@ -447,7 +447,7 @@ xfs_da3_node_create(
 
                memset(hdr3, 0, sizeof(struct xfs_da3_node_hdr));
                ichdr.magic = XFS_DA3_NODE_MAGIC;
-               hdr3->info.blkno = cpu_to_be64(bp->b_bn);
+               hdr3->info.blkno = cpu_to_be64(xfs_buf_daddr(bp));
                hdr3->info.owner = cpu_to_be64(args->dp->i_ino);
                uuid_copy(&hdr3->info.uuid, &mp->m_sb.sb_meta_uuid);
        } else {
@@ -711,7 +711,7 @@ xfs_da3_root_split(
            oldroot->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)) {
                struct xfs_da3_intnode *node3 = (struct xfs_da3_intnode *)node;
 
-               node3->hdr.info.blkno = cpu_to_be64(bp->b_bn);
+               node3->hdr.info.blkno = cpu_to_be64(xfs_buf_daddr(bp));
        }
        xfs_trans_log_buf(tp, bp, 0, size - 1);
 
@@ -1219,7 +1219,7 @@ xfs_da3_root_join(
        xfs_trans_buf_copy_type(root_blk->bp, bp);
        if (oldroothdr.magic == XFS_DA3_NODE_MAGIC) {
                struct xfs_da3_blkinfo *da3 = root_blk->bp->b_addr;
-               da3->blkno = cpu_to_be64(root_blk->bp->b_bn);
+               da3->blkno = cpu_to_be64(xfs_buf_daddr(root_blk->bp));
        }
        xfs_trans_log_buf(args->trans, root_blk->bp, 0,
                          args->geo->blksize - 1);
index 41e406067f91571292d8a4ad3bf6f5553bae3104..df0869bba275f18998b9bdd9c56a17196612dee1 100644 (file)
@@ -56,7 +56,7 @@ xfs_dir3_block_verify(
        if (xfs_has_crc(mp)) {
                if (!uuid_equal(&hdr3->uuid, &mp->m_sb.sb_meta_uuid))
                        return __this_address;
-               if (be64_to_cpu(hdr3->blkno) != bp->b_bn)
+               if (be64_to_cpu(hdr3->blkno) != xfs_buf_daddr(bp))
                        return __this_address;
                if (!xfs_log_check_lsn(mp, be64_to_cpu(hdr3->lsn)))
                        return __this_address;
@@ -174,7 +174,7 @@ xfs_dir3_block_init(
        if (xfs_has_crc(mp)) {
                memset(hdr3, 0, sizeof(*hdr3));
                hdr3->magic = cpu_to_be32(XFS_DIR3_BLOCK_MAGIC);
-               hdr3->blkno = cpu_to_be64(bp->b_bn);
+               hdr3->blkno = cpu_to_be64(xfs_buf_daddr(bp));
                hdr3->owner = cpu_to_be64(dp->i_ino);
                uuid_copy(&hdr3->uuid, &mp->m_sb.sb_meta_uuid);
                return;
index c90180f2ba5c4db4034c0115f1b1eb3a4ac482fb..dbcf58979a5987263bfa6180e2f153f8a0f75908 100644 (file)
@@ -300,7 +300,7 @@ xfs_dir3_data_verify(
        if (xfs_has_crc(mp)) {
                if (!uuid_equal(&hdr3->uuid, &mp->m_sb.sb_meta_uuid))
                        return __this_address;
-               if (be64_to_cpu(hdr3->blkno) != bp->b_bn)
+               if (be64_to_cpu(hdr3->blkno) != xfs_buf_daddr(bp))
                        return __this_address;
                if (!xfs_log_check_lsn(mp, be64_to_cpu(hdr3->lsn)))
                        return __this_address;
@@ -722,7 +722,7 @@ xfs_dir3_data_init(
 
                memset(hdr3, 0, sizeof(*hdr3));
                hdr3->magic = cpu_to_be32(XFS_DIR3_DATA_MAGIC);
-               hdr3->blkno = cpu_to_be64(bp->b_bn);
+               hdr3->blkno = cpu_to_be64(xfs_buf_daddr(bp));
                hdr3->owner = cpu_to_be64(dp->i_ino);
                uuid_copy(&hdr3->uuid, &mp->m_sb.sb_meta_uuid);
 
index d03db9cde2719a34cdd5ece3e8548a8e7b7eb1ca..d9b66306a9a775198140c699340e68eca9e79cf1 100644 (file)
@@ -108,7 +108,7 @@ xfs_dir3_leaf1_check(
 
        if (leafhdr.magic == XFS_DIR3_LEAF1_MAGIC) {
                struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr;
-               if (be64_to_cpu(leaf3->info.blkno) != bp->b_bn)
+               if (be64_to_cpu(leaf3->info.blkno) != xfs_buf_daddr(bp))
                        return __this_address;
        } else if (leafhdr.magic != XFS_DIR2_LEAF1_MAGIC)
                return __this_address;
@@ -316,7 +316,7 @@ xfs_dir3_leaf_init(
                leaf3->info.hdr.magic = (type == XFS_DIR2_LEAF1_MAGIC)
                                         ? cpu_to_be16(XFS_DIR3_LEAF1_MAGIC)
                                         : cpu_to_be16(XFS_DIR3_LEAFN_MAGIC);
-               leaf3->info.blkno = cpu_to_be64(bp->b_bn);
+               leaf3->info.blkno = cpu_to_be64(xfs_buf_daddr(bp));
                leaf3->info.owner = cpu_to_be64(owner);
                uuid_copy(&leaf3->info.uuid, &mp->m_sb.sb_meta_uuid);
        } else {
index fbd2de8b3cf28f61d5aa2fb72d59dd0adccc1973..7a03aeb9f4c91e6fbb498851a921cd015254e031 100644 (file)
@@ -68,7 +68,7 @@ xfs_dir3_leafn_check(
 
        if (leafhdr.magic == XFS_DIR3_LEAFN_MAGIC) {
                struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr;
-               if (be64_to_cpu(leaf3->info.blkno) != bp->b_bn)
+               if (be64_to_cpu(leaf3->info.blkno) != xfs_buf_daddr(bp))
                        return __this_address;
        } else if (leafhdr.magic != XFS_DIR2_LEAFN_MAGIC)
                return __this_address;
@@ -110,7 +110,7 @@ xfs_dir3_free_verify(
 
                if (!uuid_equal(&hdr3->uuid, &mp->m_sb.sb_meta_uuid))
                        return __this_address;
-               if (be64_to_cpu(hdr3->blkno) != bp->b_bn)
+               if (be64_to_cpu(hdr3->blkno) != xfs_buf_daddr(bp))
                        return __this_address;
                if (!xfs_log_check_lsn(mp, be64_to_cpu(hdr3->lsn)))
                        return __this_address;
@@ -346,7 +346,7 @@ xfs_dir3_free_get_buf(
 
                hdr.magic = XFS_DIR3_FREE_MAGIC;
 
-               hdr3->hdr.blkno = cpu_to_be64(bp->b_bn);
+               hdr3->hdr.blkno = cpu_to_be64(xfs_buf_daddr(bp));
                hdr3->hdr.owner = cpu_to_be64(dp->i_ino);
                uuid_copy(&hdr3->hdr.uuid, &mp->m_sb.sb_meta_uuid);
        } else
index 83ba63b4ace4f16af151db800688ef3121ad04a8..3932b4ebf9037f66f007a98957ee1f8ca2b3da89 100644 (file)
@@ -71,7 +71,7 @@ xfs_inode_buf_verify(
 #ifdef DEBUG
                        xfs_alert(mp,
                                "bad inode magic/vsn daddr %lld #%d (magic=%x)",
-                               (unsigned long long)bp->b_bn, i,
+                               (unsigned long long)xfs_buf_daddr(bp), i,
                                be16_to_cpu(dip->di_magic));
 #endif
                        xfs_buf_verifier_error(bp, -EFSCORRUPTED,
index b1c5ec1bd200fc0592f54f844408b938fe923b6d..e58349be78bd5007fd052b6f1c20385f599226ee 100644 (file)
@@ -747,7 +747,7 @@ xfs_sb_read_verify(
 
                if (!xfs_buf_verify_cksum(bp, XFS_SB_CRC_OFF)) {
                        /* Only fail bad secondaries on a known V5 filesystem */
-                       if (bp->b_maps[0].bm_bn == XFS_SB_DADDR ||
+                       if (xfs_buf_daddr(bp) == XFS_SB_DADDR ||
                            xfs_has_crc(mp)) {
                                error = -EFSBADCRC;
                                goto out_error;
index 98b2b6804657e3d8ca3f52b36714b098ec75b16a..f0b38f4aba80be675cd5eb345198b1a6a0ba1d95 100644 (file)
@@ -51,7 +51,7 @@ xfs_symlink_hdr_set(
        dsl->sl_bytes = cpu_to_be32(size);
        uuid_copy(&dsl->sl_uuid, &mp->m_sb.sb_meta_uuid);
        dsl->sl_owner = cpu_to_be64(ino);
-       dsl->sl_blkno = cpu_to_be64(bp->b_bn);
+       dsl->sl_blkno = cpu_to_be64(xfs_buf_daddr(bp));
        bp->b_ops = &xfs_symlink_buf_ops;
 
        return sizeof(struct xfs_dsymlink_hdr);
@@ -95,7 +95,7 @@ xfs_symlink_verify(
                return __this_address;
        if (!uuid_equal(&dsl->sl_uuid, &mp->m_sb.sb_meta_uuid))
                return __this_address;
-       if (bp->b_bn != be64_to_cpu(dsl->sl_blkno))
+       if (xfs_buf_daddr(bp) != be64_to_cpu(dsl->sl_blkno))
                return __this_address;
        if (be32_to_cpu(dsl->sl_offset) +
                                be32_to_cpu(dsl->sl_bytes) >= XFS_SYMLINK_MAXLEN)
index 813b5f21911387e32045ba65daadafd9a51e1389..d6d24c866bc4e221afd82d1097567c90569f6c23 100644 (file)
@@ -260,7 +260,7 @@ xbitmap_set_btcur_path(
                xfs_btree_get_block(cur, i, &bp);
                if (!bp)
                        continue;
-               fsb = XFS_DADDR_TO_FSB(cur->bc_mp, bp->b_bn);
+               fsb = XFS_DADDR_TO_FSB(cur->bc_mp, xfs_buf_daddr(bp));
                error = xbitmap_set(bitmap, fsb, 1);
                if (error)
                        return error;
@@ -284,7 +284,7 @@ xbitmap_collect_btblock(
        if (!bp)
                return 0;
 
-       fsbno = XFS_DADDR_TO_FSB(cur->bc_mp, bp->b_bn);
+       fsbno = XFS_DADDR_TO_FSB(cur->bc_mp, xfs_buf_daddr(bp));
        return xbitmap_set(bitmap, fsbno, 1);
 }
 
index 2f67b7dc5ee3df28f59023e8b6f4d786218eadea..bf1f3607d0b60979d40e69a6d005ea097a000b28 100644 (file)
@@ -186,7 +186,7 @@ xchk_block_set_preen(
        struct xfs_buf          *bp)
 {
        sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN;
-       trace_xchk_block_preen(sc, bp->b_bn, __return_address);
+       trace_xchk_block_preen(sc, xfs_buf_daddr(bp), __return_address);
 }
 
 /*
@@ -219,7 +219,7 @@ xchk_block_set_corrupt(
        struct xfs_buf          *bp)
 {
        sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
-       trace_xchk_block_error(sc, bp->b_bn, __return_address);
+       trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address);
 }
 
 /* Record a corruption while cross-referencing. */
@@ -229,7 +229,7 @@ xchk_block_xref_set_corrupt(
        struct xfs_buf          *bp)
 {
        sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT;
-       trace_xchk_block_error(sc, bp->b_bn, __return_address);
+       trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address);
 }
 
 /*
@@ -784,7 +784,7 @@ xchk_buffer_recheck(
        if (!fa)
                return;
        sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
-       trace_xchk_block_error(sc, bp->b_bn, fa);
+       trace_xchk_block_error(sc, xfs_buf_daddr(bp), fa);
 }
 
 /*
index 03882a605a3ce1796815ffc0704e0335b41f668c..c0ef53fe66112ea3b6b074fc40c37950c0b71f6d 100644 (file)
@@ -22,11 +22,11 @@ xchk_btree_cur_fsbno(
        int                     level)
 {
        if (level < cur->bc_nlevels && cur->bc_bufs[level])
-               return XFS_DADDR_TO_FSB(cur->bc_mp, cur->bc_bufs[level]->b_bn);
-       else if (level == cur->bc_nlevels - 1 &&
-                cur->bc_flags & XFS_BTREE_LONG_PTRS)
+               return XFS_DADDR_TO_FSB(cur->bc_mp,
+                               xfs_buf_daddr(cur->bc_bufs[level]));
+       if (level == cur->bc_nlevels - 1 && cur->bc_flags & XFS_BTREE_LONG_PTRS)
                return XFS_INO_TO_FSB(cur->bc_mp, cur->bc_ino.ip->i_ino);
-       else if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS))
+       if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS))
                return XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_ag.pag->pag_agno, 0);
        return NULLFSBLOCK;
 }
index d8fdde2068670d07f64c4eb0e3bf21835fc1f0c7..2b5da6218977c024727a6870b7895bcea64898d5 100644 (file)
@@ -151,7 +151,7 @@ xfs_attr3_node_inactive(
        }
 
        xfs_da3_node_hdr_from_disk(dp->i_mount, &ichdr, bp->b_addr);
-       parent_blkno = bp->b_bn;
+       parent_blkno = xfs_buf_daddr(bp);
        if (!ichdr.count) {
                xfs_trans_brelse(*trans, bp);
                return 0;
@@ -271,7 +271,7 @@ xfs_attr3_root_inactive(
        error = xfs_da3_node_read(*trans, dp, 0, &bp, XFS_ATTR_FORK);
        if (error)
                return error;
-       blkno = bp->b_bn;
+       blkno = xfs_buf_daddr(bp);
 
        /*
         * Invalidate the tree, even if the "tree" is only a single leaf block.
index d81b0c5e6e9cdb6ec1590499411bde5651f79c64..b1ab100c09e1447a4a538d4d24dba9c50a7a4817 100644 (file)
@@ -581,7 +581,7 @@ xfs_buf_item_push(
        if (bp->b_flags & XBF_WRITE_FAIL) {
                xfs_buf_alert_ratelimited(bp, "XFS: Failing async write",
            "Failing async write on buffer block 0x%llx. Retrying async write.",
-                                         (long long)bp->b_bn);
+                                         (long long)xfs_buf_daddr(bp));
        }
 
        if (!xfs_buf_delwri_queue(bp, buffer_list))
index a14f7039d346a9c3a32f4654309bc982a20ecc7a..a476c7ef5d533754119a6ea1046b6d35e57a2558 100644 (file)
@@ -497,7 +497,7 @@ xlog_recover_do_reg_buffer(
                        if (fa) {
                                xfs_alert(mp,
        "dquot corrupt at %pS trying to replay into block 0x%llx",
-                                       fa, bp->b_bn);
+                                       fa, xfs_buf_daddr(bp));
                                goto next;
                        }
                }
index ce3bc1b291a1651c6a87fc9dd7f92da172d1ff82..81c445e9489bd4648fed3c8dc7f7e43487efd5ad 100644 (file)
@@ -371,7 +371,7 @@ xfs_buf_corruption_error(
 
        xfs_alert_tag(mp, XFS_PTAG_VERIFIER_ERROR,
                  "Metadata corruption detected at %pS, %s block 0x%llx",
-                 fa, bp->b_ops->name, bp->b_bn);
+                 fa, bp->b_ops->name, xfs_buf_daddr(bp));
 
        xfs_alert(mp, "Unmount and run xfs_repair");
 
@@ -402,7 +402,7 @@ xfs_buf_verifier_error(
        xfs_alert_tag(mp, XFS_PTAG_VERIFIER_ERROR,
                  "Metadata %s detected at %pS, %s block 0x%llx %s",
                  bp->b_error == -EFSBADCRC ? "CRC error" : "corruption",
-                 fa, bp->b_ops->name, bp->b_bn, name);
+                 fa, bp->b_ops->name, xfs_buf_daddr(bp), name);
 
        xfs_alert(mp, "Unmount and run xfs_repair");
 
index 503e0165be0b5f439827271faefbd5f1e0e79897..1033a95fbf8e62528ef0b743b201e92e367cf59b 100644 (file)
@@ -421,10 +421,7 @@ DECLARE_EVENT_CLASS(xfs_buf_class,
        ),
        TP_fast_assign(
                __entry->dev = bp->b_target->bt_dev;
-               if (bp->b_bn == XFS_BUF_DADDR_NULL)
-                       __entry->bno = bp->b_maps[0].bm_bn;
-               else
-                       __entry->bno = bp->b_bn;
+               __entry->bno = xfs_buf_daddr(bp);
                __entry->nblks = bp->b_length;
                __entry->hold = atomic_read(&bp->b_hold);
                __entry->pincount = atomic_read(&bp->b_pin_count);
@@ -492,7 +489,7 @@ DECLARE_EVENT_CLASS(xfs_buf_flags_class,
        ),
        TP_fast_assign(
                __entry->dev = bp->b_target->bt_dev;
-               __entry->bno = bp->b_bn;
+               __entry->bno = xfs_buf_daddr(bp);
                __entry->length = bp->b_length;
                __entry->flags = flags;
                __entry->hold = atomic_read(&bp->b_hold);
@@ -536,7 +533,7 @@ TRACE_EVENT(xfs_buf_ioerror,
        ),
        TP_fast_assign(
                __entry->dev = bp->b_target->bt_dev;
-               __entry->bno = bp->b_bn;
+               __entry->bno = xfs_buf_daddr(bp);
                __entry->length = bp->b_length;
                __entry->hold = atomic_read(&bp->b_hold);
                __entry->pincount = atomic_read(&bp->b_pin_count);
@@ -579,7 +576,7 @@ DECLARE_EVENT_CLASS(xfs_buf_item_class,
                __entry->bli_flags = bip->bli_flags;
                __entry->bli_recur = bip->bli_recur;
                __entry->bli_refcount = atomic_read(&bip->bli_refcount);
-               __entry->buf_bno = bip->bli_buf->b_bn;
+               __entry->buf_bno = xfs_buf_daddr(bip->bli_buf);
                __entry->buf_len = bip->bli_buf->b_length;
                __entry->buf_flags = bip->bli_buf->b_flags;
                __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
@@ -2480,7 +2477,7 @@ DECLARE_EVENT_CLASS(xfs_btree_cur_class,
                __entry->level = level;
                __entry->nlevels = cur->bc_nlevels;
                __entry->ptr = cur->bc_ptrs[level];
-               __entry->daddr = bp ? bp->b_bn : -1;
+               __entry->daddr = bp ? xfs_buf_daddr(bp) : -1;
        ),
        TP_printk("dev %d:%d btree %s level %d/%d ptr %d daddr 0x%llx",
                  MAJOR(__entry->dev), MINOR(__entry->dev),