aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-11-12 06:54:01 -0500
committerBen Myers <bpm@sgi.com>2012-11-15 22:34:02 -0500
commitc3f8fc73ac97b76a12692088ef9cace9af8422c0 (patch)
treea90e132507842b7ed8c5d93e0c002e0dc0f99a5c /fs/xfs
parentfb59581404ab7ec5075299065c22cb211a9262a9 (diff)
xfs: make buffer read verication an IO completion function
Add a verifier function callback capability to the buffer read interfaces. This will be used by the callers to supply a function that verifies the contents of the buffer when it is read from disk. This patch does not provide callback functions, but simply modifies the interfaces to allow them to be called. The reason for adding this to the read interfaces is that it is very difficult to tell fom the outside is a buffer was just read from disk or whether we just pulled it out of cache. Supplying a callbck allows the buffer cache to use it's internal knowledge of the buffer to execute it only when the buffer is read from disk. It is intended that the verifier functions will mark the buffer with an EFSCORRUPTED error when verification fails. This allows the reading context to distinguish a verification error from an IO error, and potentially take further actions on the buffer (e.g. attempt repair) based on the error reported. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Phil White <pwhite@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_alloc.c4
-rw-r--r--fs/xfs/xfs_attr.c2
-rw-r--r--fs/xfs/xfs_btree.c21
-rw-r--r--fs/xfs/xfs_buf.c13
-rw-r--r--fs/xfs/xfs_buf.h20
-rw-r--r--fs/xfs/xfs_da_btree.c4
-rw-r--r--fs/xfs/xfs_dir2_leaf.c2
-rw-r--r--fs/xfs/xfs_dquot.c4
-rw-r--r--fs/xfs/xfs_fsops.c4
-rw-r--r--fs/xfs/xfs_ialloc.c2
-rw-r--r--fs/xfs/xfs_inode.c2
-rw-r--r--fs/xfs/xfs_log.c3
-rw-r--r--fs/xfs/xfs_log_recover.c8
-rw-r--r--fs/xfs/xfs_mount.c6
-rw-r--r--fs/xfs/xfs_qm.c5
-rw-r--r--fs/xfs/xfs_rtalloc.c6
-rw-r--r--fs/xfs/xfs_trans.h19
-rw-r--r--fs/xfs/xfs_trans_buf.c9
-rw-r--r--fs/xfs/xfs_vnodeops.c2
19 files changed, 75 insertions, 61 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 335206a9c698..21c3db08fd01 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -447,7 +447,7 @@ xfs_alloc_read_agfl(
447 error = xfs_trans_read_buf( 447 error = xfs_trans_read_buf(
448 mp, tp, mp->m_ddev_targp, 448 mp, tp, mp->m_ddev_targp,
449 XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)), 449 XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)),
450 XFS_FSS_TO_BB(mp, 1), 0, &bp); 450 XFS_FSS_TO_BB(mp, 1), 0, &bp, NULL);
451 if (error) 451 if (error)
452 return error; 452 return error;
453 ASSERT(!xfs_buf_geterror(bp)); 453 ASSERT(!xfs_buf_geterror(bp));
@@ -2110,7 +2110,7 @@ xfs_read_agf(
2110 error = xfs_trans_read_buf( 2110 error = xfs_trans_read_buf(
2111 mp, tp, mp->m_ddev_targp, 2111 mp, tp, mp->m_ddev_targp,
2112 XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)), 2112 XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
2113 XFS_FSS_TO_BB(mp, 1), flags, bpp); 2113 XFS_FSS_TO_BB(mp, 1), flags, bpp, NULL);
2114 if (error) 2114 if (error)
2115 return error; 2115 return error;
2116 if (!*bpp) 2116 if (!*bpp)
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index 55bbe98e8f82..474c57a43cce 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -1994,7 +1994,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)
1994 dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock); 1994 dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock);
1995 blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount); 1995 blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount);
1996 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, 1996 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,
1997 dblkno, blkcnt, 0, &bp); 1997 dblkno, blkcnt, 0, &bp, NULL);
1998 if (error) 1998 if (error)
1999 return(error); 1999 return(error);
2000 2000
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index 121ea99e615a..7e791160092d 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -266,9 +266,12 @@ xfs_btree_dup_cursor(
266 for (i = 0; i < new->bc_nlevels; i++) { 266 for (i = 0; i < new->bc_nlevels; i++) {
267 new->bc_ptrs[i] = cur->bc_ptrs[i]; 267 new->bc_ptrs[i] = cur->bc_ptrs[i];
268 new->bc_ra[i] = cur->bc_ra[i]; 268 new->bc_ra[i] = cur->bc_ra[i];
269 if ((bp = cur->bc_bufs[i])) { 269 bp = cur->bc_bufs[i];
270 if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, 270 if (bp) {
271 XFS_BUF_ADDR(bp), mp->m_bsize, 0, &bp))) { 271 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
272 XFS_BUF_ADDR(bp), mp->m_bsize,
273 0, &bp, NULL);
274 if (error) {
272 xfs_btree_del_cursor(new, error); 275 xfs_btree_del_cursor(new, error);
273 *ncur = NULL; 276 *ncur = NULL;
274 return error; 277 return error;
@@ -624,10 +627,10 @@ xfs_btree_read_bufl(
624 627
625 ASSERT(fsbno != NULLFSBLOCK); 628 ASSERT(fsbno != NULLFSBLOCK);
626 d = XFS_FSB_TO_DADDR(mp, fsbno); 629 d = XFS_FSB_TO_DADDR(mp, fsbno);
627 if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, 630 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d,
628 mp->m_bsize, lock, &bp))) { 631 mp->m_bsize, lock, &bp, NULL);
632 if (error)
629 return error; 633 return error;
630 }
631 ASSERT(!xfs_buf_geterror(bp)); 634 ASSERT(!xfs_buf_geterror(bp));
632 if (bp) 635 if (bp)
633 xfs_buf_set_ref(bp, refval); 636 xfs_buf_set_ref(bp, refval);
@@ -650,7 +653,7 @@ xfs_btree_reada_bufl(
650 653
651 ASSERT(fsbno != NULLFSBLOCK); 654 ASSERT(fsbno != NULLFSBLOCK);
652 d = XFS_FSB_TO_DADDR(mp, fsbno); 655 d = XFS_FSB_TO_DADDR(mp, fsbno);
653 xfs_buf_readahead(mp->m_ddev_targp, d, mp->m_bsize * count); 656 xfs_buf_readahead(mp->m_ddev_targp, d, mp->m_bsize * count, NULL);
654} 657}
655 658
656/* 659/*
@@ -670,7 +673,7 @@ xfs_btree_reada_bufs(
670 ASSERT(agno != NULLAGNUMBER); 673 ASSERT(agno != NULLAGNUMBER);
671 ASSERT(agbno != NULLAGBLOCK); 674 ASSERT(agbno != NULLAGBLOCK);
672 d = XFS_AGB_TO_DADDR(mp, agno, agbno); 675 d = XFS_AGB_TO_DADDR(mp, agno, agbno);
673 xfs_buf_readahead(mp->m_ddev_targp, d, mp->m_bsize * count); 676 xfs_buf_readahead(mp->m_ddev_targp, d, mp->m_bsize * count, NULL);
674} 677}
675 678
676STATIC int 679STATIC int
@@ -1013,7 +1016,7 @@ xfs_btree_read_buf_block(
1013 1016
1014 d = xfs_btree_ptr_to_daddr(cur, ptr); 1017 d = xfs_btree_ptr_to_daddr(cur, ptr);
1015 error = xfs_trans_read_buf(mp, cur->bc_tp, mp->m_ddev_targp, d, 1018 error = xfs_trans_read_buf(mp, cur->bc_tp, mp->m_ddev_targp, d,
1016 mp->m_bsize, flags, bpp); 1019 mp->m_bsize, flags, bpp, NULL);
1017 if (error) 1020 if (error)
1018 return error; 1021 return error;
1019 1022
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 4b0b8dd1b7b0..0298dd684798 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -654,7 +654,8 @@ xfs_buf_read_map(
654 struct xfs_buftarg *target, 654 struct xfs_buftarg *target,
655 struct xfs_buf_map *map, 655 struct xfs_buf_map *map,
656 int nmaps, 656 int nmaps,
657 xfs_buf_flags_t flags) 657 xfs_buf_flags_t flags,
658 xfs_buf_iodone_t verify)
658{ 659{
659 struct xfs_buf *bp; 660 struct xfs_buf *bp;
660 661
@@ -666,6 +667,7 @@ xfs_buf_read_map(
666 667
667 if (!XFS_BUF_ISDONE(bp)) { 668 if (!XFS_BUF_ISDONE(bp)) {
668 XFS_STATS_INC(xb_get_read); 669 XFS_STATS_INC(xb_get_read);
670 bp->b_iodone = verify;
669 _xfs_buf_read(bp, flags); 671 _xfs_buf_read(bp, flags);
670 } else if (flags & XBF_ASYNC) { 672 } else if (flags & XBF_ASYNC) {
671 /* 673 /*
@@ -691,13 +693,14 @@ void
691xfs_buf_readahead_map( 693xfs_buf_readahead_map(
692 struct xfs_buftarg *target, 694 struct xfs_buftarg *target,
693 struct xfs_buf_map *map, 695 struct xfs_buf_map *map,
694 int nmaps) 696 int nmaps,
697 xfs_buf_iodone_t verify)
695{ 698{
696 if (bdi_read_congested(target->bt_bdi)) 699 if (bdi_read_congested(target->bt_bdi))
697 return; 700 return;
698 701
699 xfs_buf_read_map(target, map, nmaps, 702 xfs_buf_read_map(target, map, nmaps,
700 XBF_TRYLOCK|XBF_ASYNC|XBF_READ_AHEAD); 703 XBF_TRYLOCK|XBF_ASYNC|XBF_READ_AHEAD, verify);
701} 704}
702 705
703/* 706/*
@@ -709,7 +712,8 @@ xfs_buf_read_uncached(
709 struct xfs_buftarg *target, 712 struct xfs_buftarg *target,
710 xfs_daddr_t daddr, 713 xfs_daddr_t daddr,
711 size_t numblks, 714 size_t numblks,
712 int flags) 715 int flags,
716 xfs_buf_iodone_t verify)
713{ 717{
714 xfs_buf_t *bp; 718 xfs_buf_t *bp;
715 int error; 719 int error;
@@ -723,6 +727,7 @@ xfs_buf_read_uncached(
723 bp->b_bn = daddr; 727 bp->b_bn = daddr;
724 bp->b_maps[0].bm_bn = daddr; 728 bp->b_maps[0].bm_bn = daddr;
725 bp->b_flags |= XBF_READ; 729 bp->b_flags |= XBF_READ;
730 bp->b_iodone = verify;
726 731
727 xfsbdstrat(target->bt_mount, bp); 732 xfsbdstrat(target->bt_mount, bp);
728 error = xfs_buf_iowait(bp); 733 error = xfs_buf_iowait(bp);
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index 7c0b6a0a1557..677b1dc822f4 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -100,6 +100,7 @@ typedef struct xfs_buftarg {
100struct xfs_buf; 100struct xfs_buf;
101typedef void (*xfs_buf_iodone_t)(struct xfs_buf *); 101typedef void (*xfs_buf_iodone_t)(struct xfs_buf *);
102 102
103
103#define XB_PAGES 2 104#define XB_PAGES 2
104 105
105struct xfs_buf_map { 106struct xfs_buf_map {
@@ -159,7 +160,6 @@ typedef struct xfs_buf {
159#endif 160#endif
160} xfs_buf_t; 161} xfs_buf_t;
161 162
162
163/* Finding and Reading Buffers */ 163/* Finding and Reading Buffers */
164struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target, 164struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target,
165 struct xfs_buf_map *map, int nmaps, 165 struct xfs_buf_map *map, int nmaps,
@@ -196,9 +196,10 @@ struct xfs_buf *xfs_buf_get_map(struct xfs_buftarg *target,
196 xfs_buf_flags_t flags); 196 xfs_buf_flags_t flags);
197struct xfs_buf *xfs_buf_read_map(struct xfs_buftarg *target, 197struct xfs_buf *xfs_buf_read_map(struct xfs_buftarg *target,
198 struct xfs_buf_map *map, int nmaps, 198 struct xfs_buf_map *map, int nmaps,
199 xfs_buf_flags_t flags); 199 xfs_buf_flags_t flags, xfs_buf_iodone_t verify);
200void xfs_buf_readahead_map(struct xfs_buftarg *target, 200void xfs_buf_readahead_map(struct xfs_buftarg *target,
201 struct xfs_buf_map *map, int nmaps); 201 struct xfs_buf_map *map, int nmaps,
202 xfs_buf_iodone_t verify);
202 203
203static inline struct xfs_buf * 204static inline struct xfs_buf *
204xfs_buf_get( 205xfs_buf_get(
@@ -216,20 +217,22 @@ xfs_buf_read(
216 struct xfs_buftarg *target, 217 struct xfs_buftarg *target,
217 xfs_daddr_t blkno, 218 xfs_daddr_t blkno,
218 size_t numblks, 219 size_t numblks,
219 xfs_buf_flags_t flags) 220 xfs_buf_flags_t flags,
221 xfs_buf_iodone_t verify)
220{ 222{
221 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); 223 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
222 return xfs_buf_read_map(target, &map, 1, flags); 224 return xfs_buf_read_map(target, &map, 1, flags, verify);
223} 225}
224 226
225static inline void 227static inline void
226xfs_buf_readahead( 228xfs_buf_readahead(
227 struct xfs_buftarg *target, 229 struct xfs_buftarg *target,
228 xfs_daddr_t blkno, 230 xfs_daddr_t blkno,
229 size_t numblks) 231 size_t numblks,
232 xfs_buf_iodone_t verify)
230{ 233{
231 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); 234 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
232 return xfs_buf_readahead_map(target, &map, 1); 235 return xfs_buf_readahead_map(target, &map, 1, verify);
233} 236}
234 237
235struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks); 238struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks);
@@ -239,7 +242,8 @@ int xfs_buf_associate_memory(struct xfs_buf *bp, void *mem, size_t length);
239struct xfs_buf *xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks, 242struct xfs_buf *xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks,
240 int flags); 243 int flags);
241struct xfs_buf *xfs_buf_read_uncached(struct xfs_buftarg *target, 244struct xfs_buf *xfs_buf_read_uncached(struct xfs_buftarg *target,
242 xfs_daddr_t daddr, size_t numblks, int flags); 245 xfs_daddr_t daddr, size_t numblks, int flags,
246 xfs_buf_iodone_t verify);
243void xfs_buf_hold(struct xfs_buf *bp); 247void xfs_buf_hold(struct xfs_buf *bp);
244 248
245/* Releasing Buffers */ 249/* Releasing Buffers */
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index c62e7e6ff50e..4af8bad7068c 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -2161,7 +2161,7 @@ xfs_da_read_buf(
2161 2161
2162 error = xfs_trans_read_buf_map(dp->i_mount, trans, 2162 error = xfs_trans_read_buf_map(dp->i_mount, trans,
2163 dp->i_mount->m_ddev_targp, 2163 dp->i_mount->m_ddev_targp,
2164 mapp, nmap, 0, &bp); 2164 mapp, nmap, 0, &bp, NULL);
2165 if (error) 2165 if (error)
2166 goto out_free; 2166 goto out_free;
2167 2167
@@ -2237,7 +2237,7 @@ xfs_da_reada_buf(
2237 } 2237 }
2238 2238
2239 mappedbno = mapp[0].bm_bn; 2239 mappedbno = mapp[0].bm_bn;
2240 xfs_buf_readahead_map(dp->i_mount->m_ddev_targp, mapp, nmap); 2240 xfs_buf_readahead_map(dp->i_mount->m_ddev_targp, mapp, nmap, NULL);
2241 2241
2242out_free: 2242out_free:
2243 if (mapp != &map) 2243 if (mapp != &map)
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 0b296253bd01..bac86984e403 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -926,7 +926,7 @@ xfs_dir2_leaf_readbuf(
926 XFS_FSB_TO_DADDR(mp, 926 XFS_FSB_TO_DADDR(mp,
927 map[mip->ra_index].br_startblock + 927 map[mip->ra_index].br_startblock +
928 mip->ra_offset), 928 mip->ra_offset),
929 (int)BTOBB(mp->m_dirblksize)); 929 (int)BTOBB(mp->m_dirblksize), NULL);
930 mip->ra_current = i; 930 mip->ra_current = i;
931 } 931 }
932 932
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index bf27fcca4843..e95f800333d4 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -439,7 +439,7 @@ xfs_qm_dqtobp(
439 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, 439 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
440 dqp->q_blkno, 440 dqp->q_blkno,
441 mp->m_quotainfo->qi_dqchunklen, 441 mp->m_quotainfo->qi_dqchunklen,
442 0, &bp); 442 0, &bp, NULL);
443 if (error || !bp) 443 if (error || !bp)
444 return XFS_ERROR(error); 444 return XFS_ERROR(error);
445 } 445 }
@@ -920,7 +920,7 @@ xfs_qm_dqflush(
920 * Get the buffer containing the on-disk dquot 920 * Get the buffer containing the on-disk dquot
921 */ 921 */
922 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno, 922 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno,
923 mp->m_quotainfo->qi_dqchunklen, 0, &bp); 923 mp->m_quotainfo->qi_dqchunklen, 0, &bp, NULL);
924 if (error) 924 if (error)
925 goto out_unlock; 925 goto out_unlock;
926 926
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index bd9cb7f0b073..5440768ec41c 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -168,7 +168,7 @@ xfs_growfs_data_private(
168 dpct = pct - mp->m_sb.sb_imax_pct; 168 dpct = pct - mp->m_sb.sb_imax_pct;
169 bp = xfs_buf_read_uncached(mp->m_ddev_targp, 169 bp = xfs_buf_read_uncached(mp->m_ddev_targp,
170 XFS_FSB_TO_BB(mp, nb) - XFS_FSS_TO_BB(mp, 1), 170 XFS_FSB_TO_BB(mp, nb) - XFS_FSS_TO_BB(mp, 1),
171 XFS_FSS_TO_BB(mp, 1), 0); 171 XFS_FSS_TO_BB(mp, 1), 0, NULL);
172 if (!bp) 172 if (!bp)
173 return EIO; 173 return EIO;
174 xfs_buf_relse(bp); 174 xfs_buf_relse(bp);
@@ -439,7 +439,7 @@ xfs_growfs_data_private(
439 if (agno < oagcount) { 439 if (agno < oagcount) {
440 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, 440 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,
441 XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)), 441 XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
442 XFS_FSS_TO_BB(mp, 1), 0, &bp); 442 XFS_FSS_TO_BB(mp, 1), 0, &bp, NULL);
443 } else { 443 } else {
444 bp = xfs_trans_get_buf(NULL, mp->m_ddev_targp, 444 bp = xfs_trans_get_buf(NULL, mp->m_ddev_targp,
445 XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)), 445 XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 37753e1c8537..12e3dead439d 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -1490,7 +1490,7 @@ xfs_read_agi(
1490 1490
1491 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, 1491 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
1492 XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)), 1492 XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
1493 XFS_FSS_TO_BB(mp, 1), 0, bpp); 1493 XFS_FSS_TO_BB(mp, 1), 0, bpp, NULL);
1494 if (error) 1494 if (error)
1495 return error; 1495 return error;
1496 1496
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 7449cb943efd..8d6963010489 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -408,7 +408,7 @@ xfs_imap_to_bp(
408 408
409 buf_flags |= XBF_UNMAPPED; 409 buf_flags |= XBF_UNMAPPED;
410 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap->im_blkno, 410 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap->im_blkno,
411 (int)imap->im_len, buf_flags, &bp); 411 (int)imap->im_len, buf_flags, &bp, NULL);
412 if (error) { 412 if (error) {
413 if (error != EAGAIN) { 413 if (error != EAGAIN) {
414 xfs_warn(mp, 414 xfs_warn(mp,
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 46b6986e39b0..1d6d2ee08495 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1129,8 +1129,7 @@ xlog_iodone(xfs_buf_t *bp)
1129 * with it being freed after writing the unmount record to the 1129 * with it being freed after writing the unmount record to the
1130 * log. 1130 * log.
1131 */ 1131 */
1132 1132}
1133} /* xlog_iodone */
1134 1133
1135/* 1134/*
1136 * Return size of each in-core log record buffer. 1135 * Return size of each in-core log record buffer.
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 3e06333d4bd1..eb1e29ff0c7c 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2144,7 +2144,7 @@ xlog_recover_buffer_pass2(
2144 buf_flags |= XBF_UNMAPPED; 2144 buf_flags |= XBF_UNMAPPED;
2145 2145
2146 bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len, 2146 bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len,
2147 buf_flags); 2147 buf_flags, NULL);
2148 if (!bp) 2148 if (!bp)
2149 return XFS_ERROR(ENOMEM); 2149 return XFS_ERROR(ENOMEM);
2150 error = bp->b_error; 2150 error = bp->b_error;
@@ -2237,7 +2237,8 @@ xlog_recover_inode_pass2(
2237 } 2237 }
2238 trace_xfs_log_recover_inode_recover(log, in_f); 2238 trace_xfs_log_recover_inode_recover(log, in_f);
2239 2239
2240 bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len, 0); 2240 bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len, 0,
2241 NULL);
2241 if (!bp) { 2242 if (!bp) {
2242 error = ENOMEM; 2243 error = ENOMEM;
2243 goto error; 2244 goto error;
@@ -2548,7 +2549,8 @@ xlog_recover_dquot_pass2(
2548 ASSERT(dq_f->qlf_len == 1); 2549 ASSERT(dq_f->qlf_len == 1);
2549 2550
2550 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dq_f->qlf_blkno, 2551 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dq_f->qlf_blkno,
2551 XFS_FSB_TO_BB(mp, dq_f->qlf_len), 0, &bp); 2552 XFS_FSB_TO_BB(mp, dq_f->qlf_len), 0, &bp,
2553 NULL);
2552 if (error) 2554 if (error)
2553 return error; 2555 return error;
2554 2556
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 41ae7e1590f5..d5402b0eb6a3 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -652,7 +652,7 @@ xfs_readsb(xfs_mount_t *mp, int flags)
652 652
653reread: 653reread:
654 bp = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR, 654 bp = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR,
655 BTOBB(sector_size), 0); 655 BTOBB(sector_size), 0, NULL);
656 if (!bp) { 656 if (!bp) {
657 if (loud) 657 if (loud)
658 xfs_warn(mp, "SB buffer read failed"); 658 xfs_warn(mp, "SB buffer read failed");
@@ -1002,7 +1002,7 @@ xfs_check_sizes(xfs_mount_t *mp)
1002 } 1002 }
1003 bp = xfs_buf_read_uncached(mp->m_ddev_targp, 1003 bp = xfs_buf_read_uncached(mp->m_ddev_targp,
1004 d - XFS_FSS_TO_BB(mp, 1), 1004 d - XFS_FSS_TO_BB(mp, 1),
1005 XFS_FSS_TO_BB(mp, 1), 0); 1005 XFS_FSS_TO_BB(mp, 1), 0, NULL);
1006 if (!bp) { 1006 if (!bp) {
1007 xfs_warn(mp, "last sector read failed"); 1007 xfs_warn(mp, "last sector read failed");
1008 return EIO; 1008 return EIO;
@@ -1017,7 +1017,7 @@ xfs_check_sizes(xfs_mount_t *mp)
1017 } 1017 }
1018 bp = xfs_buf_read_uncached(mp->m_logdev_targp, 1018 bp = xfs_buf_read_uncached(mp->m_logdev_targp,
1019 d - XFS_FSB_TO_BB(mp, 1), 1019 d - XFS_FSB_TO_BB(mp, 1),
1020 XFS_FSB_TO_BB(mp, 1), 0); 1020 XFS_FSB_TO_BB(mp, 1), 0, NULL);
1021 if (!bp) { 1021 if (!bp) {
1022 xfs_warn(mp, "log device read failed"); 1022 xfs_warn(mp, "log device read failed");
1023 return EIO; 1023 return EIO;
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 48c750b0e830..688f608b3668 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -892,7 +892,7 @@ xfs_qm_dqiter_bufs(
892 while (blkcnt--) { 892 while (blkcnt--) {
893 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, 893 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,
894 XFS_FSB_TO_DADDR(mp, bno), 894 XFS_FSB_TO_DADDR(mp, bno),
895 mp->m_quotainfo->qi_dqchunklen, 0, &bp); 895 mp->m_quotainfo->qi_dqchunklen, 0, &bp, NULL);
896 if (error) 896 if (error)
897 break; 897 break;
898 898
@@ -979,7 +979,8 @@ xfs_qm_dqiterate(
979 while (rablkcnt--) { 979 while (rablkcnt--) {
980 xfs_buf_readahead(mp->m_ddev_targp, 980 xfs_buf_readahead(mp->m_ddev_targp,
981 XFS_FSB_TO_DADDR(mp, rablkno), 981 XFS_FSB_TO_DADDR(mp, rablkno),
982 mp->m_quotainfo->qi_dqchunklen); 982 mp->m_quotainfo->qi_dqchunklen,
983 NULL);
983 rablkno++; 984 rablkno++;
984 } 985 }
985 } 986 }
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index a69e0b4750a9..b271ed939d7b 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -870,7 +870,7 @@ xfs_rtbuf_get(
870 ASSERT(map.br_startblock != NULLFSBLOCK); 870 ASSERT(map.br_startblock != NULLFSBLOCK);
871 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, 871 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
872 XFS_FSB_TO_DADDR(mp, map.br_startblock), 872 XFS_FSB_TO_DADDR(mp, map.br_startblock),
873 mp->m_bsize, 0, &bp); 873 mp->m_bsize, 0, &bp, NULL);
874 if (error) 874 if (error)
875 return error; 875 return error;
876 ASSERT(!xfs_buf_geterror(bp)); 876 ASSERT(!xfs_buf_geterror(bp));
@@ -1873,7 +1873,7 @@ xfs_growfs_rt(
1873 */ 1873 */
1874 bp = xfs_buf_read_uncached(mp->m_rtdev_targp, 1874 bp = xfs_buf_read_uncached(mp->m_rtdev_targp,
1875 XFS_FSB_TO_BB(mp, nrblocks - 1), 1875 XFS_FSB_TO_BB(mp, nrblocks - 1),
1876 XFS_FSB_TO_BB(mp, 1), 0); 1876 XFS_FSB_TO_BB(mp, 1), 0, NULL);
1877 if (!bp) 1877 if (!bp)
1878 return EIO; 1878 return EIO;
1879 xfs_buf_relse(bp); 1879 xfs_buf_relse(bp);
@@ -2220,7 +2220,7 @@ xfs_rtmount_init(
2220 } 2220 }
2221 bp = xfs_buf_read_uncached(mp->m_rtdev_targp, 2221 bp = xfs_buf_read_uncached(mp->m_rtdev_targp,
2222 d - XFS_FSB_TO_BB(mp, 1), 2222 d - XFS_FSB_TO_BB(mp, 1),
2223 XFS_FSB_TO_BB(mp, 1), 0); 2223 XFS_FSB_TO_BB(mp, 1), 0, NULL);
2224 if (!bp) { 2224 if (!bp) {
2225 xfs_warn(mp, "realtime device size check failed"); 2225 xfs_warn(mp, "realtime device size check failed");
2226 return EIO; 2226 return EIO;
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index db056544cbb5..f02d40296506 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -464,10 +464,7 @@ xfs_trans_get_buf(
464 int numblks, 464 int numblks,
465 uint flags) 465 uint flags)
466{ 466{
467 struct xfs_buf_map map = { 467 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
468 .bm_bn = blkno,
469 .bm_len = numblks,
470 };
471 return xfs_trans_get_buf_map(tp, target, &map, 1, flags); 468 return xfs_trans_get_buf_map(tp, target, &map, 1, flags);
472} 469}
473 470
@@ -476,7 +473,8 @@ int xfs_trans_read_buf_map(struct xfs_mount *mp,
476 struct xfs_buftarg *target, 473 struct xfs_buftarg *target,
477 struct xfs_buf_map *map, int nmaps, 474 struct xfs_buf_map *map, int nmaps,
478 xfs_buf_flags_t flags, 475 xfs_buf_flags_t flags,
479 struct xfs_buf **bpp); 476 struct xfs_buf **bpp,
477 xfs_buf_iodone_t verify);
480 478
481static inline int 479static inline int
482xfs_trans_read_buf( 480xfs_trans_read_buf(
@@ -486,13 +484,12 @@ xfs_trans_read_buf(
486 xfs_daddr_t blkno, 484 xfs_daddr_t blkno,
487 int numblks, 485 int numblks,
488 xfs_buf_flags_t flags, 486 xfs_buf_flags_t flags,
489 struct xfs_buf **bpp) 487 struct xfs_buf **bpp,
488 xfs_buf_iodone_t verify)
490{ 489{
491 struct xfs_buf_map map = { 490 DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
492 .bm_bn = blkno, 491 return xfs_trans_read_buf_map(mp, tp, target, &map, 1,
493 .bm_len = numblks, 492 flags, bpp, verify);
494 };
495 return xfs_trans_read_buf_map(mp, tp, target, &map, 1, flags, bpp);
496} 493}
497 494
498struct xfs_buf *xfs_trans_getsb(xfs_trans_t *, struct xfs_mount *, int); 495struct xfs_buf *xfs_trans_getsb(xfs_trans_t *, struct xfs_mount *, int);
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index 6311b99c267f..977628207b45 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -257,7 +257,8 @@ xfs_trans_read_buf_map(
257 struct xfs_buf_map *map, 257 struct xfs_buf_map *map,
258 int nmaps, 258 int nmaps,
259 xfs_buf_flags_t flags, 259 xfs_buf_flags_t flags,
260 struct xfs_buf **bpp) 260 struct xfs_buf **bpp,
261 xfs_buf_iodone_t verify)
261{ 262{
262 xfs_buf_t *bp; 263 xfs_buf_t *bp;
263 xfs_buf_log_item_t *bip; 264 xfs_buf_log_item_t *bip;
@@ -265,7 +266,7 @@ xfs_trans_read_buf_map(
265 266
266 *bpp = NULL; 267 *bpp = NULL;
267 if (!tp) { 268 if (!tp) {
268 bp = xfs_buf_read_map(target, map, nmaps, flags); 269 bp = xfs_buf_read_map(target, map, nmaps, flags, verify);
269 if (!bp) 270 if (!bp)
270 return (flags & XBF_TRYLOCK) ? 271 return (flags & XBF_TRYLOCK) ?
271 EAGAIN : XFS_ERROR(ENOMEM); 272 EAGAIN : XFS_ERROR(ENOMEM);
@@ -312,7 +313,9 @@ xfs_trans_read_buf_map(
312 if (!(XFS_BUF_ISDONE(bp))) { 313 if (!(XFS_BUF_ISDONE(bp))) {
313 trace_xfs_trans_read_buf_io(bp, _RET_IP_); 314 trace_xfs_trans_read_buf_io(bp, _RET_IP_);
314 ASSERT(!XFS_BUF_ISASYNC(bp)); 315 ASSERT(!XFS_BUF_ISASYNC(bp));
316 ASSERT(bp->b_iodone == NULL);
315 XFS_BUF_READ(bp); 317 XFS_BUF_READ(bp);
318 bp->b_iodone = verify;
316 xfsbdstrat(tp->t_mountp, bp); 319 xfsbdstrat(tp->t_mountp, bp);
317 error = xfs_buf_iowait(bp); 320 error = xfs_buf_iowait(bp);
318 if (error) { 321 if (error) {
@@ -349,7 +352,7 @@ xfs_trans_read_buf_map(
349 return 0; 352 return 0;
350 } 353 }
351 354
352 bp = xfs_buf_read_map(target, map, nmaps, flags); 355 bp = xfs_buf_read_map(target, map, nmaps, flags, verify);
353 if (bp == NULL) { 356 if (bp == NULL) {
354 *bpp = NULL; 357 *bpp = NULL;
355 return (flags & XBF_TRYLOCK) ? 358 return (flags & XBF_TRYLOCK) ?
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 81c61fd17890..26880793feca 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -80,7 +80,7 @@ xfs_readlink_bmap(
80 d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock); 80 d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock);
81 byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); 81 byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
82 82
83 bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0); 83 bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0, NULL);
84 if (!bp) 84 if (!bp)
85 return XFS_ERROR(ENOMEM); 85 return XFS_ERROR(ENOMEM);
86 error = bp->b_error; 86 error = bp->b_error;