xfs: add struct xfs_mount pointer to struct xfs_buf
authorChristoph Hellwig <hch@lst.de>
Sat, 29 Jun 2019 02:27:29 +0000 (19:27 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Sat, 29 Jun 2019 02:27:29 +0000 (19:27 -0700)
We need to derive the mount pointer from a buffer in a lot of place.
Add a direct pointer to short cut the pointer chasing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
26 files changed:
Documentation/filesystems/xfs-self-describing-metadata.txt
fs/xfs/libxfs/xfs_alloc.c
fs/xfs/libxfs/xfs_alloc_btree.c
fs/xfs/libxfs/xfs_attr_leaf.c
fs/xfs/libxfs/xfs_attr_remote.c
fs/xfs/libxfs/xfs_bmap_btree.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_dquot_buf.c
fs/xfs/libxfs/xfs_ialloc.c
fs/xfs/libxfs/xfs_ialloc_btree.c
fs/xfs/libxfs/xfs_inode_buf.c
fs/xfs/libxfs/xfs_refcount_btree.c
fs/xfs/libxfs/xfs_rmap_btree.c
fs/xfs/libxfs/xfs_sb.c
fs/xfs/libxfs/xfs_symlink_remote.c
fs/xfs/xfs_attr_inactive.c
fs/xfs/xfs_buf.c
fs/xfs/xfs_buf.h
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_error.c
fs/xfs/xfs_log_recover.c

index 68604e67a495fce4db18e0c76e58237c73080854..8db0121d0980c4b7293f76eb8331d09162cc21e9 100644 (file)
@@ -222,7 +222,7 @@ static void
 xfs_foo_read_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
 
         if ((xfs_sb_version_hascrc(&mp->m_sb) &&
              !xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length),
@@ -245,7 +245,7 @@ static bool
 xfs_foo_verify(
        struct xfs_buf          *bp)
 {
-        struct xfs_mount       *mp = bp->b_target->bt_mount;
+        struct xfs_mount       *mp = bp->b_mount;
         struct xfs_ondisk_hdr  *hdr = bp->b_addr;
 
         if (hdr->magic != cpu_to_be32(XFS_FOO_MAGIC))
@@ -272,7 +272,7 @@ static bool
 xfs_foo_verify(
        struct xfs_buf          *bp)
 {
-        struct xfs_mount       *mp = bp->b_target->bt_mount;
+        struct xfs_mount       *mp = bp->b_mount;
         struct xfs_ondisk_hdr  *hdr = bp->b_addr;
 
         if (hdr->magic == cpu_to_be32(XFS_FOO_CRC_MAGIC)) {
@@ -297,7 +297,7 @@ static void
 xfs_foo_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_fspriv;
 
        if (!xfs_foo_verify(bp)) {
index dbbff823d9e24aae881c9e0cfa704a58e2cb4cba..1bf3e1c63e9863363d9f9d08b74678104d9c267f 100644 (file)
@@ -555,7 +555,7 @@ static xfs_failaddr_t
 xfs_agfl_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
        struct xfs_agfl *agfl = XFS_BUF_TO_AGFL(bp);
        int             i;
 
@@ -596,7 +596,7 @@ static void
 xfs_agfl_read_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
        xfs_failaddr_t  fa;
 
        /*
@@ -621,7 +621,7 @@ static void
 xfs_agfl_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        xfs_failaddr_t          fa;
 
@@ -2586,7 +2586,7 @@ static xfs_failaddr_t
 xfs_agf_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_agf          *agf = XFS_BUF_TO_AGF(bp);
 
        if (xfs_sb_version_hascrc(&mp->m_sb)) {
@@ -2644,7 +2644,7 @@ static void
 xfs_agf_read_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
        xfs_failaddr_t  fa;
 
        if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -2661,7 +2661,7 @@ static void
 xfs_agf_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        xfs_failaddr_t          fa;
 
index 9fe949f6055ec32e89e08d3cf01608cdbb678f42..9b2786ee40816466b9ddf29d2b86ee896b3e2010 100644 (file)
@@ -292,7 +292,7 @@ static xfs_failaddr_t
 xfs_allocbt_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
        struct xfs_perag        *pag = bp->b_pag;
        xfs_failaddr_t          fa;
index 1f6e3965ff7425456ca64477a713573cb5e7943a..654a599a3754ab12051e1c3d2cf2b61caa35a2fb 100644 (file)
@@ -240,7 +240,7 @@ xfs_attr3_leaf_verify(
        struct xfs_buf                  *bp)
 {
        struct xfs_attr3_icleaf_hdr     ichdr;
-       struct xfs_mount                *mp = bp->b_target->bt_mount;
+       struct xfs_mount                *mp = bp->b_mount;
        struct xfs_attr_leafblock       *leaf = bp->b_addr;
        struct xfs_attr_leaf_entry      *entries;
        uint32_t                        end;    /* must be 32bit - see below */
@@ -313,7 +313,7 @@ static void
 xfs_attr3_leaf_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        struct xfs_attr3_leaf_hdr *hdr3 = bp->b_addr;
        xfs_failaddr_t          fa;
@@ -343,7 +343,7 @@ static void
 xfs_attr3_leaf_read_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        xfs_failaddr_t          fa;
 
        if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -865,7 +865,7 @@ xfs_attr_shortform_allfit(
        struct xfs_attr3_icleaf_hdr leafhdr;
        int                     bytes;
        int                     i;
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
 
        leaf = bp->b_addr;
        xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &leafhdr, leaf);
@@ -1525,7 +1525,7 @@ xfs_attr_leaf_order(
 {
        struct xfs_attr3_icleaf_hdr ichdr1;
        struct xfs_attr3_icleaf_hdr ichdr2;
-       struct xfs_mount *mp = leaf1_bp->b_target->bt_mount;
+       struct xfs_mount *mp = leaf1_bp->b_mount;
 
        xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr1, leaf1_bp->b_addr);
        xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr2, leaf2_bp->b_addr);
@@ -2568,7 +2568,7 @@ xfs_attr_leaf_lasthash(
 {
        struct xfs_attr3_icleaf_hdr ichdr;
        struct xfs_attr_leaf_entry *entries;
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
 
        xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, bp->b_addr);
        entries = xfs_attr3_leaf_entryp(bp->b_addr);
index 8b47f9110ddd422ba0314e921eafbfb0edea286e..869bda380eb04139b1a7a0ecd70c307b42e904ec 100644 (file)
@@ -111,7 +111,7 @@ __xfs_attr3_rmt_read_verify(
        bool            check_crc,
        xfs_failaddr_t  *failaddr)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
        char            *ptr;
        int             len;
        xfs_daddr_t     bno;
@@ -175,7 +175,7 @@ static void
 xfs_attr3_rmt_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
        xfs_failaddr_t  fa;
        int             blksize = mp->m_attr_geo->blksize;
        char            *ptr;
index aff82ed112c93c26f43bed5ada5fd4b82e4e3711..e6100bd3ec62feb07c7e0f0e838fb0488830efd3 100644 (file)
@@ -411,7 +411,7 @@ static xfs_failaddr_t
 xfs_bmbt_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
        xfs_failaddr_t          fa;
        unsigned int            level;
index 7d3d7c42da40de536f84a969b57fb489b3727f2c..84c1c3dc54f6c2eb3daeb4981be2aefd8dce250a 100644 (file)
@@ -276,7 +276,7 @@ xfs_btree_lblock_calc_crc(
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
        struct xfs_buf_log_item *bip = bp->b_log_item;
 
-       if (!xfs_sb_version_hascrc(&bp->b_target->bt_mount->m_sb))
+       if (!xfs_sb_version_hascrc(&bp->b_mount->m_sb))
                return;
        if (bip)
                block->bb_u.l.bb_lsn = cpu_to_be64(bip->bli_item.li_lsn);
@@ -288,7 +288,7 @@ xfs_btree_lblock_verify_crc(
        struct xfs_buf          *bp)
 {
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
 
        if (xfs_sb_version_hascrc(&mp->m_sb)) {
                if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.l.bb_lsn)))
@@ -314,7 +314,7 @@ xfs_btree_sblock_calc_crc(
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
        struct xfs_buf_log_item *bip = bp->b_log_item;
 
-       if (!xfs_sb_version_hascrc(&bp->b_target->bt_mount->m_sb))
+       if (!xfs_sb_version_hascrc(&bp->b_mount->m_sb))
                return;
        if (bip)
                block->bb_u.s.bb_lsn = cpu_to_be64(bip->bli_item.li_lsn);
@@ -326,7 +326,7 @@ xfs_btree_sblock_verify_crc(
        struct xfs_buf          *bp)
 {
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
 
        if (xfs_sb_version_hascrc(&mp->m_sb)) {
                if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.s.bb_lsn)))
@@ -4425,7 +4425,7 @@ xfs_btree_lblock_v5hdr_verify(
        struct xfs_buf          *bp,
        uint64_t                owner)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
 
        if (!xfs_sb_version_hascrc(&mp->m_sb))
@@ -4446,7 +4446,7 @@ xfs_btree_lblock_verify(
        struct xfs_buf          *bp,
        unsigned int            max_recs)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
 
        /* numrecs verification */
@@ -4476,7 +4476,7 @@ xfs_failaddr_t
 xfs_btree_sblock_v5hdr_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
        struct xfs_perag        *pag = bp->b_pag;
 
@@ -4502,7 +4502,7 @@ xfs_btree_sblock_verify(
        struct xfs_buf          *bp,
        unsigned int            max_recs)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
        xfs_agblock_t           agno;
 
index e2737e2ac2aeb5e31a997ee3ed5f3800bf5ecfa7..224631d66adeba9828cebdc6e2dec1728b5cb84e 100644 (file)
@@ -126,7 +126,7 @@ xfs_da3_blkinfo_verify(
        struct xfs_buf          *bp,
        struct xfs_da3_blkinfo  *hdr3)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_da_blkinfo   *hdr = &hdr3->hdr;
 
        if (!xfs_verify_magic16(bp, hdr->magic))
@@ -148,7 +148,7 @@ static xfs_failaddr_t
 xfs_da3_node_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_da_intnode   *hdr = bp->b_addr;
        struct xfs_da3_icnode_hdr ichdr;
        const struct xfs_dir_ops *ops;
@@ -186,7 +186,7 @@ static void
 xfs_da3_node_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        struct xfs_da3_node_hdr *hdr3 = bp->b_addr;
        xfs_failaddr_t          fa;
index c73183373dd1760cb8386bf4d49ccaf6400ecac2..19e61509cf53f387db9fa2ebd5d63a3065012666 100644 (file)
@@ -51,7 +51,7 @@ static xfs_failaddr_t
 xfs_dir3_block_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
 
        if (!xfs_verify_magic(bp, hdr3->magic))
@@ -72,7 +72,7 @@ static void
 xfs_dir3_block_read_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        xfs_failaddr_t          fa;
 
        if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -89,7 +89,7 @@ static void
 xfs_dir3_block_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
        xfs_failaddr_t          fa;
index efbb009d3d65a5570e8c0c453074d0bea101ea42..00ae0f0d97c44d920f2c45061448f1595e14ce09 100644 (file)
@@ -51,14 +51,13 @@ __xfs_dir3_data_check(
        int                     i;              /* leaf index */
        int                     lastfree;       /* last entry was unused */
        xfs_dir2_leaf_entry_t   *lep=NULL;      /* block leaf entries */
-       xfs_mount_t             *mp;            /* filesystem mount point */
+       struct xfs_mount        *mp = bp->b_mount;
        char                    *p;             /* current data position */
        int                     stale;          /* count of stale leaves */
        struct xfs_name         name;
        const struct xfs_dir_ops *ops;
        struct xfs_da_geometry  *geo;
 
-       mp = bp->b_target->bt_mount;
        geo = mp->m_dir_geo;
 
        /*
@@ -250,7 +249,7 @@ static xfs_failaddr_t
 xfs_dir3_data_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
 
        if (!xfs_verify_magic(bp, hdr3->magic))
@@ -299,7 +298,7 @@ static void
 xfs_dir3_data_read_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        xfs_failaddr_t          fa;
 
        if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -316,7 +315,7 @@ static void
 xfs_dir3_data_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
        xfs_failaddr_t          fa;
index ce75313d7ed69970f9d16ad3814d2249f886fb5f..73bc3ea89723ed62720fe31fdad1203d6fad4355 100644 (file)
@@ -145,7 +145,7 @@ static xfs_failaddr_t
 xfs_dir3_leaf_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_dir2_leaf    *leaf = bp->b_addr;
        xfs_failaddr_t          fa;
 
@@ -160,7 +160,7 @@ static void
 xfs_dir3_leaf_read_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        xfs_failaddr_t          fa;
 
        if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -177,7 +177,7 @@ static void
 xfs_dir3_leaf_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        struct xfs_dir3_leaf_hdr *hdr3 = bp->b_addr;
        xfs_failaddr_t          fa;
index 0a8fa453a7c69af28184227dcfbd830c773a7173..747d14df97859b53a6c74990421dd396365c91f2 100644 (file)
@@ -85,7 +85,7 @@ static xfs_failaddr_t
 xfs_dir3_free_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_dir2_free_hdr *hdr = bp->b_addr;
 
        if (!xfs_verify_magic(bp, hdr->magic))
@@ -111,7 +111,7 @@ static void
 xfs_dir3_free_read_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        xfs_failaddr_t          fa;
 
        if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -128,7 +128,7 @@ static void
 xfs_dir3_free_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
        xfs_failaddr_t          fa;
index 88fa11071f9f1cb76373668f1e5645dc8ab6201e..194d2f0194aaf3d4e6d9b095918daf46f87d6f83 100644 (file)
@@ -224,7 +224,7 @@ static xfs_failaddr_t
 xfs_dquot_buf_verify_struct(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
 
        return xfs_dquot_buf_verify(mp, bp, false);
 }
@@ -233,7 +233,7 @@ static void
 xfs_dquot_buf_read_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
 
        if (!xfs_dquot_buf_verify_crc(mp, bp, false))
                return;
@@ -250,7 +250,7 @@ static void
 xfs_dquot_buf_readahead_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
 
        if (!xfs_dquot_buf_verify_crc(mp, bp, true) ||
            xfs_dquot_buf_verify(mp, bp, true) != NULL) {
@@ -268,7 +268,7 @@ static void
 xfs_dquot_buf_write_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
 
        xfs_dquot_buf_verify(mp, bp, false);
 }
index 0f5ff2a4b0b80b76f0411156fed221e2642543af..b6ca15584f5ca10d0bcd7826eae58d651aa86d15 100644 (file)
@@ -2470,7 +2470,7 @@ static xfs_failaddr_t
 xfs_agi_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
        struct xfs_agi  *agi = XFS_BUF_TO_AGI(bp);
        int             i;
 
@@ -2522,7 +2522,7 @@ static void
 xfs_agi_read_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
        xfs_failaddr_t  fa;
 
        if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -2539,7 +2539,7 @@ static void
 xfs_agi_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        xfs_failaddr_t          fa;
 
index ac4b65da4c2b2b990dd0e240e218546c4417c5a6..ebb6fadbedb015f1f5cdd9c7fa9917eed32c55dd 100644 (file)
@@ -255,7 +255,7 @@ static xfs_failaddr_t
 xfs_inobt_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
        xfs_failaddr_t          fa;
        unsigned int            level;
index fd7c02ee744b1a7d60f66b6dab6953ce7b88ef48..9bb9c73c1eb265bcb19b782cc75ccf1c458493fa 100644 (file)
@@ -77,7 +77,7 @@ xfs_inode_buf_verify(
        struct xfs_buf  *bp,
        bool            readahead)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
        xfs_agnumber_t  agno;
        int             i;
        int             ni;
index 5d9de9b217266cfa0d9b9e054047cbb146ad9250..5d1dfc49ac8914698c78a1dc381a5fc17909dcc1 100644 (file)
@@ -203,7 +203,7 @@ STATIC xfs_failaddr_t
 xfs_refcountbt_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
        struct xfs_perag        *pag = bp->b_pag;
        xfs_failaddr_t          fa;
index 5d1f8884c8886eedc81bb54acd90c8445ad62826..e9fe53e0dcc8b663ebbb8f3dbdd3ec795c8b75ac 100644 (file)
@@ -292,7 +292,7 @@ static xfs_failaddr_t
 xfs_rmapbt_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_btree_block  *block = XFS_BUF_TO_BLOCK(bp);
        struct xfs_perag        *pag = bp->b_pag;
        xfs_failaddr_t          fa;
index 326872eced21964220e0f969d4e484655940c261..aa21edf13d5a1f710d7151c17d239badfc669c3f 100644 (file)
@@ -686,7 +686,7 @@ xfs_sb_read_verify(
        struct xfs_buf          *bp)
 {
        struct xfs_sb           sb;
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_dsb          *dsb = XFS_BUF_TO_SBP(bp);
        int                     error;
 
@@ -752,7 +752,7 @@ xfs_sb_write_verify(
        struct xfs_buf          *bp)
 {
        struct xfs_sb           sb;
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        int                     error;
 
index a0ccc253c43d0a4c5733c28086c2475c7be5a67b..264b94bb2295b691b0ed9e805f9ac0e59b3a526c 100644 (file)
@@ -90,7 +90,7 @@ static xfs_failaddr_t
 xfs_symlink_verify(
        struct xfs_buf          *bp)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        struct xfs_dsymlink_hdr *dsl = bp->b_addr;
 
        if (!xfs_sb_version_hascrc(&mp->m_sb))
@@ -116,7 +116,7 @@ static void
 xfs_symlink_read_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
        xfs_failaddr_t  fa;
 
        /* no verification of non-crc buffers */
@@ -136,7 +136,7 @@ static void
 xfs_symlink_write_verify(
        struct xfs_buf  *bp)
 {
-       struct xfs_mount *mp = bp->b_target->bt_mount;
+       struct xfs_mount *mp = bp->b_mount;
        struct xfs_buf_log_item *bip = bp->b_log_item;
        xfs_failaddr_t          fa;
 
index 228821b2ebe0195db8be0a59d9eda366515f9a03..d4f4c96bcd4cf9d2dd38465cf368616ee785bafc 100644 (file)
@@ -121,7 +121,7 @@ xfs_attr3_leaf_inactive(
        int                     size;
        int                     tmp;
        int                     i;
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
 
        leaf = bp->b_addr;
        xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
index 67913078250bafe90e0e60a0dfb1f242a84f5e6b..28e1d16e09a8f0f1fdb30fd454772a41795c5bad 100644 (file)
@@ -244,6 +244,7 @@ _xfs_buf_alloc(
        sema_init(&bp->b_sema, 0); /* held, no waiters */
        spin_lock_init(&bp->b_lock);
        bp->b_target = target;
+       bp->b_mount = target->bt_mount;
        bp->b_flags = flags;
 
        /*
@@ -268,7 +269,7 @@ _xfs_buf_alloc(
        atomic_set(&bp->b_pin_count, 0);
        init_waitqueue_head(&bp->b_waiters);
 
-       XFS_STATS_INC(target->bt_mount, xb_create);
+       XFS_STATS_INC(bp->b_mount, xb_create);
        trace_xfs_buf_init(bp, _RET_IP_);
 
        return bp;
@@ -425,12 +426,12 @@ retry:
                                        current->comm, current->pid,
                                        __func__, gfp_mask);
 
-                       XFS_STATS_INC(bp->b_target->bt_mount, xb_page_retries);
+                       XFS_STATS_INC(bp->b_mount, xb_page_retries);
                        congestion_wait(BLK_RW_ASYNC, HZ/50);
                        goto retry;
                }
 
-               XFS_STATS_INC(bp->b_target->bt_mount, xb_page_found);
+               XFS_STATS_INC(bp->b_mount, xb_page_found);
 
                nbytes = min_t(size_t, size, PAGE_SIZE - offset);
                size -= nbytes;
@@ -1103,7 +1104,7 @@ xfs_buf_lock(
        trace_xfs_buf_lock(bp, _RET_IP_);
 
        if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE))
-               xfs_log_force(bp->b_target->bt_mount, 0);
+               xfs_log_force(bp->b_mount, 0);
        down(&bp->b_sema);
 
        trace_xfs_buf_lock_done(bp, _RET_IP_);
@@ -1192,7 +1193,7 @@ xfs_buf_ioend_async(
        struct xfs_buf  *bp)
 {
        INIT_WORK(&bp->b_ioend_work, xfs_buf_ioend_work);
-       queue_work(bp->b_target->bt_mount->m_buf_workqueue, &bp->b_ioend_work);
+       queue_work(bp->b_mount->m_buf_workqueue, &bp->b_ioend_work);
 }
 
 void
@@ -1211,7 +1212,7 @@ xfs_buf_ioerror_alert(
        struct xfs_buf          *bp,
        const char              *func)
 {
-       xfs_alert(bp->b_target->bt_mount,
+       xfs_alert(bp->b_mount,
 "metadata I/O error in \"%s\" at daddr 0x%llx len %d error %d",
                        func, (uint64_t)XFS_BUF_ADDR(bp), bp->b_length,
                        -bp->b_error);
@@ -1230,10 +1231,8 @@ xfs_bwrite(
                         XBF_WRITE_FAIL | XBF_DONE);
 
        error = xfs_buf_submit(bp);
-       if (error) {
-               xfs_force_shutdown(bp->b_target->bt_mount,
-                                  SHUTDOWN_META_IO_ERROR);
-       }
+       if (error)
+               xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR);
        return error;
 }
 
@@ -1370,12 +1369,12 @@ _xfs_buf_ioapply(
                if (bp->b_ops) {
                        bp->b_ops->verify_write(bp);
                        if (bp->b_error) {
-                               xfs_force_shutdown(bp->b_target->bt_mount,
+                               xfs_force_shutdown(bp->b_mount,
                                                   SHUTDOWN_CORRUPT_INCORE);
                                return;
                        }
                } else if (bp->b_bn != XFS_BUF_DADDR_NULL) {
-                       struct xfs_mount *mp = bp->b_target->bt_mount;
+                       struct xfs_mount *mp = bp->b_mount;
 
                        /*
                         * non-crc filesystems don't attach verifiers during
@@ -1453,7 +1452,7 @@ __xfs_buf_submit(
        ASSERT(!(bp->b_flags & _XBF_DELWRI_Q));
 
        /* on shutdown we stale and complete the buffer immediately */
-       if (XFS_FORCED_SHUTDOWN(bp->b_target->bt_mount)) {
+       if (XFS_FORCED_SHUTDOWN(bp->b_mount)) {
                xfs_buf_ioerror(bp, -EIO);
                bp->b_flags &= ~XBF_DONE;
                xfs_buf_stale(bp);
@@ -2093,8 +2092,7 @@ void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref)
         * This allows userspace to disrupt buffer caching for debug/testing
         * purposes.
         */
-       if (XFS_TEST_ERROR(false, bp->b_target->bt_mount,
-                          XFS_ERRTAG_BUF_LRU_REF))
+       if (XFS_TEST_ERROR(false, bp->b_mount, XFS_ERRTAG_BUF_LRU_REF))
                lru_ref = 0;
 
        atomic_set(&bp->b_lru_ref, lru_ref);
@@ -2110,7 +2108,7 @@ xfs_verify_magic(
        struct xfs_buf          *bp,
        __be32                  dmagic)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        int                     idx;
 
        idx = xfs_sb_version_hascrc(&mp->m_sb);
@@ -2128,7 +2126,7 @@ xfs_verify_magic16(
        struct xfs_buf          *bp,
        __be16                  dmagic)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        int                     idx;
 
        idx = xfs_sb_version_hascrc(&mp->m_sb);
index d70374c365e2226670cec2803e4af1be9ec7837f..c6e57a3f409ee7855474bb323d5037a6f96ab97b 100644 (file)
@@ -145,6 +145,7 @@ typedef struct xfs_buf {
        wait_queue_head_t       b_waiters;      /* unpin waiters */
        struct list_head        b_list;
        struct xfs_perag        *b_pag;         /* contains rbtree root */
+       struct xfs_mount        *b_mount;
        xfs_buftarg_t           *b_target;      /* buffer target (device) */
        void                    *b_addr;        /* virtual address of buffer */
        struct work_struct      b_ioend_work;
index 3823f3f5bde972895ab4437ff2c359eeff035045..807f609a4d1ff2a748eb91750397640c17d604ea 100644 (file)
@@ -521,7 +521,7 @@ xfs_buf_item_push(
        /* has a previous flush failed due to IO errors? */
        if ((bp->b_flags & XBF_WRITE_FAIL) &&
            ___ratelimit(&xfs_buf_write_fail_rl_state, "XFS: Failing async write")) {
-               xfs_warn(bp->b_target->bt_mount,
+               xfs_warn(bp->b_mount,
 "Failing async write on buffer block 0x%llx. Retrying async write.",
                         (long long)bp->b_bn);
        }
@@ -744,7 +744,7 @@ xfs_buf_item_init(
         * this buffer. If we do already have one, there is
         * nothing to do here so return.
         */
-       ASSERT(bp->b_target->bt_mount == mp);
+       ASSERT(bp->b_mount == mp);
        if (bip) {
                ASSERT(bip->bli_item.li_type == XFS_LI_BUF);
                ASSERT(!bp->b_transp);
index 7cc799b67232f65488c80ab0584975fd55a4cb7c..544c9482a0efec22883f168e670c1320ab06eac7 100644 (file)
@@ -354,7 +354,7 @@ xfs_buf_verifier_error(
        size_t                  bufsz,
        xfs_failaddr_t          failaddr)
 {
-       struct xfs_mount        *mp = bp->b_target->bt_mount;
+       struct xfs_mount        *mp = bp->b_mount;
        xfs_failaddr_t          fa;
        int                     sz;
 
index d8519e9a3927d2884778b754d53cab62f0e866d5..45f235ee1c2b990914e0278d24f35595f16114a4 100644 (file)
@@ -299,10 +299,9 @@ xlog_recover_iodone(
                 * We're not going to bother about retrying
                 * this during recovery. One strike!
                 */
-               if (!XFS_FORCED_SHUTDOWN(bp->b_target->bt_mount)) {
+               if (!XFS_FORCED_SHUTDOWN(bp->b_mount)) {
                        xfs_buf_ioerror_alert(bp, __func__);
-                       xfs_force_shutdown(bp->b_target->bt_mount,
-                                               SHUTDOWN_META_IO_ERROR);
+                       xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR);
                }
        }
 
@@ -2820,7 +2819,7 @@ xlog_recover_buffer_pass2(
                xfs_buf_stale(bp);
                error = xfs_bwrite(bp);
        } else {
-               ASSERT(bp->b_target->bt_mount == mp);
+               ASSERT(bp->b_mount == mp);
                bp->b_iodone = xlog_recover_iodone;
                xfs_buf_delwri_queue(bp, buffer_list);
        }
@@ -3182,7 +3181,7 @@ out_owner_change:
        /* re-generate the checksum. */
        xfs_dinode_calc_crc(log->l_mp, dip);
 
-       ASSERT(bp->b_target->bt_mount == mp);
+       ASSERT(bp->b_mount == mp);
        bp->b_iodone = xlog_recover_iodone;
        xfs_buf_delwri_queue(bp, buffer_list);
 
@@ -3321,7 +3320,7 @@ xlog_recover_dquot_pass2(
        }
 
        ASSERT(dq_f->qlf_size == 2);
-       ASSERT(bp->b_target->bt_mount == mp);
+       ASSERT(bp->b_mount == mp);
        bp->b_iodone = xlog_recover_iodone;
        xfs_buf_delwri_queue(bp, buffer_list);