summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-06-28 22:27:29 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2019-06-28 22:27:29 -0400
commitdbd329f1e44ed48de8a1c19da5eb1218f5e1b4a5 (patch)
treef0e3c030dee4994dbea1fd6c3d3fed9fa1d64d05
parent8124b9b6011d0c9c0021e827861168291bbebb55 (diff)
xfs: add struct xfs_mount pointer to struct xfs_buf
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>
-rw-r--r--Documentation/filesystems/xfs-self-describing-metadata.txt8
-rw-r--r--fs/xfs/libxfs/xfs_alloc.c12
-rw-r--r--fs/xfs/libxfs/xfs_alloc_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_attr_leaf.c12
-rw-r--r--fs/xfs/libxfs/xfs_attr_remote.c4
-rw-r--r--fs/xfs/libxfs/xfs_bmap_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_btree.c16
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c6
-rw-r--r--fs/xfs/libxfs/xfs_dir2_block.c6
-rw-r--r--fs/xfs/libxfs/xfs_dir2_data.c9
-rw-r--r--fs/xfs/libxfs/xfs_dir2_leaf.c6
-rw-r--r--fs/xfs/libxfs/xfs_dir2_node.c6
-rw-r--r--fs/xfs/libxfs/xfs_dquot_buf.c8
-rw-r--r--fs/xfs/libxfs/xfs_ialloc.c6
-rw-r--r--fs/xfs/libxfs/xfs_ialloc_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_inode_buf.c2
-rw-r--r--fs/xfs/libxfs/xfs_refcount_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_rmap_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_sb.c4
-rw-r--r--fs/xfs/libxfs/xfs_symlink_remote.c6
-rw-r--r--fs/xfs/xfs_attr_inactive.c2
-rw-r--r--fs/xfs/xfs_buf.c32
-rw-r--r--fs/xfs/xfs_buf.h1
-rw-r--r--fs/xfs/xfs_buf_item.c4
-rw-r--r--fs/xfs/xfs_error.c2
-rw-r--r--fs/xfs/xfs_log_recover.c11
26 files changed, 85 insertions, 88 deletions
diff --git a/Documentation/filesystems/xfs-self-describing-metadata.txt b/Documentation/filesystems/xfs-self-describing-metadata.txt
index 68604e67a495..8db0121d0980 100644
--- a/Documentation/filesystems/xfs-self-describing-metadata.txt
+++ b/Documentation/filesystems/xfs-self-describing-metadata.txt
@@ -222,7 +222,7 @@ static void
222xfs_foo_read_verify( 222xfs_foo_read_verify(
223 struct xfs_buf *bp) 223 struct xfs_buf *bp)
224{ 224{
225 struct xfs_mount *mp = bp->b_target->bt_mount; 225 struct xfs_mount *mp = bp->b_mount;
226 226
227 if ((xfs_sb_version_hascrc(&mp->m_sb) && 227 if ((xfs_sb_version_hascrc(&mp->m_sb) &&
228 !xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length), 228 !xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length),
@@ -245,7 +245,7 @@ static bool
245xfs_foo_verify( 245xfs_foo_verify(
246 struct xfs_buf *bp) 246 struct xfs_buf *bp)
247{ 247{
248 struct xfs_mount *mp = bp->b_target->bt_mount; 248 struct xfs_mount *mp = bp->b_mount;
249 struct xfs_ondisk_hdr *hdr = bp->b_addr; 249 struct xfs_ondisk_hdr *hdr = bp->b_addr;
250 250
251 if (hdr->magic != cpu_to_be32(XFS_FOO_MAGIC)) 251 if (hdr->magic != cpu_to_be32(XFS_FOO_MAGIC))
@@ -272,7 +272,7 @@ static bool
272xfs_foo_verify( 272xfs_foo_verify(
273 struct xfs_buf *bp) 273 struct xfs_buf *bp)
274{ 274{
275 struct xfs_mount *mp = bp->b_target->bt_mount; 275 struct xfs_mount *mp = bp->b_mount;
276 struct xfs_ondisk_hdr *hdr = bp->b_addr; 276 struct xfs_ondisk_hdr *hdr = bp->b_addr;
277 277
278 if (hdr->magic == cpu_to_be32(XFS_FOO_CRC_MAGIC)) { 278 if (hdr->magic == cpu_to_be32(XFS_FOO_CRC_MAGIC)) {
@@ -297,7 +297,7 @@ static void
297xfs_foo_write_verify( 297xfs_foo_write_verify(
298 struct xfs_buf *bp) 298 struct xfs_buf *bp)
299{ 299{
300 struct xfs_mount *mp = bp->b_target->bt_mount; 300 struct xfs_mount *mp = bp->b_mount;
301 struct xfs_buf_log_item *bip = bp->b_fspriv; 301 struct xfs_buf_log_item *bip = bp->b_fspriv;
302 302
303 if (!xfs_foo_verify(bp)) { 303 if (!xfs_foo_verify(bp)) {
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index dbbff823d9e2..1bf3e1c63e98 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -555,7 +555,7 @@ static xfs_failaddr_t
555xfs_agfl_verify( 555xfs_agfl_verify(
556 struct xfs_buf *bp) 556 struct xfs_buf *bp)
557{ 557{
558 struct xfs_mount *mp = bp->b_target->bt_mount; 558 struct xfs_mount *mp = bp->b_mount;
559 struct xfs_agfl *agfl = XFS_BUF_TO_AGFL(bp); 559 struct xfs_agfl *agfl = XFS_BUF_TO_AGFL(bp);
560 int i; 560 int i;
561 561
@@ -596,7 +596,7 @@ static void
596xfs_agfl_read_verify( 596xfs_agfl_read_verify(
597 struct xfs_buf *bp) 597 struct xfs_buf *bp)
598{ 598{
599 struct xfs_mount *mp = bp->b_target->bt_mount; 599 struct xfs_mount *mp = bp->b_mount;
600 xfs_failaddr_t fa; 600 xfs_failaddr_t fa;
601 601
602 /* 602 /*
@@ -621,7 +621,7 @@ static void
621xfs_agfl_write_verify( 621xfs_agfl_write_verify(
622 struct xfs_buf *bp) 622 struct xfs_buf *bp)
623{ 623{
624 struct xfs_mount *mp = bp->b_target->bt_mount; 624 struct xfs_mount *mp = bp->b_mount;
625 struct xfs_buf_log_item *bip = bp->b_log_item; 625 struct xfs_buf_log_item *bip = bp->b_log_item;
626 xfs_failaddr_t fa; 626 xfs_failaddr_t fa;
627 627
@@ -2586,7 +2586,7 @@ static xfs_failaddr_t
2586xfs_agf_verify( 2586xfs_agf_verify(
2587 struct xfs_buf *bp) 2587 struct xfs_buf *bp)
2588{ 2588{
2589 struct xfs_mount *mp = bp->b_target->bt_mount; 2589 struct xfs_mount *mp = bp->b_mount;
2590 struct xfs_agf *agf = XFS_BUF_TO_AGF(bp); 2590 struct xfs_agf *agf = XFS_BUF_TO_AGF(bp);
2591 2591
2592 if (xfs_sb_version_hascrc(&mp->m_sb)) { 2592 if (xfs_sb_version_hascrc(&mp->m_sb)) {
@@ -2644,7 +2644,7 @@ static void
2644xfs_agf_read_verify( 2644xfs_agf_read_verify(
2645 struct xfs_buf *bp) 2645 struct xfs_buf *bp)
2646{ 2646{
2647 struct xfs_mount *mp = bp->b_target->bt_mount; 2647 struct xfs_mount *mp = bp->b_mount;
2648 xfs_failaddr_t fa; 2648 xfs_failaddr_t fa;
2649 2649
2650 if (xfs_sb_version_hascrc(&mp->m_sb) && 2650 if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -2661,7 +2661,7 @@ static void
2661xfs_agf_write_verify( 2661xfs_agf_write_verify(
2662 struct xfs_buf *bp) 2662 struct xfs_buf *bp)
2663{ 2663{
2664 struct xfs_mount *mp = bp->b_target->bt_mount; 2664 struct xfs_mount *mp = bp->b_mount;
2665 struct xfs_buf_log_item *bip = bp->b_log_item; 2665 struct xfs_buf_log_item *bip = bp->b_log_item;
2666 xfs_failaddr_t fa; 2666 xfs_failaddr_t fa;
2667 2667
diff --git a/fs/xfs/libxfs/xfs_alloc_btree.c b/fs/xfs/libxfs/xfs_alloc_btree.c
index 9fe949f6055e..9b2786ee4081 100644
--- a/fs/xfs/libxfs/xfs_alloc_btree.c
+++ b/fs/xfs/libxfs/xfs_alloc_btree.c
@@ -292,7 +292,7 @@ static xfs_failaddr_t
292xfs_allocbt_verify( 292xfs_allocbt_verify(
293 struct xfs_buf *bp) 293 struct xfs_buf *bp)
294{ 294{
295 struct xfs_mount *mp = bp->b_target->bt_mount; 295 struct xfs_mount *mp = bp->b_mount;
296 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 296 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
297 struct xfs_perag *pag = bp->b_pag; 297 struct xfs_perag *pag = bp->b_pag;
298 xfs_failaddr_t fa; 298 xfs_failaddr_t fa;
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index 1f6e3965ff74..654a599a3754 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -240,7 +240,7 @@ xfs_attr3_leaf_verify(
240 struct xfs_buf *bp) 240 struct xfs_buf *bp)
241{ 241{
242 struct xfs_attr3_icleaf_hdr ichdr; 242 struct xfs_attr3_icleaf_hdr ichdr;
243 struct xfs_mount *mp = bp->b_target->bt_mount; 243 struct xfs_mount *mp = bp->b_mount;
244 struct xfs_attr_leafblock *leaf = bp->b_addr; 244 struct xfs_attr_leafblock *leaf = bp->b_addr;
245 struct xfs_attr_leaf_entry *entries; 245 struct xfs_attr_leaf_entry *entries;
246 uint32_t end; /* must be 32bit - see below */ 246 uint32_t end; /* must be 32bit - see below */
@@ -313,7 +313,7 @@ static void
313xfs_attr3_leaf_write_verify( 313xfs_attr3_leaf_write_verify(
314 struct xfs_buf *bp) 314 struct xfs_buf *bp)
315{ 315{
316 struct xfs_mount *mp = bp->b_target->bt_mount; 316 struct xfs_mount *mp = bp->b_mount;
317 struct xfs_buf_log_item *bip = bp->b_log_item; 317 struct xfs_buf_log_item *bip = bp->b_log_item;
318 struct xfs_attr3_leaf_hdr *hdr3 = bp->b_addr; 318 struct xfs_attr3_leaf_hdr *hdr3 = bp->b_addr;
319 xfs_failaddr_t fa; 319 xfs_failaddr_t fa;
@@ -343,7 +343,7 @@ static void
343xfs_attr3_leaf_read_verify( 343xfs_attr3_leaf_read_verify(
344 struct xfs_buf *bp) 344 struct xfs_buf *bp)
345{ 345{
346 struct xfs_mount *mp = bp->b_target->bt_mount; 346 struct xfs_mount *mp = bp->b_mount;
347 xfs_failaddr_t fa; 347 xfs_failaddr_t fa;
348 348
349 if (xfs_sb_version_hascrc(&mp->m_sb) && 349 if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -865,7 +865,7 @@ xfs_attr_shortform_allfit(
865 struct xfs_attr3_icleaf_hdr leafhdr; 865 struct xfs_attr3_icleaf_hdr leafhdr;
866 int bytes; 866 int bytes;
867 int i; 867 int i;
868 struct xfs_mount *mp = bp->b_target->bt_mount; 868 struct xfs_mount *mp = bp->b_mount;
869 869
870 leaf = bp->b_addr; 870 leaf = bp->b_addr;
871 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &leafhdr, leaf); 871 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &leafhdr, leaf);
@@ -1525,7 +1525,7 @@ xfs_attr_leaf_order(
1525{ 1525{
1526 struct xfs_attr3_icleaf_hdr ichdr1; 1526 struct xfs_attr3_icleaf_hdr ichdr1;
1527 struct xfs_attr3_icleaf_hdr ichdr2; 1527 struct xfs_attr3_icleaf_hdr ichdr2;
1528 struct xfs_mount *mp = leaf1_bp->b_target->bt_mount; 1528 struct xfs_mount *mp = leaf1_bp->b_mount;
1529 1529
1530 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr1, leaf1_bp->b_addr); 1530 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr1, leaf1_bp->b_addr);
1531 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr2, leaf2_bp->b_addr); 1531 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr2, leaf2_bp->b_addr);
@@ -2568,7 +2568,7 @@ xfs_attr_leaf_lasthash(
2568{ 2568{
2569 struct xfs_attr3_icleaf_hdr ichdr; 2569 struct xfs_attr3_icleaf_hdr ichdr;
2570 struct xfs_attr_leaf_entry *entries; 2570 struct xfs_attr_leaf_entry *entries;
2571 struct xfs_mount *mp = bp->b_target->bt_mount; 2571 struct xfs_mount *mp = bp->b_mount;
2572 2572
2573 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, bp->b_addr); 2573 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, bp->b_addr);
2574 entries = xfs_attr3_leaf_entryp(bp->b_addr); 2574 entries = xfs_attr3_leaf_entryp(bp->b_addr);
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index 8b47f9110ddd..869bda380eb0 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -111,7 +111,7 @@ __xfs_attr3_rmt_read_verify(
111 bool check_crc, 111 bool check_crc,
112 xfs_failaddr_t *failaddr) 112 xfs_failaddr_t *failaddr)
113{ 113{
114 struct xfs_mount *mp = bp->b_target->bt_mount; 114 struct xfs_mount *mp = bp->b_mount;
115 char *ptr; 115 char *ptr;
116 int len; 116 int len;
117 xfs_daddr_t bno; 117 xfs_daddr_t bno;
@@ -175,7 +175,7 @@ static void
175xfs_attr3_rmt_write_verify( 175xfs_attr3_rmt_write_verify(
176 struct xfs_buf *bp) 176 struct xfs_buf *bp)
177{ 177{
178 struct xfs_mount *mp = bp->b_target->bt_mount; 178 struct xfs_mount *mp = bp->b_mount;
179 xfs_failaddr_t fa; 179 xfs_failaddr_t fa;
180 int blksize = mp->m_attr_geo->blksize; 180 int blksize = mp->m_attr_geo->blksize;
181 char *ptr; 181 char *ptr;
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c
index aff82ed112c9..e6100bd3ec62 100644
--- a/fs/xfs/libxfs/xfs_bmap_btree.c
+++ b/fs/xfs/libxfs/xfs_bmap_btree.c
@@ -411,7 +411,7 @@ static xfs_failaddr_t
411xfs_bmbt_verify( 411xfs_bmbt_verify(
412 struct xfs_buf *bp) 412 struct xfs_buf *bp)
413{ 413{
414 struct xfs_mount *mp = bp->b_target->bt_mount; 414 struct xfs_mount *mp = bp->b_mount;
415 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 415 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
416 xfs_failaddr_t fa; 416 xfs_failaddr_t fa;
417 unsigned int level; 417 unsigned int level;
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index 7d3d7c42da40..84c1c3dc54f6 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -276,7 +276,7 @@ xfs_btree_lblock_calc_crc(
276 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 276 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
277 struct xfs_buf_log_item *bip = bp->b_log_item; 277 struct xfs_buf_log_item *bip = bp->b_log_item;
278 278
279 if (!xfs_sb_version_hascrc(&bp->b_target->bt_mount->m_sb)) 279 if (!xfs_sb_version_hascrc(&bp->b_mount->m_sb))
280 return; 280 return;
281 if (bip) 281 if (bip)
282 block->bb_u.l.bb_lsn = cpu_to_be64(bip->bli_item.li_lsn); 282 block->bb_u.l.bb_lsn = cpu_to_be64(bip->bli_item.li_lsn);
@@ -288,7 +288,7 @@ xfs_btree_lblock_verify_crc(
288 struct xfs_buf *bp) 288 struct xfs_buf *bp)
289{ 289{
290 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 290 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
291 struct xfs_mount *mp = bp->b_target->bt_mount; 291 struct xfs_mount *mp = bp->b_mount;
292 292
293 if (xfs_sb_version_hascrc(&mp->m_sb)) { 293 if (xfs_sb_version_hascrc(&mp->m_sb)) {
294 if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.l.bb_lsn))) 294 if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.l.bb_lsn)))
@@ -314,7 +314,7 @@ xfs_btree_sblock_calc_crc(
314 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 314 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
315 struct xfs_buf_log_item *bip = bp->b_log_item; 315 struct xfs_buf_log_item *bip = bp->b_log_item;
316 316
317 if (!xfs_sb_version_hascrc(&bp->b_target->bt_mount->m_sb)) 317 if (!xfs_sb_version_hascrc(&bp->b_mount->m_sb))
318 return; 318 return;
319 if (bip) 319 if (bip)
320 block->bb_u.s.bb_lsn = cpu_to_be64(bip->bli_item.li_lsn); 320 block->bb_u.s.bb_lsn = cpu_to_be64(bip->bli_item.li_lsn);
@@ -326,7 +326,7 @@ xfs_btree_sblock_verify_crc(
326 struct xfs_buf *bp) 326 struct xfs_buf *bp)
327{ 327{
328 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 328 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
329 struct xfs_mount *mp = bp->b_target->bt_mount; 329 struct xfs_mount *mp = bp->b_mount;
330 330
331 if (xfs_sb_version_hascrc(&mp->m_sb)) { 331 if (xfs_sb_version_hascrc(&mp->m_sb)) {
332 if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.s.bb_lsn))) 332 if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.s.bb_lsn)))
@@ -4425,7 +4425,7 @@ xfs_btree_lblock_v5hdr_verify(
4425 struct xfs_buf *bp, 4425 struct xfs_buf *bp,
4426 uint64_t owner) 4426 uint64_t owner)
4427{ 4427{
4428 struct xfs_mount *mp = bp->b_target->bt_mount; 4428 struct xfs_mount *mp = bp->b_mount;
4429 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 4429 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
4430 4430
4431 if (!xfs_sb_version_hascrc(&mp->m_sb)) 4431 if (!xfs_sb_version_hascrc(&mp->m_sb))
@@ -4446,7 +4446,7 @@ xfs_btree_lblock_verify(
4446 struct xfs_buf *bp, 4446 struct xfs_buf *bp,
4447 unsigned int max_recs) 4447 unsigned int max_recs)
4448{ 4448{
4449 struct xfs_mount *mp = bp->b_target->bt_mount; 4449 struct xfs_mount *mp = bp->b_mount;
4450 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 4450 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
4451 4451
4452 /* numrecs verification */ 4452 /* numrecs verification */
@@ -4476,7 +4476,7 @@ xfs_failaddr_t
4476xfs_btree_sblock_v5hdr_verify( 4476xfs_btree_sblock_v5hdr_verify(
4477 struct xfs_buf *bp) 4477 struct xfs_buf *bp)
4478{ 4478{
4479 struct xfs_mount *mp = bp->b_target->bt_mount; 4479 struct xfs_mount *mp = bp->b_mount;
4480 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 4480 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
4481 struct xfs_perag *pag = bp->b_pag; 4481 struct xfs_perag *pag = bp->b_pag;
4482 4482
@@ -4502,7 +4502,7 @@ xfs_btree_sblock_verify(
4502 struct xfs_buf *bp, 4502 struct xfs_buf *bp,
4503 unsigned int max_recs) 4503 unsigned int max_recs)
4504{ 4504{
4505 struct xfs_mount *mp = bp->b_target->bt_mount; 4505 struct xfs_mount *mp = bp->b_mount;
4506 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 4506 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
4507 xfs_agblock_t agno; 4507 xfs_agblock_t agno;
4508 4508
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index e2737e2ac2ae..224631d66ade 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -126,7 +126,7 @@ xfs_da3_blkinfo_verify(
126 struct xfs_buf *bp, 126 struct xfs_buf *bp,
127 struct xfs_da3_blkinfo *hdr3) 127 struct xfs_da3_blkinfo *hdr3)
128{ 128{
129 struct xfs_mount *mp = bp->b_target->bt_mount; 129 struct xfs_mount *mp = bp->b_mount;
130 struct xfs_da_blkinfo *hdr = &hdr3->hdr; 130 struct xfs_da_blkinfo *hdr = &hdr3->hdr;
131 131
132 if (!xfs_verify_magic16(bp, hdr->magic)) 132 if (!xfs_verify_magic16(bp, hdr->magic))
@@ -148,7 +148,7 @@ static xfs_failaddr_t
148xfs_da3_node_verify( 148xfs_da3_node_verify(
149 struct xfs_buf *bp) 149 struct xfs_buf *bp)
150{ 150{
151 struct xfs_mount *mp = bp->b_target->bt_mount; 151 struct xfs_mount *mp = bp->b_mount;
152 struct xfs_da_intnode *hdr = bp->b_addr; 152 struct xfs_da_intnode *hdr = bp->b_addr;
153 struct xfs_da3_icnode_hdr ichdr; 153 struct xfs_da3_icnode_hdr ichdr;
154 const struct xfs_dir_ops *ops; 154 const struct xfs_dir_ops *ops;
@@ -186,7 +186,7 @@ static void
186xfs_da3_node_write_verify( 186xfs_da3_node_write_verify(
187 struct xfs_buf *bp) 187 struct xfs_buf *bp)
188{ 188{
189 struct xfs_mount *mp = bp->b_target->bt_mount; 189 struct xfs_mount *mp = bp->b_mount;
190 struct xfs_buf_log_item *bip = bp->b_log_item; 190 struct xfs_buf_log_item *bip = bp->b_log_item;
191 struct xfs_da3_node_hdr *hdr3 = bp->b_addr; 191 struct xfs_da3_node_hdr *hdr3 = bp->b_addr;
192 xfs_failaddr_t fa; 192 xfs_failaddr_t fa;
diff --git a/fs/xfs/libxfs/xfs_dir2_block.c b/fs/xfs/libxfs/xfs_dir2_block.c
index c73183373dd1..19e61509cf53 100644
--- a/fs/xfs/libxfs/xfs_dir2_block.c
+++ b/fs/xfs/libxfs/xfs_dir2_block.c
@@ -51,7 +51,7 @@ static xfs_failaddr_t
51xfs_dir3_block_verify( 51xfs_dir3_block_verify(
52 struct xfs_buf *bp) 52 struct xfs_buf *bp)
53{ 53{
54 struct xfs_mount *mp = bp->b_target->bt_mount; 54 struct xfs_mount *mp = bp->b_mount;
55 struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; 55 struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
56 56
57 if (!xfs_verify_magic(bp, hdr3->magic)) 57 if (!xfs_verify_magic(bp, hdr3->magic))
@@ -72,7 +72,7 @@ static void
72xfs_dir3_block_read_verify( 72xfs_dir3_block_read_verify(
73 struct xfs_buf *bp) 73 struct xfs_buf *bp)
74{ 74{
75 struct xfs_mount *mp = bp->b_target->bt_mount; 75 struct xfs_mount *mp = bp->b_mount;
76 xfs_failaddr_t fa; 76 xfs_failaddr_t fa;
77 77
78 if (xfs_sb_version_hascrc(&mp->m_sb) && 78 if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -89,7 +89,7 @@ static void
89xfs_dir3_block_write_verify( 89xfs_dir3_block_write_verify(
90 struct xfs_buf *bp) 90 struct xfs_buf *bp)
91{ 91{
92 struct xfs_mount *mp = bp->b_target->bt_mount; 92 struct xfs_mount *mp = bp->b_mount;
93 struct xfs_buf_log_item *bip = bp->b_log_item; 93 struct xfs_buf_log_item *bip = bp->b_log_item;
94 struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; 94 struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
95 xfs_failaddr_t fa; 95 xfs_failaddr_t fa;
diff --git a/fs/xfs/libxfs/xfs_dir2_data.c b/fs/xfs/libxfs/xfs_dir2_data.c
index efbb009d3d65..00ae0f0d97c4 100644
--- a/fs/xfs/libxfs/xfs_dir2_data.c
+++ b/fs/xfs/libxfs/xfs_dir2_data.c
@@ -51,14 +51,13 @@ __xfs_dir3_data_check(
51 int i; /* leaf index */ 51 int i; /* leaf index */
52 int lastfree; /* last entry was unused */ 52 int lastfree; /* last entry was unused */
53 xfs_dir2_leaf_entry_t *lep=NULL; /* block leaf entries */ 53 xfs_dir2_leaf_entry_t *lep=NULL; /* block leaf entries */
54 xfs_mount_t *mp; /* filesystem mount point */ 54 struct xfs_mount *mp = bp->b_mount;
55 char *p; /* current data position */ 55 char *p; /* current data position */
56 int stale; /* count of stale leaves */ 56 int stale; /* count of stale leaves */
57 struct xfs_name name; 57 struct xfs_name name;
58 const struct xfs_dir_ops *ops; 58 const struct xfs_dir_ops *ops;
59 struct xfs_da_geometry *geo; 59 struct xfs_da_geometry *geo;
60 60
61 mp = bp->b_target->bt_mount;
62 geo = mp->m_dir_geo; 61 geo = mp->m_dir_geo;
63 62
64 /* 63 /*
@@ -250,7 +249,7 @@ static xfs_failaddr_t
250xfs_dir3_data_verify( 249xfs_dir3_data_verify(
251 struct xfs_buf *bp) 250 struct xfs_buf *bp)
252{ 251{
253 struct xfs_mount *mp = bp->b_target->bt_mount; 252 struct xfs_mount *mp = bp->b_mount;
254 struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; 253 struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
255 254
256 if (!xfs_verify_magic(bp, hdr3->magic)) 255 if (!xfs_verify_magic(bp, hdr3->magic))
@@ -299,7 +298,7 @@ static void
299xfs_dir3_data_read_verify( 298xfs_dir3_data_read_verify(
300 struct xfs_buf *bp) 299 struct xfs_buf *bp)
301{ 300{
302 struct xfs_mount *mp = bp->b_target->bt_mount; 301 struct xfs_mount *mp = bp->b_mount;
303 xfs_failaddr_t fa; 302 xfs_failaddr_t fa;
304 303
305 if (xfs_sb_version_hascrc(&mp->m_sb) && 304 if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -316,7 +315,7 @@ static void
316xfs_dir3_data_write_verify( 315xfs_dir3_data_write_verify(
317 struct xfs_buf *bp) 316 struct xfs_buf *bp)
318{ 317{
319 struct xfs_mount *mp = bp->b_target->bt_mount; 318 struct xfs_mount *mp = bp->b_mount;
320 struct xfs_buf_log_item *bip = bp->b_log_item; 319 struct xfs_buf_log_item *bip = bp->b_log_item;
321 struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; 320 struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
322 xfs_failaddr_t fa; 321 xfs_failaddr_t fa;
diff --git a/fs/xfs/libxfs/xfs_dir2_leaf.c b/fs/xfs/libxfs/xfs_dir2_leaf.c
index ce75313d7ed6..73bc3ea89723 100644
--- a/fs/xfs/libxfs/xfs_dir2_leaf.c
+++ b/fs/xfs/libxfs/xfs_dir2_leaf.c
@@ -145,7 +145,7 @@ static xfs_failaddr_t
145xfs_dir3_leaf_verify( 145xfs_dir3_leaf_verify(
146 struct xfs_buf *bp) 146 struct xfs_buf *bp)
147{ 147{
148 struct xfs_mount *mp = bp->b_target->bt_mount; 148 struct xfs_mount *mp = bp->b_mount;
149 struct xfs_dir2_leaf *leaf = bp->b_addr; 149 struct xfs_dir2_leaf *leaf = bp->b_addr;
150 xfs_failaddr_t fa; 150 xfs_failaddr_t fa;
151 151
@@ -160,7 +160,7 @@ static void
160xfs_dir3_leaf_read_verify( 160xfs_dir3_leaf_read_verify(
161 struct xfs_buf *bp) 161 struct xfs_buf *bp)
162{ 162{
163 struct xfs_mount *mp = bp->b_target->bt_mount; 163 struct xfs_mount *mp = bp->b_mount;
164 xfs_failaddr_t fa; 164 xfs_failaddr_t fa;
165 165
166 if (xfs_sb_version_hascrc(&mp->m_sb) && 166 if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -177,7 +177,7 @@ static void
177xfs_dir3_leaf_write_verify( 177xfs_dir3_leaf_write_verify(
178 struct xfs_buf *bp) 178 struct xfs_buf *bp)
179{ 179{
180 struct xfs_mount *mp = bp->b_target->bt_mount; 180 struct xfs_mount *mp = bp->b_mount;
181 struct xfs_buf_log_item *bip = bp->b_log_item; 181 struct xfs_buf_log_item *bip = bp->b_log_item;
182 struct xfs_dir3_leaf_hdr *hdr3 = bp->b_addr; 182 struct xfs_dir3_leaf_hdr *hdr3 = bp->b_addr;
183 xfs_failaddr_t fa; 183 xfs_failaddr_t fa;
diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
index 0a8fa453a7c6..747d14df9785 100644
--- a/fs/xfs/libxfs/xfs_dir2_node.c
+++ b/fs/xfs/libxfs/xfs_dir2_node.c
@@ -85,7 +85,7 @@ static xfs_failaddr_t
85xfs_dir3_free_verify( 85xfs_dir3_free_verify(
86 struct xfs_buf *bp) 86 struct xfs_buf *bp)
87{ 87{
88 struct xfs_mount *mp = bp->b_target->bt_mount; 88 struct xfs_mount *mp = bp->b_mount;
89 struct xfs_dir2_free_hdr *hdr = bp->b_addr; 89 struct xfs_dir2_free_hdr *hdr = bp->b_addr;
90 90
91 if (!xfs_verify_magic(bp, hdr->magic)) 91 if (!xfs_verify_magic(bp, hdr->magic))
@@ -111,7 +111,7 @@ static void
111xfs_dir3_free_read_verify( 111xfs_dir3_free_read_verify(
112 struct xfs_buf *bp) 112 struct xfs_buf *bp)
113{ 113{
114 struct xfs_mount *mp = bp->b_target->bt_mount; 114 struct xfs_mount *mp = bp->b_mount;
115 xfs_failaddr_t fa; 115 xfs_failaddr_t fa;
116 116
117 if (xfs_sb_version_hascrc(&mp->m_sb) && 117 if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -128,7 +128,7 @@ static void
128xfs_dir3_free_write_verify( 128xfs_dir3_free_write_verify(
129 struct xfs_buf *bp) 129 struct xfs_buf *bp)
130{ 130{
131 struct xfs_mount *mp = bp->b_target->bt_mount; 131 struct xfs_mount *mp = bp->b_mount;
132 struct xfs_buf_log_item *bip = bp->b_log_item; 132 struct xfs_buf_log_item *bip = bp->b_log_item;
133 struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; 133 struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
134 xfs_failaddr_t fa; 134 xfs_failaddr_t fa;
diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c
index 88fa11071f9f..194d2f0194aa 100644
--- a/fs/xfs/libxfs/xfs_dquot_buf.c
+++ b/fs/xfs/libxfs/xfs_dquot_buf.c
@@ -224,7 +224,7 @@ static xfs_failaddr_t
224xfs_dquot_buf_verify_struct( 224xfs_dquot_buf_verify_struct(
225 struct xfs_buf *bp) 225 struct xfs_buf *bp)
226{ 226{
227 struct xfs_mount *mp = bp->b_target->bt_mount; 227 struct xfs_mount *mp = bp->b_mount;
228 228
229 return xfs_dquot_buf_verify(mp, bp, false); 229 return xfs_dquot_buf_verify(mp, bp, false);
230} 230}
@@ -233,7 +233,7 @@ static void
233xfs_dquot_buf_read_verify( 233xfs_dquot_buf_read_verify(
234 struct xfs_buf *bp) 234 struct xfs_buf *bp)
235{ 235{
236 struct xfs_mount *mp = bp->b_target->bt_mount; 236 struct xfs_mount *mp = bp->b_mount;
237 237
238 if (!xfs_dquot_buf_verify_crc(mp, bp, false)) 238 if (!xfs_dquot_buf_verify_crc(mp, bp, false))
239 return; 239 return;
@@ -250,7 +250,7 @@ static void
250xfs_dquot_buf_readahead_verify( 250xfs_dquot_buf_readahead_verify(
251 struct xfs_buf *bp) 251 struct xfs_buf *bp)
252{ 252{
253 struct xfs_mount *mp = bp->b_target->bt_mount; 253 struct xfs_mount *mp = bp->b_mount;
254 254
255 if (!xfs_dquot_buf_verify_crc(mp, bp, true) || 255 if (!xfs_dquot_buf_verify_crc(mp, bp, true) ||
256 xfs_dquot_buf_verify(mp, bp, true) != NULL) { 256 xfs_dquot_buf_verify(mp, bp, true) != NULL) {
@@ -268,7 +268,7 @@ static void
268xfs_dquot_buf_write_verify( 268xfs_dquot_buf_write_verify(
269 struct xfs_buf *bp) 269 struct xfs_buf *bp)
270{ 270{
271 struct xfs_mount *mp = bp->b_target->bt_mount; 271 struct xfs_mount *mp = bp->b_mount;
272 272
273 xfs_dquot_buf_verify(mp, bp, false); 273 xfs_dquot_buf_verify(mp, bp, false);
274} 274}
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 0f5ff2a4b0b8..b6ca15584f5c 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -2470,7 +2470,7 @@ static xfs_failaddr_t
2470xfs_agi_verify( 2470xfs_agi_verify(
2471 struct xfs_buf *bp) 2471 struct xfs_buf *bp)
2472{ 2472{
2473 struct xfs_mount *mp = bp->b_target->bt_mount; 2473 struct xfs_mount *mp = bp->b_mount;
2474 struct xfs_agi *agi = XFS_BUF_TO_AGI(bp); 2474 struct xfs_agi *agi = XFS_BUF_TO_AGI(bp);
2475 int i; 2475 int i;
2476 2476
@@ -2522,7 +2522,7 @@ static void
2522xfs_agi_read_verify( 2522xfs_agi_read_verify(
2523 struct xfs_buf *bp) 2523 struct xfs_buf *bp)
2524{ 2524{
2525 struct xfs_mount *mp = bp->b_target->bt_mount; 2525 struct xfs_mount *mp = bp->b_mount;
2526 xfs_failaddr_t fa; 2526 xfs_failaddr_t fa;
2527 2527
2528 if (xfs_sb_version_hascrc(&mp->m_sb) && 2528 if (xfs_sb_version_hascrc(&mp->m_sb) &&
@@ -2539,7 +2539,7 @@ static void
2539xfs_agi_write_verify( 2539xfs_agi_write_verify(
2540 struct xfs_buf *bp) 2540 struct xfs_buf *bp)
2541{ 2541{
2542 struct xfs_mount *mp = bp->b_target->bt_mount; 2542 struct xfs_mount *mp = bp->b_mount;
2543 struct xfs_buf_log_item *bip = bp->b_log_item; 2543 struct xfs_buf_log_item *bip = bp->b_log_item;
2544 xfs_failaddr_t fa; 2544 xfs_failaddr_t fa;
2545 2545
diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c
index ac4b65da4c2b..ebb6fadbedb0 100644
--- a/fs/xfs/libxfs/xfs_ialloc_btree.c
+++ b/fs/xfs/libxfs/xfs_ialloc_btree.c
@@ -255,7 +255,7 @@ static xfs_failaddr_t
255xfs_inobt_verify( 255xfs_inobt_verify(
256 struct xfs_buf *bp) 256 struct xfs_buf *bp)
257{ 257{
258 struct xfs_mount *mp = bp->b_target->bt_mount; 258 struct xfs_mount *mp = bp->b_mount;
259 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 259 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
260 xfs_failaddr_t fa; 260 xfs_failaddr_t fa;
261 unsigned int level; 261 unsigned int level;
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
index fd7c02ee744b..9bb9c73c1eb2 100644
--- a/fs/xfs/libxfs/xfs_inode_buf.c
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
@@ -77,7 +77,7 @@ xfs_inode_buf_verify(
77 struct xfs_buf *bp, 77 struct xfs_buf *bp,
78 bool readahead) 78 bool readahead)
79{ 79{
80 struct xfs_mount *mp = bp->b_target->bt_mount; 80 struct xfs_mount *mp = bp->b_mount;
81 xfs_agnumber_t agno; 81 xfs_agnumber_t agno;
82 int i; 82 int i;
83 int ni; 83 int ni;
diff --git a/fs/xfs/libxfs/xfs_refcount_btree.c b/fs/xfs/libxfs/xfs_refcount_btree.c
index 5d9de9b21726..5d1dfc49ac89 100644
--- a/fs/xfs/libxfs/xfs_refcount_btree.c
+++ b/fs/xfs/libxfs/xfs_refcount_btree.c
@@ -203,7 +203,7 @@ STATIC xfs_failaddr_t
203xfs_refcountbt_verify( 203xfs_refcountbt_verify(
204 struct xfs_buf *bp) 204 struct xfs_buf *bp)
205{ 205{
206 struct xfs_mount *mp = bp->b_target->bt_mount; 206 struct xfs_mount *mp = bp->b_mount;
207 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 207 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
208 struct xfs_perag *pag = bp->b_pag; 208 struct xfs_perag *pag = bp->b_pag;
209 xfs_failaddr_t fa; 209 xfs_failaddr_t fa;
diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c
index 5d1f8884c888..e9fe53e0dcc8 100644
--- a/fs/xfs/libxfs/xfs_rmap_btree.c
+++ b/fs/xfs/libxfs/xfs_rmap_btree.c
@@ -292,7 +292,7 @@ static xfs_failaddr_t
292xfs_rmapbt_verify( 292xfs_rmapbt_verify(
293 struct xfs_buf *bp) 293 struct xfs_buf *bp)
294{ 294{
295 struct xfs_mount *mp = bp->b_target->bt_mount; 295 struct xfs_mount *mp = bp->b_mount;
296 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); 296 struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
297 struct xfs_perag *pag = bp->b_pag; 297 struct xfs_perag *pag = bp->b_pag;
298 xfs_failaddr_t fa; 298 xfs_failaddr_t fa;
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index 326872eced21..aa21edf13d5a 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -686,7 +686,7 @@ xfs_sb_read_verify(
686 struct xfs_buf *bp) 686 struct xfs_buf *bp)
687{ 687{
688 struct xfs_sb sb; 688 struct xfs_sb sb;
689 struct xfs_mount *mp = bp->b_target->bt_mount; 689 struct xfs_mount *mp = bp->b_mount;
690 struct xfs_dsb *dsb = XFS_BUF_TO_SBP(bp); 690 struct xfs_dsb *dsb = XFS_BUF_TO_SBP(bp);
691 int error; 691 int error;
692 692
@@ -752,7 +752,7 @@ xfs_sb_write_verify(
752 struct xfs_buf *bp) 752 struct xfs_buf *bp)
753{ 753{
754 struct xfs_sb sb; 754 struct xfs_sb sb;
755 struct xfs_mount *mp = bp->b_target->bt_mount; 755 struct xfs_mount *mp = bp->b_mount;
756 struct xfs_buf_log_item *bip = bp->b_log_item; 756 struct xfs_buf_log_item *bip = bp->b_log_item;
757 int error; 757 int error;
758 758
diff --git a/fs/xfs/libxfs/xfs_symlink_remote.c b/fs/xfs/libxfs/xfs_symlink_remote.c
index a0ccc253c43d..264b94bb2295 100644
--- a/fs/xfs/libxfs/xfs_symlink_remote.c
+++ b/fs/xfs/libxfs/xfs_symlink_remote.c
@@ -90,7 +90,7 @@ static xfs_failaddr_t
90xfs_symlink_verify( 90xfs_symlink_verify(
91 struct xfs_buf *bp) 91 struct xfs_buf *bp)
92{ 92{
93 struct xfs_mount *mp = bp->b_target->bt_mount; 93 struct xfs_mount *mp = bp->b_mount;
94 struct xfs_dsymlink_hdr *dsl = bp->b_addr; 94 struct xfs_dsymlink_hdr *dsl = bp->b_addr;
95 95
96 if (!xfs_sb_version_hascrc(&mp->m_sb)) 96 if (!xfs_sb_version_hascrc(&mp->m_sb))
@@ -116,7 +116,7 @@ static void
116xfs_symlink_read_verify( 116xfs_symlink_read_verify(
117 struct xfs_buf *bp) 117 struct xfs_buf *bp)
118{ 118{
119 struct xfs_mount *mp = bp->b_target->bt_mount; 119 struct xfs_mount *mp = bp->b_mount;
120 xfs_failaddr_t fa; 120 xfs_failaddr_t fa;
121 121
122 /* no verification of non-crc buffers */ 122 /* no verification of non-crc buffers */
@@ -136,7 +136,7 @@ static void
136xfs_symlink_write_verify( 136xfs_symlink_write_verify(
137 struct xfs_buf *bp) 137 struct xfs_buf *bp)
138{ 138{
139 struct xfs_mount *mp = bp->b_target->bt_mount; 139 struct xfs_mount *mp = bp->b_mount;
140 struct xfs_buf_log_item *bip = bp->b_log_item; 140 struct xfs_buf_log_item *bip = bp->b_log_item;
141 xfs_failaddr_t fa; 141 xfs_failaddr_t fa;
142 142
diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c
index 228821b2ebe0..d4f4c96bcd4c 100644
--- a/fs/xfs/xfs_attr_inactive.c
+++ b/fs/xfs/xfs_attr_inactive.c
@@ -121,7 +121,7 @@ xfs_attr3_leaf_inactive(
121 int size; 121 int size;
122 int tmp; 122 int tmp;
123 int i; 123 int i;
124 struct xfs_mount *mp = bp->b_target->bt_mount; 124 struct xfs_mount *mp = bp->b_mount;
125 125
126 leaf = bp->b_addr; 126 leaf = bp->b_addr;
127 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf); 127 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 67913078250b..28e1d16e09a8 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -244,6 +244,7 @@ _xfs_buf_alloc(
244 sema_init(&bp->b_sema, 0); /* held, no waiters */ 244 sema_init(&bp->b_sema, 0); /* held, no waiters */
245 spin_lock_init(&bp->b_lock); 245 spin_lock_init(&bp->b_lock);
246 bp->b_target = target; 246 bp->b_target = target;
247 bp->b_mount = target->bt_mount;
247 bp->b_flags = flags; 248 bp->b_flags = flags;
248 249
249 /* 250 /*
@@ -268,7 +269,7 @@ _xfs_buf_alloc(
268 atomic_set(&bp->b_pin_count, 0); 269 atomic_set(&bp->b_pin_count, 0);
269 init_waitqueue_head(&bp->b_waiters); 270 init_waitqueue_head(&bp->b_waiters);
270 271
271 XFS_STATS_INC(target->bt_mount, xb_create); 272 XFS_STATS_INC(bp->b_mount, xb_create);
272 trace_xfs_buf_init(bp, _RET_IP_); 273 trace_xfs_buf_init(bp, _RET_IP_);
273 274
274 return bp; 275 return bp;
@@ -425,12 +426,12 @@ retry:
425 current->comm, current->pid, 426 current->comm, current->pid,
426 __func__, gfp_mask); 427 __func__, gfp_mask);
427 428
428 XFS_STATS_INC(bp->b_target->bt_mount, xb_page_retries); 429 XFS_STATS_INC(bp->b_mount, xb_page_retries);
429 congestion_wait(BLK_RW_ASYNC, HZ/50); 430 congestion_wait(BLK_RW_ASYNC, HZ/50);
430 goto retry; 431 goto retry;
431 } 432 }
432 433
433 XFS_STATS_INC(bp->b_target->bt_mount, xb_page_found); 434 XFS_STATS_INC(bp->b_mount, xb_page_found);
434 435
435 nbytes = min_t(size_t, size, PAGE_SIZE - offset); 436 nbytes = min_t(size_t, size, PAGE_SIZE - offset);
436 size -= nbytes; 437 size -= nbytes;
@@ -1103,7 +1104,7 @@ xfs_buf_lock(
1103 trace_xfs_buf_lock(bp, _RET_IP_); 1104 trace_xfs_buf_lock(bp, _RET_IP_);
1104 1105
1105 if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE)) 1106 if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE))
1106 xfs_log_force(bp->b_target->bt_mount, 0); 1107 xfs_log_force(bp->b_mount, 0);
1107 down(&bp->b_sema); 1108 down(&bp->b_sema);
1108 1109
1109 trace_xfs_buf_lock_done(bp, _RET_IP_); 1110 trace_xfs_buf_lock_done(bp, _RET_IP_);
@@ -1192,7 +1193,7 @@ xfs_buf_ioend_async(
1192 struct xfs_buf *bp) 1193 struct xfs_buf *bp)
1193{ 1194{
1194 INIT_WORK(&bp->b_ioend_work, xfs_buf_ioend_work); 1195 INIT_WORK(&bp->b_ioend_work, xfs_buf_ioend_work);
1195 queue_work(bp->b_target->bt_mount->m_buf_workqueue, &bp->b_ioend_work); 1196 queue_work(bp->b_mount->m_buf_workqueue, &bp->b_ioend_work);
1196} 1197}
1197 1198
1198void 1199void
@@ -1211,7 +1212,7 @@ xfs_buf_ioerror_alert(
1211 struct xfs_buf *bp, 1212 struct xfs_buf *bp,
1212 const char *func) 1213 const char *func)
1213{ 1214{
1214 xfs_alert(bp->b_target->bt_mount, 1215 xfs_alert(bp->b_mount,
1215"metadata I/O error in \"%s\" at daddr 0x%llx len %d error %d", 1216"metadata I/O error in \"%s\" at daddr 0x%llx len %d error %d",
1216 func, (uint64_t)XFS_BUF_ADDR(bp), bp->b_length, 1217 func, (uint64_t)XFS_BUF_ADDR(bp), bp->b_length,
1217 -bp->b_error); 1218 -bp->b_error);
@@ -1230,10 +1231,8 @@ xfs_bwrite(
1230 XBF_WRITE_FAIL | XBF_DONE); 1231 XBF_WRITE_FAIL | XBF_DONE);
1231 1232
1232 error = xfs_buf_submit(bp); 1233 error = xfs_buf_submit(bp);
1233 if (error) { 1234 if (error)
1234 xfs_force_shutdown(bp->b_target->bt_mount, 1235 xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR);
1235 SHUTDOWN_META_IO_ERROR);
1236 }
1237 return error; 1236 return error;
1238} 1237}
1239 1238
@@ -1370,12 +1369,12 @@ _xfs_buf_ioapply(
1370 if (bp->b_ops) { 1369 if (bp->b_ops) {
1371 bp->b_ops->verify_write(bp); 1370 bp->b_ops->verify_write(bp);
1372 if (bp->b_error) { 1371 if (bp->b_error) {
1373 xfs_force_shutdown(bp->b_target->bt_mount, 1372 xfs_force_shutdown(bp->b_mount,
1374 SHUTDOWN_CORRUPT_INCORE); 1373 SHUTDOWN_CORRUPT_INCORE);
1375 return; 1374 return;
1376 } 1375 }
1377 } else if (bp->b_bn != XFS_BUF_DADDR_NULL) { 1376 } else if (bp->b_bn != XFS_BUF_DADDR_NULL) {
1378 struct xfs_mount *mp = bp->b_target->bt_mount; 1377 struct xfs_mount *mp = bp->b_mount;
1379 1378
1380 /* 1379 /*
1381 * non-crc filesystems don't attach verifiers during 1380 * non-crc filesystems don't attach verifiers during
@@ -1453,7 +1452,7 @@ __xfs_buf_submit(
1453 ASSERT(!(bp->b_flags & _XBF_DELWRI_Q)); 1452 ASSERT(!(bp->b_flags & _XBF_DELWRI_Q));
1454 1453
1455 /* on shutdown we stale and complete the buffer immediately */ 1454 /* on shutdown we stale and complete the buffer immediately */
1456 if (XFS_FORCED_SHUTDOWN(bp->b_target->bt_mount)) { 1455 if (XFS_FORCED_SHUTDOWN(bp->b_mount)) {
1457 xfs_buf_ioerror(bp, -EIO); 1456 xfs_buf_ioerror(bp, -EIO);
1458 bp->b_flags &= ~XBF_DONE; 1457 bp->b_flags &= ~XBF_DONE;
1459 xfs_buf_stale(bp); 1458 xfs_buf_stale(bp);
@@ -2093,8 +2092,7 @@ void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref)
2093 * This allows userspace to disrupt buffer caching for debug/testing 2092 * This allows userspace to disrupt buffer caching for debug/testing
2094 * purposes. 2093 * purposes.
2095 */ 2094 */
2096 if (XFS_TEST_ERROR(false, bp->b_target->bt_mount, 2095 if (XFS_TEST_ERROR(false, bp->b_mount, XFS_ERRTAG_BUF_LRU_REF))
2097 XFS_ERRTAG_BUF_LRU_REF))
2098 lru_ref = 0; 2096 lru_ref = 0;
2099 2097
2100 atomic_set(&bp->b_lru_ref, lru_ref); 2098 atomic_set(&bp->b_lru_ref, lru_ref);
@@ -2110,7 +2108,7 @@ xfs_verify_magic(
2110 struct xfs_buf *bp, 2108 struct xfs_buf *bp,
2111 __be32 dmagic) 2109 __be32 dmagic)
2112{ 2110{
2113 struct xfs_mount *mp = bp->b_target->bt_mount; 2111 struct xfs_mount *mp = bp->b_mount;
2114 int idx; 2112 int idx;
2115 2113
2116 idx = xfs_sb_version_hascrc(&mp->m_sb); 2114 idx = xfs_sb_version_hascrc(&mp->m_sb);
@@ -2128,7 +2126,7 @@ xfs_verify_magic16(
2128 struct xfs_buf *bp, 2126 struct xfs_buf *bp,
2129 __be16 dmagic) 2127 __be16 dmagic)
2130{ 2128{
2131 struct xfs_mount *mp = bp->b_target->bt_mount; 2129 struct xfs_mount *mp = bp->b_mount;
2132 int idx; 2130 int idx;
2133 2131
2134 idx = xfs_sb_version_hascrc(&mp->m_sb); 2132 idx = xfs_sb_version_hascrc(&mp->m_sb);
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index d70374c365e2..c6e57a3f409e 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -145,6 +145,7 @@ typedef struct xfs_buf {
145 wait_queue_head_t b_waiters; /* unpin waiters */ 145 wait_queue_head_t b_waiters; /* unpin waiters */
146 struct list_head b_list; 146 struct list_head b_list;
147 struct xfs_perag *b_pag; /* contains rbtree root */ 147 struct xfs_perag *b_pag; /* contains rbtree root */
148 struct xfs_mount *b_mount;
148 xfs_buftarg_t *b_target; /* buffer target (device) */ 149 xfs_buftarg_t *b_target; /* buffer target (device) */
149 void *b_addr; /* virtual address of buffer */ 150 void *b_addr; /* virtual address of buffer */
150 struct work_struct b_ioend_work; 151 struct work_struct b_ioend_work;
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 3823f3f5bde9..807f609a4d1f 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -521,7 +521,7 @@ xfs_buf_item_push(
521 /* has a previous flush failed due to IO errors? */ 521 /* has a previous flush failed due to IO errors? */
522 if ((bp->b_flags & XBF_WRITE_FAIL) && 522 if ((bp->b_flags & XBF_WRITE_FAIL) &&
523 ___ratelimit(&xfs_buf_write_fail_rl_state, "XFS: Failing async write")) { 523 ___ratelimit(&xfs_buf_write_fail_rl_state, "XFS: Failing async write")) {
524 xfs_warn(bp->b_target->bt_mount, 524 xfs_warn(bp->b_mount,
525"Failing async write on buffer block 0x%llx. Retrying async write.", 525"Failing async write on buffer block 0x%llx. Retrying async write.",
526 (long long)bp->b_bn); 526 (long long)bp->b_bn);
527 } 527 }
@@ -744,7 +744,7 @@ xfs_buf_item_init(
744 * this buffer. If we do already have one, there is 744 * this buffer. If we do already have one, there is
745 * nothing to do here so return. 745 * nothing to do here so return.
746 */ 746 */
747 ASSERT(bp->b_target->bt_mount == mp); 747 ASSERT(bp->b_mount == mp);
748 if (bip) { 748 if (bip) {
749 ASSERT(bip->bli_item.li_type == XFS_LI_BUF); 749 ASSERT(bip->bli_item.li_type == XFS_LI_BUF);
750 ASSERT(!bp->b_transp); 750 ASSERT(!bp->b_transp);
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 7cc799b67232..544c9482a0ef 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -354,7 +354,7 @@ xfs_buf_verifier_error(
354 size_t bufsz, 354 size_t bufsz,
355 xfs_failaddr_t failaddr) 355 xfs_failaddr_t failaddr)
356{ 356{
357 struct xfs_mount *mp = bp->b_target->bt_mount; 357 struct xfs_mount *mp = bp->b_mount;
358 xfs_failaddr_t fa; 358 xfs_failaddr_t fa;
359 int sz; 359 int sz;
360 360
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index d8519e9a3927..45f235ee1c2b 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -299,10 +299,9 @@ xlog_recover_iodone(
299 * We're not going to bother about retrying 299 * We're not going to bother about retrying
300 * this during recovery. One strike! 300 * this during recovery. One strike!
301 */ 301 */
302 if (!XFS_FORCED_SHUTDOWN(bp->b_target->bt_mount)) { 302 if (!XFS_FORCED_SHUTDOWN(bp->b_mount)) {
303 xfs_buf_ioerror_alert(bp, __func__); 303 xfs_buf_ioerror_alert(bp, __func__);
304 xfs_force_shutdown(bp->b_target->bt_mount, 304 xfs_force_shutdown(bp->b_mount, SHUTDOWN_META_IO_ERROR);
305 SHUTDOWN_META_IO_ERROR);
306 } 305 }
307 } 306 }
308 307
@@ -2820,7 +2819,7 @@ xlog_recover_buffer_pass2(
2820 xfs_buf_stale(bp); 2819 xfs_buf_stale(bp);
2821 error = xfs_bwrite(bp); 2820 error = xfs_bwrite(bp);
2822 } else { 2821 } else {
2823 ASSERT(bp->b_target->bt_mount == mp); 2822 ASSERT(bp->b_mount == mp);
2824 bp->b_iodone = xlog_recover_iodone; 2823 bp->b_iodone = xlog_recover_iodone;
2825 xfs_buf_delwri_queue(bp, buffer_list); 2824 xfs_buf_delwri_queue(bp, buffer_list);
2826 } 2825 }
@@ -3182,7 +3181,7 @@ out_owner_change:
3182 /* re-generate the checksum. */ 3181 /* re-generate the checksum. */
3183 xfs_dinode_calc_crc(log->l_mp, dip); 3182 xfs_dinode_calc_crc(log->l_mp, dip);
3184 3183
3185 ASSERT(bp->b_target->bt_mount == mp); 3184 ASSERT(bp->b_mount == mp);
3186 bp->b_iodone = xlog_recover_iodone; 3185 bp->b_iodone = xlog_recover_iodone;
3187 xfs_buf_delwri_queue(bp, buffer_list); 3186 xfs_buf_delwri_queue(bp, buffer_list);
3188 3187
@@ -3321,7 +3320,7 @@ xlog_recover_dquot_pass2(
3321 } 3320 }
3322 3321
3323 ASSERT(dq_f->qlf_size == 2); 3322 ASSERT(dq_f->qlf_size == 2);
3324 ASSERT(bp->b_target->bt_mount == mp); 3323 ASSERT(bp->b_mount == mp);
3325 bp->b_iodone = xlog_recover_iodone; 3324 bp->b_iodone = xlog_recover_iodone;
3326 xfs_buf_delwri_queue(bp, buffer_list); 3325 xfs_buf_delwri_queue(bp, buffer_list);
3327 3326