]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: remove XFS_BUF_TO_SBP
authorChristoph Hellwig <hch@lst.de>
Fri, 1 May 2020 21:37:08 +0000 (17:37 -0400)
committerEric Sandeen <sandeen@redhat.com>
Fri, 1 May 2020 21:37:08 +0000 (17:37 -0400)
Source kernel commit: 3e6e8afd3abb745871ee215738a899a495c54a66

Just dereference bp->b_addr directly and make the code a little
simpler and more clear.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
copy/xfs_copy.c
db/init.c
libxfs/xfs_ag.c
libxfs/xfs_format.h
libxfs/xfs_sb.c
mkfs/xfs_mkfs.c
repair/agheader.c
repair/phase5.c
repair/scan.c
repair/xfs_repair.c

index 72ce3fe79480cbb97d934aeb1a4cd7a3120c18f8..2d087f716e898fb602d6d7e114ff851af6451fb6 100644 (file)
@@ -720,7 +720,7 @@ main(int argc, char **argv)
        }
 
        sb = &mbuf.m_sb;
-       libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbp));
+       libxfs_sb_from_disk(sb, sbp->b_addr);
 
        /* Do it again, now with proper length and verifier */
        libxfs_buf_relse(sbp);
index ac649fbddbb9d29a3299d44c6249d66be6c4b134..19f0900a862b3a6d4abb51d04f83fb022204230e 100644 (file)
--- a/db/init.c
+++ b/db/init.c
@@ -119,7 +119,7 @@ init(
        }
 
        /* copy SB from buffer to in-core, converting architecture as we go */
-       libxfs_sb_from_disk(&xmount.m_sb, XFS_BUF_TO_SBP(bp));
+       libxfs_sb_from_disk(&xmount.m_sb, bp->b_addr);
        libxfs_buf_relse(bp);
 
        sbp = &xmount.m_sb;
index c6160df75e7e9e0da64d4ac8e64f70226a2453cd..9ce7abd786864d91fc36fe97d3b12e8cb9aa3e71 100644 (file)
@@ -231,7 +231,7 @@ xfs_sbblock_init(
        struct xfs_buf          *bp,
        struct aghdr_init_data  *id)
 {
-       struct xfs_dsb          *dsb = XFS_BUF_TO_SBP(bp);
+       struct xfs_dsb          *dsb = bp->b_addr;
 
        xfs_sb_to_disk(dsb, &mp->m_sb);
        dsb->sb_inprogress = 1;
index 1fec1302747a11c5672a99246b805edecee4a247..09fd5d23bbeef4eaf0baf5967a118baf9e0daab9 100644 (file)
@@ -560,7 +560,6 @@ xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)
 
 #define XFS_SB_DADDR           ((xfs_daddr_t)0) /* daddr in filesystem/ag */
 #define        XFS_SB_BLOCK(mp)        XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
-#define XFS_BUF_TO_SBP(bp)     ((xfs_dsb_t *)((bp)->b_addr))
 
 #define        XFS_HDR_BLOCK(mp,d)     ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
 #define        XFS_DADDR_TO_FSB(mp,d)  XFS_AGB_TO_FSB(mp, \
index 687e33d827e895e3a149b79d8f6dade04b228520..e26b901667c98251ffa50ad3d747896a9282e5e8 100644 (file)
@@ -217,7 +217,7 @@ xfs_validate_sb_common(
        struct xfs_buf          *bp,
        struct xfs_sb           *sbp)
 {
-       struct xfs_dsb          *dsb = XFS_BUF_TO_SBP(bp);
+       struct xfs_dsb          *dsb = bp->b_addr;
        uint32_t                agcount = 0;
        uint32_t                rem;
 
@@ -658,7 +658,7 @@ xfs_sb_read_verify(
 {
        struct xfs_sb           sb;
        struct xfs_mount        *mp = bp->b_mount;
-       struct xfs_dsb          *dsb = XFS_BUF_TO_SBP(bp);
+       struct xfs_dsb          *dsb = bp->b_addr;
        int                     error;
 
        /*
@@ -684,7 +684,7 @@ xfs_sb_read_verify(
         * Check all the superblock fields.  Don't byteswap the xquota flags
         * because _verify_common checks the on-disk values.
         */
-       __xfs_sb_from_disk(&sb, XFS_BUF_TO_SBP(bp), false);
+       __xfs_sb_from_disk(&sb, dsb, false);
        error = xfs_validate_sb_common(mp, bp, &sb);
        if (error)
                goto out_error;
@@ -707,7 +707,7 @@ static void
 xfs_sb_quiet_read_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_dsb  *dsb = XFS_BUF_TO_SBP(bp);
+       struct xfs_dsb  *dsb = bp->b_addr;
 
        if (dsb->sb_magicnum == cpu_to_be32(XFS_SB_MAGIC)) {
                /* XFS filesystem, verify noisily! */
@@ -725,13 +725,14 @@ xfs_sb_write_verify(
        struct xfs_sb           sb;
        struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
+       struct xfs_dsb          *dsb = bp->b_addr;
        int                     error;
 
        /*
         * Check all the superblock fields.  Don't byteswap the xquota flags
         * because _verify_common checks the on-disk values.
         */
-       __xfs_sb_from_disk(&sb, XFS_BUF_TO_SBP(bp), false);
+       __xfs_sb_from_disk(&sb, dsb, false);
        error = xfs_validate_sb_common(mp, bp, &sb);
        if (error)
                goto out_error;
@@ -743,7 +744,7 @@ xfs_sb_write_verify(
                return;
 
        if (bip)
-               XFS_BUF_TO_SBP(bp)->sb_lsn = cpu_to_be64(bip->bli_item.li_lsn);
+               dsb->sb_lsn = cpu_to_be64(bip->bli_item.li_lsn);
 
        xfs_buf_update_cksum(bp, XFS_SB_CRC_OFF);
        return;
@@ -904,7 +905,7 @@ xfs_log_sb(
        mp->m_sb.sb_ifree = percpu_counter_sum(&mp->m_ifree);
        mp->m_sb.sb_fdblocks = percpu_counter_sum(&mp->m_fdblocks);
 
-       xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb);
+       xfs_sb_to_disk(bp->b_addr, &mp->m_sb);
        xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SB_BUF);
        xfs_trans_log_buf(tp, bp, 0, sizeof(struct xfs_dsb) - 1);
 }
@@ -984,7 +985,7 @@ xfs_update_secondary_sbs(
                bp->b_ops = &xfs_sb_buf_ops;
                xfs_buf_oneshot(bp);
                xfs_buf_zero(bp, 0, BBTOB(bp->b_length));
-               xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb);
+               xfs_sb_to_disk(bp->b_addr, &mp->m_sb);
                xfs_buf_delwri_queue(bp, &buffer_list);
                xfs_buf_relse(bp);
 
index 039b1dcc5afa5ff895f587ebea8960528031a2a3..4aa7563f9b66d1556dad8c24e11438f6d08f08dc 100644 (file)
@@ -3490,6 +3490,7 @@ rewrite_secondary_superblocks(
        struct xfs_mount        *mp)
 {
        struct xfs_buf          *buf;
+       struct xfs_dsb          *dsb;
        int                     error;
 
        /* rewrite the last superblock */
@@ -3502,7 +3503,8 @@ rewrite_secondary_superblocks(
                                progname, mp->m_sb.sb_agcount - 1);
                exit(1);
        }
-       XFS_BUF_TO_SBP(buf)->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino);
+       dsb = buf->b_addr;
+       dsb->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino);
        libxfs_buf_mark_dirty(buf);
        libxfs_buf_relse(buf);
 
@@ -3519,7 +3521,8 @@ rewrite_secondary_superblocks(
                                progname, (mp->m_sb.sb_agcount - 1) / 2);
                exit(1);
        }
-       XFS_BUF_TO_SBP(buf)->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino);
+       dsb = buf->b_addr;
+       dsb->sb_rootino = cpu_to_be64(mp->m_sb.sb_rootino);
        libxfs_buf_mark_dirty(buf);
        libxfs_buf_relse(buf);
 }
@@ -3582,6 +3585,7 @@ main(
        struct xfs_mount        mbuf = {};
        struct xfs_mount        *mp = &mbuf;
        struct xfs_sb           *sbp = &mp->m_sb;
+       struct xfs_dsb          *dsb;
        struct fs_topology      ft = {};
        struct cli_params       cli = {
                .xi = &xi,
@@ -3867,7 +3871,8 @@ main(
        buf = libxfs_getsb(mp);
        if (!buf || buf->b_error)
                exit(1);
-       (XFS_BUF_TO_SBP(buf))->sb_inprogress = 0;
+       dsb = buf->b_addr;
+       dsb->sb_inprogress = 0;
        libxfs_buf_mark_dirty(buf);
        libxfs_buf_relse(buf);
 
index 218ee256a28987a029bcf514690f0a1eacc22822..f28d8a7bb0de041fec56425633709b01890bc0ce 100644 (file)
@@ -241,7 +241,7 @@ secondary_sb_whack(
        struct xfs_sb   *sb,
        xfs_agnumber_t  i)
 {
-       struct xfs_dsb  *dsb = XFS_BUF_TO_SBP(sbuf);
+       struct xfs_dsb  *dsb = sbuf->b_addr;
        int             do_bzero = 0;
        int             size;
        char            *ip;
index a82028512c62ad8527b18a5a203021fce9592bc4..17b574487e52251d67ce674ffa7316d5bf87bb40 100644 (file)
@@ -2266,7 +2266,7 @@ sync_sb(xfs_mount_t *mp)
 
        update_sb_version(mp);
 
-       libxfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb);
+       libxfs_sb_to_disk(bp->b_addr, &mp->m_sb);
        libxfs_buf_mark_dirty(bp);
        libxfs_buf_relse(bp);
 }
index e40ce1948431debafb5416970257843350ab4192..5c8d8b23bfb4d78d3811a3841b082f01afda1402 100644 (file)
@@ -2375,7 +2375,7 @@ scan_ag(
                objname = _("root superblock");
                goto out_free_sb;
        }
-       libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbbuf));
+       libxfs_sb_from_disk(sb, sbbuf->b_addr);
 
        error = salvage_buffer(mp->m_dev,
                        XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
@@ -2480,7 +2480,7 @@ scan_ag(
        if (sb_dirty && !no_modify) {
                if (agno == 0)
                        memcpy(&mp->m_sb, sb, sizeof(xfs_sb_t));
-               libxfs_sb_to_disk(XFS_BUF_TO_SBP(sbbuf), sb);
+               libxfs_sb_to_disk(sbbuf->b_addr, sb);
                libxfs_buf_mark_dirty(sbbuf);
                libxfs_buf_relse(sbbuf);
        } else
index e509fdeb66fe0e2b4d135e3fa0b662db9933bf32..9d72fa8e8810031a8b3c0e1cecd392f53c2ad22c 100644 (file)
@@ -478,7 +478,7 @@ guess_correct_sunit(
                error = -libxfs_sb_read_secondary(mp, NULL, agno, &bp);
                if (error)
                        continue;
-               libxfs_sb_from_disk(&sb, XFS_BUF_TO_SBP(bp));
+               libxfs_sb_from_disk(&sb, bp->b_addr);
                libxfs_buf_relse(bp);
 
                calc_rootino = libxfs_ialloc_calc_rootino(mp, sb.sb_unit);
@@ -1081,7 +1081,7 @@ _("Warning:  project quota information would be cleared.\n"
        if (!sbp)
                do_error(_("couldn't get superblock\n"));
 
-       dsb = XFS_BUF_TO_SBP(sbp);
+       dsb = sbp->b_addr;
 
        if (be16_to_cpu(dsb->sb_qflags) & XFS_ALL_QUOTA_CHKD) {
                do_warn(_("Note - quota info will be regenerated on next "