aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-11-12 06:54:10 -0500
committerBen Myers <bpm@sgi.com>2012-11-15 22:34:36 -0500
commit4bb20a83a2a5ac4dcb62780c9950e47939956126 (patch)
tree2eef49464d5d58a54ab0bd0299e5054e8b657ce6 /fs/xfs
parentc6319198702350a2215a8c0cacd6cc4283728a1b (diff)
xfs: add verifier callback to directory read code
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_attr.c23
-rw-r--r--fs/xfs/xfs_attr_leaf.c18
-rw-r--r--fs/xfs/xfs_da_btree.c44
-rw-r--r--fs/xfs/xfs_da_btree.h7
-rw-r--r--fs/xfs/xfs_dir2_block.c23
-rw-r--r--fs/xfs/xfs_dir2_leaf.c33
-rw-r--r--fs/xfs/xfs_dir2_node.c43
-rw-r--r--fs/xfs/xfs_file.c2
8 files changed, 102 insertions, 91 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index 474c57a43cce..cd5a9cd0ded0 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -904,7 +904,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
904 dp = args->dp; 904 dp = args->dp;
905 args->blkno = 0; 905 args->blkno = 0;
906 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp, 906 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp,
907 XFS_ATTR_FORK); 907 XFS_ATTR_FORK, NULL);
908 if (error) 908 if (error)
909 return(error); 909 return(error);
910 ASSERT(bp != NULL); 910 ASSERT(bp != NULL);
@@ -1032,7 +1032,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
1032 * remove the "old" attr from that block (neat, huh!) 1032 * remove the "old" attr from that block (neat, huh!)
1033 */ 1033 */
1034 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, 1034 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1,
1035 &bp, XFS_ATTR_FORK); 1035 &bp, XFS_ATTR_FORK, NULL);
1036 if (error) 1036 if (error)
1037 return(error); 1037 return(error);
1038 ASSERT(bp != NULL); 1038 ASSERT(bp != NULL);
@@ -1101,7 +1101,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
1101 dp = args->dp; 1101 dp = args->dp;
1102 args->blkno = 0; 1102 args->blkno = 0;
1103 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp, 1103 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp,
1104 XFS_ATTR_FORK); 1104 XFS_ATTR_FORK, NULL);
1105 if (error) { 1105 if (error) {
1106 return(error); 1106 return(error);
1107 } 1107 }
@@ -1159,7 +1159,7 @@ xfs_attr_leaf_get(xfs_da_args_t *args)
1159 1159
1160 args->blkno = 0; 1160 args->blkno = 0;
1161 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp, 1161 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp,
1162 XFS_ATTR_FORK); 1162 XFS_ATTR_FORK, NULL);
1163 if (error) 1163 if (error)
1164 return(error); 1164 return(error);
1165 ASSERT(bp != NULL); 1165 ASSERT(bp != NULL);
@@ -1190,7 +1190,8 @@ xfs_attr_leaf_list(xfs_attr_list_context_t *context)
1190 trace_xfs_attr_leaf_list(context); 1190 trace_xfs_attr_leaf_list(context);
1191 1191
1192 context->cursor->blkno = 0; 1192 context->cursor->blkno = 0;
1193 error = xfs_da_read_buf(NULL, context->dp, 0, -1, &bp, XFS_ATTR_FORK); 1193 error = xfs_da_read_buf(NULL, context->dp, 0, -1, &bp, XFS_ATTR_FORK,
1194 NULL);
1194 if (error) 1195 if (error)
1195 return XFS_ERROR(error); 1196 return XFS_ERROR(error);
1196 ASSERT(bp != NULL); 1197 ASSERT(bp != NULL);
@@ -1605,7 +1606,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
1605 state->path.blk[0].bp = NULL; 1606 state->path.blk[0].bp = NULL;
1606 1607
1607 error = xfs_da_read_buf(args->trans, args->dp, 0, -1, &bp, 1608 error = xfs_da_read_buf(args->trans, args->dp, 0, -1, &bp,
1608 XFS_ATTR_FORK); 1609 XFS_ATTR_FORK, NULL);
1609 if (error) 1610 if (error)
1610 goto out; 1611 goto out;
1611 ASSERT((((xfs_attr_leafblock_t *)bp->b_addr)->hdr.info.magic) == 1612 ASSERT((((xfs_attr_leafblock_t *)bp->b_addr)->hdr.info.magic) ==
@@ -1718,7 +1719,7 @@ xfs_attr_refillstate(xfs_da_state_t *state)
1718 error = xfs_da_read_buf(state->args->trans, 1719 error = xfs_da_read_buf(state->args->trans,
1719 state->args->dp, 1720 state->args->dp,
1720 blk->blkno, blk->disk_blkno, 1721 blk->blkno, blk->disk_blkno,
1721 &blk->bp, XFS_ATTR_FORK); 1722 &blk->bp, XFS_ATTR_FORK, NULL);
1722 if (error) 1723 if (error)
1723 return(error); 1724 return(error);
1724 } else { 1725 } else {
@@ -1737,7 +1738,7 @@ xfs_attr_refillstate(xfs_da_state_t *state)
1737 error = xfs_da_read_buf(state->args->trans, 1738 error = xfs_da_read_buf(state->args->trans,
1738 state->args->dp, 1739 state->args->dp,
1739 blk->blkno, blk->disk_blkno, 1740 blk->blkno, blk->disk_blkno,
1740 &blk->bp, XFS_ATTR_FORK); 1741 &blk->bp, XFS_ATTR_FORK, NULL);
1741 if (error) 1742 if (error)
1742 return(error); 1743 return(error);
1743 } else { 1744 } else {
@@ -1827,7 +1828,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
1827 bp = NULL; 1828 bp = NULL;
1828 if (cursor->blkno > 0) { 1829 if (cursor->blkno > 0) {
1829 error = xfs_da_read_buf(NULL, context->dp, cursor->blkno, -1, 1830 error = xfs_da_read_buf(NULL, context->dp, cursor->blkno, -1,
1830 &bp, XFS_ATTR_FORK); 1831 &bp, XFS_ATTR_FORK, NULL);
1831 if ((error != 0) && (error != EFSCORRUPTED)) 1832 if ((error != 0) && (error != EFSCORRUPTED))
1832 return(error); 1833 return(error);
1833 if (bp) { 1834 if (bp) {
@@ -1870,7 +1871,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
1870 for (;;) { 1871 for (;;) {
1871 error = xfs_da_read_buf(NULL, context->dp, 1872 error = xfs_da_read_buf(NULL, context->dp,
1872 cursor->blkno, -1, &bp, 1873 cursor->blkno, -1, &bp,
1873 XFS_ATTR_FORK); 1874 XFS_ATTR_FORK, NULL);
1874 if (error) 1875 if (error)
1875 return(error); 1876 return(error);
1876 if (unlikely(bp == NULL)) { 1877 if (unlikely(bp == NULL)) {
@@ -1937,7 +1938,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
1937 cursor->blkno = be32_to_cpu(leaf->hdr.info.forw); 1938 cursor->blkno = be32_to_cpu(leaf->hdr.info.forw);
1938 xfs_trans_brelse(NULL, bp); 1939 xfs_trans_brelse(NULL, bp);
1939 error = xfs_da_read_buf(NULL, context->dp, cursor->blkno, -1, 1940 error = xfs_da_read_buf(NULL, context->dp, cursor->blkno, -1,
1940 &bp, XFS_ATTR_FORK); 1941 &bp, XFS_ATTR_FORK, NULL);
1941 if (error) 1942 if (error)
1942 return(error); 1943 return(error);
1943 if (unlikely((bp == NULL))) { 1944 if (unlikely((bp == NULL))) {
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index 4bfc732bc9c9..ba2b9a2cd236 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -871,7 +871,7 @@ xfs_attr_leaf_to_node(xfs_da_args_t *args)
871 if (error) 871 if (error)
872 goto out; 872 goto out;
873 error = xfs_da_read_buf(args->trans, args->dp, 0, -1, &bp1, 873 error = xfs_da_read_buf(args->trans, args->dp, 0, -1, &bp1,
874 XFS_ATTR_FORK); 874 XFS_ATTR_FORK, NULL);
875 if (error) 875 if (error)
876 goto out; 876 goto out;
877 ASSERT(bp1 != NULL); 877 ASSERT(bp1 != NULL);
@@ -1642,7 +1642,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action)
1642 if (blkno == 0) 1642 if (blkno == 0)
1643 continue; 1643 continue;
1644 error = xfs_da_read_buf(state->args->trans, state->args->dp, 1644 error = xfs_da_read_buf(state->args->trans, state->args->dp,
1645 blkno, -1, &bp, XFS_ATTR_FORK); 1645 blkno, -1, &bp, XFS_ATTR_FORK, NULL);
1646 if (error) 1646 if (error)
1647 return(error); 1647 return(error);
1648 ASSERT(bp != NULL); 1648 ASSERT(bp != NULL);
@@ -2519,7 +2519,7 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args)
2519 * Set up the operation. 2519 * Set up the operation.
2520 */ 2520 */
2521 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp, 2521 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp,
2522 XFS_ATTR_FORK); 2522 XFS_ATTR_FORK, NULL);
2523 if (error) { 2523 if (error) {
2524 return(error); 2524 return(error);
2525 } 2525 }
@@ -2584,7 +2584,7 @@ xfs_attr_leaf_setflag(xfs_da_args_t *args)
2584 * Set up the operation. 2584 * Set up the operation.
2585 */ 2585 */
2586 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp, 2586 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp,
2587 XFS_ATTR_FORK); 2587 XFS_ATTR_FORK, NULL);
2588 if (error) { 2588 if (error) {
2589 return(error); 2589 return(error);
2590 } 2590 }
@@ -2641,7 +2641,7 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args)
2641 * Read the block containing the "old" attr 2641 * Read the block containing the "old" attr
2642 */ 2642 */
2643 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp1, 2643 error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp1,
2644 XFS_ATTR_FORK); 2644 XFS_ATTR_FORK, NULL);
2645 if (error) { 2645 if (error) {
2646 return(error); 2646 return(error);
2647 } 2647 }
@@ -2652,7 +2652,7 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args)
2652 */ 2652 */
2653 if (args->blkno2 != args->blkno) { 2653 if (args->blkno2 != args->blkno) {
2654 error = xfs_da_read_buf(args->trans, args->dp, args->blkno2, 2654 error = xfs_da_read_buf(args->trans, args->dp, args->blkno2,
2655 -1, &bp2, XFS_ATTR_FORK); 2655 -1, &bp2, XFS_ATTR_FORK, NULL);
2656 if (error) { 2656 if (error) {
2657 return(error); 2657 return(error);
2658 } 2658 }
@@ -2753,7 +2753,7 @@ xfs_attr_root_inactive(xfs_trans_t **trans, xfs_inode_t *dp)
2753 * the extents in reverse order the extent containing 2753 * the extents in reverse order the extent containing
2754 * block 0 must still be there. 2754 * block 0 must still be there.
2755 */ 2755 */
2756 error = xfs_da_read_buf(*trans, dp, 0, -1, &bp, XFS_ATTR_FORK); 2756 error = xfs_da_read_buf(*trans, dp, 0, -1, &bp, XFS_ATTR_FORK, NULL);
2757 if (error) 2757 if (error)
2758 return(error); 2758 return(error);
2759 blkno = XFS_BUF_ADDR(bp); 2759 blkno = XFS_BUF_ADDR(bp);
@@ -2839,7 +2839,7 @@ xfs_attr_node_inactive(
2839 * before we come back to this one. 2839 * before we come back to this one.
2840 */ 2840 */
2841 error = xfs_da_read_buf(*trans, dp, child_fsb, -2, &child_bp, 2841 error = xfs_da_read_buf(*trans, dp, child_fsb, -2, &child_bp,
2842 XFS_ATTR_FORK); 2842 XFS_ATTR_FORK, NULL);
2843 if (error) 2843 if (error)
2844 return(error); 2844 return(error);
2845 if (child_bp) { 2845 if (child_bp) {
@@ -2880,7 +2880,7 @@ xfs_attr_node_inactive(
2880 */ 2880 */
2881 if ((i+1) < count) { 2881 if ((i+1) < count) {
2882 error = xfs_da_read_buf(*trans, dp, 0, parent_blkno, 2882 error = xfs_da_read_buf(*trans, dp, 0, parent_blkno,
2883 &bp, XFS_ATTR_FORK); 2883 &bp, XFS_ATTR_FORK, NULL);
2884 if (error) 2884 if (error)
2885 return(error); 2885 return(error);
2886 child_fsb = be32_to_cpu(node->btree[i+1].before); 2886 child_fsb = be32_to_cpu(node->btree[i+1].before);
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 4af8bad7068c..f9e9149de009 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -747,7 +747,7 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk)
747 child = be32_to_cpu(oldroot->btree[0].before); 747 child = be32_to_cpu(oldroot->btree[0].before);
748 ASSERT(child != 0); 748 ASSERT(child != 0);
749 error = xfs_da_read_buf(args->trans, args->dp, child, -1, &bp, 749 error = xfs_da_read_buf(args->trans, args->dp, child, -1, &bp,
750 args->whichfork); 750 args->whichfork, NULL);
751 if (error) 751 if (error)
752 return(error); 752 return(error);
753 ASSERT(bp != NULL); 753 ASSERT(bp != NULL);
@@ -838,7 +838,8 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action)
838 if (blkno == 0) 838 if (blkno == 0)
839 continue; 839 continue;
840 error = xfs_da_read_buf(state->args->trans, state->args->dp, 840 error = xfs_da_read_buf(state->args->trans, state->args->dp,
841 blkno, -1, &bp, state->args->whichfork); 841 blkno, -1, &bp, state->args->whichfork,
842 NULL);
842 if (error) 843 if (error)
843 return(error); 844 return(error);
844 ASSERT(bp != NULL); 845 ASSERT(bp != NULL);
@@ -1084,7 +1085,7 @@ xfs_da_node_lookup_int(xfs_da_state_t *state, int *result)
1084 */ 1085 */
1085 blk->blkno = blkno; 1086 blk->blkno = blkno;
1086 error = xfs_da_read_buf(args->trans, args->dp, blkno, 1087 error = xfs_da_read_buf(args->trans, args->dp, blkno,
1087 -1, &blk->bp, args->whichfork); 1088 -1, &blk->bp, args->whichfork, NULL);
1088 if (error) { 1089 if (error) {
1089 blk->blkno = 0; 1090 blk->blkno = 0;
1090 state->path.active--; 1091 state->path.active--;
@@ -1247,7 +1248,7 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk,
1247 if (old_info->back) { 1248 if (old_info->back) {
1248 error = xfs_da_read_buf(args->trans, args->dp, 1249 error = xfs_da_read_buf(args->trans, args->dp,
1249 be32_to_cpu(old_info->back), 1250 be32_to_cpu(old_info->back),
1250 -1, &bp, args->whichfork); 1251 -1, &bp, args->whichfork, NULL);
1251 if (error) 1252 if (error)
1252 return(error); 1253 return(error);
1253 ASSERT(bp != NULL); 1254 ASSERT(bp != NULL);
@@ -1268,7 +1269,7 @@ xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk,
1268 if (old_info->forw) { 1269 if (old_info->forw) {
1269 error = xfs_da_read_buf(args->trans, args->dp, 1270 error = xfs_da_read_buf(args->trans, args->dp,
1270 be32_to_cpu(old_info->forw), 1271 be32_to_cpu(old_info->forw),
1271 -1, &bp, args->whichfork); 1272 -1, &bp, args->whichfork, NULL);
1272 if (error) 1273 if (error)
1273 return(error); 1274 return(error);
1274 ASSERT(bp != NULL); 1275 ASSERT(bp != NULL);
@@ -1368,7 +1369,7 @@ xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
1368 if (drop_info->back) { 1369 if (drop_info->back) {
1369 error = xfs_da_read_buf(args->trans, args->dp, 1370 error = xfs_da_read_buf(args->trans, args->dp,
1370 be32_to_cpu(drop_info->back), 1371 be32_to_cpu(drop_info->back),
1371 -1, &bp, args->whichfork); 1372 -1, &bp, args->whichfork, NULL);
1372 if (error) 1373 if (error)
1373 return(error); 1374 return(error);
1374 ASSERT(bp != NULL); 1375 ASSERT(bp != NULL);
@@ -1385,7 +1386,7 @@ xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
1385 if (drop_info->forw) { 1386 if (drop_info->forw) {
1386 error = xfs_da_read_buf(args->trans, args->dp, 1387 error = xfs_da_read_buf(args->trans, args->dp,
1387 be32_to_cpu(drop_info->forw), 1388 be32_to_cpu(drop_info->forw),
1388 -1, &bp, args->whichfork); 1389 -1, &bp, args->whichfork, NULL);
1389 if (error) 1390 if (error)
1390 return(error); 1391 return(error);
1391 ASSERT(bp != NULL); 1392 ASSERT(bp != NULL);
@@ -1470,7 +1471,7 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
1470 */ 1471 */
1471 blk->blkno = blkno; 1472 blk->blkno = blkno;
1472 error = xfs_da_read_buf(args->trans, args->dp, blkno, -1, 1473 error = xfs_da_read_buf(args->trans, args->dp, blkno, -1,
1473 &blk->bp, args->whichfork); 1474 &blk->bp, args->whichfork, NULL);
1474 if (error) 1475 if (error)
1475 return(error); 1476 return(error);
1476 ASSERT(blk->bp != NULL); 1477 ASSERT(blk->bp != NULL);
@@ -1733,7 +1734,8 @@ xfs_da_swap_lastblock(
1733 * Read the last block in the btree space. 1734 * Read the last block in the btree space.
1734 */ 1735 */
1735 last_blkno = (xfs_dablk_t)lastoff - mp->m_dirblkfsbs; 1736 last_blkno = (xfs_dablk_t)lastoff - mp->m_dirblkfsbs;
1736 if ((error = xfs_da_read_buf(tp, ip, last_blkno, -1, &last_buf, w))) 1737 error = xfs_da_read_buf(tp, ip, last_blkno, -1, &last_buf, w, NULL);
1738 if (error)
1737 return error; 1739 return error;
1738 /* 1740 /*
1739 * Copy the last block into the dead buffer and log it. 1741 * Copy the last block into the dead buffer and log it.
@@ -1759,7 +1761,9 @@ xfs_da_swap_lastblock(
1759 * If the moved block has a left sibling, fix up the pointers. 1761 * If the moved block has a left sibling, fix up the pointers.
1760 */ 1762 */
1761 if ((sib_blkno = be32_to_cpu(dead_info->back))) { 1763 if ((sib_blkno = be32_to_cpu(dead_info->back))) {
1762 if ((error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w))) 1764 error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w,
1765 NULL);
1766 if (error)
1763 goto done; 1767 goto done;
1764 sib_info = sib_buf->b_addr; 1768 sib_info = sib_buf->b_addr;
1765 if (unlikely( 1769 if (unlikely(
@@ -1780,7 +1784,9 @@ xfs_da_swap_lastblock(
1780 * If the moved block has a right sibling, fix up the pointers. 1784 * If the moved block has a right sibling, fix up the pointers.
1781 */ 1785 */
1782 if ((sib_blkno = be32_to_cpu(dead_info->forw))) { 1786 if ((sib_blkno = be32_to_cpu(dead_info->forw))) {
1783 if ((error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w))) 1787 error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w,
1788 NULL);
1789 if (error)
1784 goto done; 1790 goto done;
1785 sib_info = sib_buf->b_addr; 1791 sib_info = sib_buf->b_addr;
1786 if (unlikely( 1792 if (unlikely(
@@ -1803,7 +1809,9 @@ xfs_da_swap_lastblock(
1803 * Walk down the tree looking for the parent of the moved block. 1809 * Walk down the tree looking for the parent of the moved block.
1804 */ 1810 */
1805 for (;;) { 1811 for (;;) {
1806 if ((error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w))) 1812 error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w,
1813 NULL);
1814 if (error)
1807 goto done; 1815 goto done;
1808 par_node = par_buf->b_addr; 1816 par_node = par_buf->b_addr;
1809 if (unlikely(par_node->hdr.info.magic != 1817 if (unlikely(par_node->hdr.info.magic !=
@@ -1853,7 +1861,9 @@ xfs_da_swap_lastblock(
1853 error = XFS_ERROR(EFSCORRUPTED); 1861 error = XFS_ERROR(EFSCORRUPTED);
1854 goto done; 1862 goto done;
1855 } 1863 }
1856 if ((error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w))) 1864 error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w,
1865 NULL);
1866 if (error)
1857 goto done; 1867 goto done;
1858 par_node = par_buf->b_addr; 1868 par_node = par_buf->b_addr;
1859 if (unlikely( 1869 if (unlikely(
@@ -2139,7 +2149,8 @@ xfs_da_read_buf(
2139 xfs_dablk_t bno, 2149 xfs_dablk_t bno,
2140 xfs_daddr_t mappedbno, 2150 xfs_daddr_t mappedbno,
2141 struct xfs_buf **bpp, 2151 struct xfs_buf **bpp,
2142 int whichfork) 2152 int whichfork,
2153 xfs_buf_iodone_t verifier)
2143{ 2154{
2144 struct xfs_buf *bp; 2155 struct xfs_buf *bp;
2145 struct xfs_buf_map map; 2156 struct xfs_buf_map map;
@@ -2161,7 +2172,7 @@ xfs_da_read_buf(
2161 2172
2162 error = xfs_trans_read_buf_map(dp->i_mount, trans, 2173 error = xfs_trans_read_buf_map(dp->i_mount, trans,
2163 dp->i_mount->m_ddev_targp, 2174 dp->i_mount->m_ddev_targp,
2164 mapp, nmap, 0, &bp, NULL); 2175 mapp, nmap, 0, &bp, verifier);
2165 if (error) 2176 if (error)
2166 goto out_free; 2177 goto out_free;
2167 2178
@@ -2217,7 +2228,8 @@ xfs_da_reada_buf(
2217 struct xfs_trans *trans, 2228 struct xfs_trans *trans,
2218 struct xfs_inode *dp, 2229 struct xfs_inode *dp,
2219 xfs_dablk_t bno, 2230 xfs_dablk_t bno,
2220 int whichfork) 2231 int whichfork,
2232 xfs_buf_iodone_t verifier)
2221{ 2233{
2222 xfs_daddr_t mappedbno = -1; 2234 xfs_daddr_t mappedbno = -1;
2223 struct xfs_buf_map map; 2235 struct xfs_buf_map map;
diff --git a/fs/xfs/xfs_da_btree.h b/fs/xfs/xfs_da_btree.h
index 132adafb041e..bf8bfaa0d356 100644
--- a/fs/xfs/xfs_da_btree.h
+++ b/fs/xfs/xfs_da_btree.h
@@ -18,7 +18,6 @@
18#ifndef __XFS_DA_BTREE_H__ 18#ifndef __XFS_DA_BTREE_H__
19#define __XFS_DA_BTREE_H__ 19#define __XFS_DA_BTREE_H__
20 20
21struct xfs_buf;
22struct xfs_bmap_free; 21struct xfs_bmap_free;
23struct xfs_inode; 22struct xfs_inode;
24struct xfs_mount; 23struct xfs_mount;
@@ -226,9 +225,11 @@ int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp,
226 struct xfs_buf **bp, int whichfork); 225 struct xfs_buf **bp, int whichfork);
227int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp, 226int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp,
228 xfs_dablk_t bno, xfs_daddr_t mappedbno, 227 xfs_dablk_t bno, xfs_daddr_t mappedbno,
229 struct xfs_buf **bpp, int whichfork); 228 struct xfs_buf **bpp, int whichfork,
229 xfs_buf_iodone_t verifier);
230xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp, 230xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp,
231 xfs_dablk_t bno, int whichfork); 231 xfs_dablk_t bno, int whichfork,
232 xfs_buf_iodone_t verifier);
232int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, 233int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
233 struct xfs_buf *dead_buf); 234 struct xfs_buf *dead_buf);
234 235
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index e93ca8f054f4..53666ca6c953 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -97,10 +97,10 @@ xfs_dir2_block_addname(
97 /* 97 /*
98 * Read the (one and only) directory block into dabuf bp. 98 * Read the (one and only) directory block into dabuf bp.
99 */ 99 */
100 if ((error = 100 error = xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &bp,
101 xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &bp, XFS_DATA_FORK))) { 101 XFS_DATA_FORK, NULL);
102 if (error)
102 return error; 103 return error;
103 }
104 ASSERT(bp != NULL); 104 ASSERT(bp != NULL);
105 hdr = bp->b_addr; 105 hdr = bp->b_addr;
106 /* 106 /*
@@ -457,7 +457,7 @@ xfs_dir2_block_getdents(
457 * Can't read the block, give up, else get dabuf in bp. 457 * Can't read the block, give up, else get dabuf in bp.
458 */ 458 */
459 error = xfs_da_read_buf(NULL, dp, mp->m_dirdatablk, -1, 459 error = xfs_da_read_buf(NULL, dp, mp->m_dirdatablk, -1,
460 &bp, XFS_DATA_FORK); 460 &bp, XFS_DATA_FORK, NULL);
461 if (error) 461 if (error)
462 return error; 462 return error;
463 463
@@ -640,10 +640,10 @@ xfs_dir2_block_lookup_int(
640 /* 640 /*
641 * Read the buffer, return error if we can't get it. 641 * Read the buffer, return error if we can't get it.
642 */ 642 */
643 if ((error = 643 error = xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &bp,
644 xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &bp, XFS_DATA_FORK))) { 644 XFS_DATA_FORK, NULL);
645 if (error)
645 return error; 646 return error;
646 }
647 ASSERT(bp != NULL); 647 ASSERT(bp != NULL);
648 hdr = bp->b_addr; 648 hdr = bp->b_addr;
649 xfs_dir2_data_check(dp, bp); 649 xfs_dir2_data_check(dp, bp);
@@ -917,10 +917,11 @@ xfs_dir2_leaf_to_block(
917 /* 917 /*
918 * Read the data block if we don't already have it, give up if it fails. 918 * Read the data block if we don't already have it, give up if it fails.
919 */ 919 */
920 if (dbp == NULL && 920 if (!dbp) {
921 (error = xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &dbp, 921 error = xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &dbp,
922 XFS_DATA_FORK))) { 922 XFS_DATA_FORK, NULL);
923 return error; 923 if (error)
924 return error;
924 } 925 }
925 hdr = dbp->b_addr; 926 hdr = dbp->b_addr;
926 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC)); 927 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC));
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index bac86984e403..86e3dc1de0e7 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -315,10 +315,9 @@ xfs_dir2_leaf_addname(
315 * Read the leaf block. 315 * Read the leaf block.
316 */ 316 */
317 error = xfs_da_read_buf(tp, dp, mp->m_dirleafblk, -1, &lbp, 317 error = xfs_da_read_buf(tp, dp, mp->m_dirleafblk, -1, &lbp,
318 XFS_DATA_FORK); 318 XFS_DATA_FORK, NULL);
319 if (error) { 319 if (error)
320 return error; 320 return error;
321 }
322 ASSERT(lbp != NULL); 321 ASSERT(lbp != NULL);
323 /* 322 /*
324 * Look up the entry by hash value and name. 323 * Look up the entry by hash value and name.
@@ -500,9 +499,9 @@ xfs_dir2_leaf_addname(
500 * Just read that one in. 499 * Just read that one in.
501 */ 500 */
502 else { 501 else {
503 if ((error = 502 error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, use_block),
504 xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, use_block), 503 -1, &dbp, XFS_DATA_FORK, NULL);
505 -1, &dbp, XFS_DATA_FORK))) { 504 if (error) {
506 xfs_trans_brelse(tp, lbp); 505 xfs_trans_brelse(tp, lbp);
507 return error; 506 return error;
508 } 507 }
@@ -895,7 +894,7 @@ xfs_dir2_leaf_readbuf(
895 error = xfs_da_read_buf(NULL, dp, map->br_startoff, 894 error = xfs_da_read_buf(NULL, dp, map->br_startoff,
896 map->br_blockcount >= mp->m_dirblkfsbs ? 895 map->br_blockcount >= mp->m_dirblkfsbs ?
897 XFS_FSB_TO_DADDR(mp, map->br_startblock) : -1, 896 XFS_FSB_TO_DADDR(mp, map->br_startblock) : -1,
898 &bp, XFS_DATA_FORK); 897 &bp, XFS_DATA_FORK, NULL);
899 898
900 /* 899 /*
901 * Should just skip over the data block instead of giving up. 900 * Should just skip over the data block instead of giving up.
@@ -938,7 +937,7 @@ xfs_dir2_leaf_readbuf(
938 xfs_da_reada_buf(NULL, dp, 937 xfs_da_reada_buf(NULL, dp,
939 map[mip->ra_index].br_startoff + 938 map[mip->ra_index].br_startoff +
940 mip->ra_offset, 939 mip->ra_offset,
941 XFS_DATA_FORK); 940 XFS_DATA_FORK, NULL);
942 mip->ra_current = i; 941 mip->ra_current = i;
943 } 942 }
944 943
@@ -1376,7 +1375,7 @@ xfs_dir2_leaf_lookup_int(
1376 * Read the leaf block into the buffer. 1375 * Read the leaf block into the buffer.
1377 */ 1376 */
1378 error = xfs_da_read_buf(tp, dp, mp->m_dirleafblk, -1, &lbp, 1377 error = xfs_da_read_buf(tp, dp, mp->m_dirleafblk, -1, &lbp,
1379 XFS_DATA_FORK); 1378 XFS_DATA_FORK, NULL);
1380 if (error) 1379 if (error)
1381 return error; 1380 return error;
1382 *lbpp = lbp; 1381 *lbpp = lbp;
@@ -1411,7 +1410,7 @@ xfs_dir2_leaf_lookup_int(
1411 xfs_trans_brelse(tp, dbp); 1410 xfs_trans_brelse(tp, dbp);
1412 error = xfs_da_read_buf(tp, dp, 1411 error = xfs_da_read_buf(tp, dp,
1413 xfs_dir2_db_to_da(mp, newdb), 1412 xfs_dir2_db_to_da(mp, newdb),
1414 -1, &dbp, XFS_DATA_FORK); 1413 -1, &dbp, XFS_DATA_FORK, NULL);
1415 if (error) { 1414 if (error) {
1416 xfs_trans_brelse(tp, lbp); 1415 xfs_trans_brelse(tp, lbp);
1417 return error; 1416 return error;
@@ -1453,7 +1452,7 @@ xfs_dir2_leaf_lookup_int(
1453 xfs_trans_brelse(tp, dbp); 1452 xfs_trans_brelse(tp, dbp);
1454 error = xfs_da_read_buf(tp, dp, 1453 error = xfs_da_read_buf(tp, dp,
1455 xfs_dir2_db_to_da(mp, cidb), 1454 xfs_dir2_db_to_da(mp, cidb),
1456 -1, &dbp, XFS_DATA_FORK); 1455 -1, &dbp, XFS_DATA_FORK, NULL);
1457 if (error) { 1456 if (error) {
1458 xfs_trans_brelse(tp, lbp); 1457 xfs_trans_brelse(tp, lbp);
1459 return error; 1458 return error;
@@ -1738,10 +1737,10 @@ xfs_dir2_leaf_trim_data(
1738 /* 1737 /*
1739 * Read the offending data block. We need its buffer. 1738 * Read the offending data block. We need its buffer.
1740 */ 1739 */
1741 if ((error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, db), -1, &dbp, 1740 error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, db), -1, &dbp,
1742 XFS_DATA_FORK))) { 1741 XFS_DATA_FORK, NULL);
1742 if (error)
1743 return error; 1743 return error;
1744 }
1745 1744
1746 leaf = lbp->b_addr; 1745 leaf = lbp->b_addr;
1747 ltp = xfs_dir2_leaf_tail_p(mp, leaf); 1746 ltp = xfs_dir2_leaf_tail_p(mp, leaf);
@@ -1864,10 +1863,10 @@ xfs_dir2_node_to_leaf(
1864 /* 1863 /*
1865 * Read the freespace block. 1864 * Read the freespace block.
1866 */ 1865 */
1867 if ((error = xfs_da_read_buf(tp, dp, mp->m_dirfreeblk, -1, &fbp, 1866 error = xfs_da_read_buf(tp, dp, mp->m_dirfreeblk, -1, &fbp,
1868 XFS_DATA_FORK))) { 1867 XFS_DATA_FORK, NULL);
1868 if (error)
1869 return error; 1869 return error;
1870 }
1871 free = fbp->b_addr; 1870 free = fbp->b_addr;
1872 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); 1871 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
1873 ASSERT(!free->hdr.firstdb); 1872 ASSERT(!free->hdr.firstdb);
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index 6c7052406605..290c2b1016ab 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -399,7 +399,7 @@ xfs_dir2_leafn_lookup_for_addname(
399 */ 399 */
400 error = xfs_da_read_buf(tp, dp, 400 error = xfs_da_read_buf(tp, dp,
401 xfs_dir2_db_to_da(mp, newfdb), 401 xfs_dir2_db_to_da(mp, newfdb),
402 -1, &curbp, XFS_DATA_FORK); 402 -1, &curbp, XFS_DATA_FORK, NULL);
403 if (error) 403 if (error)
404 return error; 404 return error;
405 free = curbp->b_addr; 405 free = curbp->b_addr;
@@ -536,7 +536,7 @@ xfs_dir2_leafn_lookup_for_entry(
536 } else { 536 } else {
537 error = xfs_da_read_buf(tp, dp, 537 error = xfs_da_read_buf(tp, dp,
538 xfs_dir2_db_to_da(mp, newdb), 538 xfs_dir2_db_to_da(mp, newdb),
539 -1, &curbp, XFS_DATA_FORK); 539 -1, &curbp, XFS_DATA_FORK, NULL);
540 if (error) 540 if (error)
541 return error; 541 return error;
542 } 542 }
@@ -915,10 +915,10 @@ xfs_dir2_leafn_remove(
915 * read in the free block. 915 * read in the free block.
916 */ 916 */
917 fdb = xfs_dir2_db_to_fdb(mp, db); 917 fdb = xfs_dir2_db_to_fdb(mp, db);
918 if ((error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, fdb), 918 error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, fdb),
919 -1, &fbp, XFS_DATA_FORK))) { 919 -1, &fbp, XFS_DATA_FORK, NULL);
920 if (error)
920 return error; 921 return error;
921 }
922 free = fbp->b_addr; 922 free = fbp->b_addr;
923 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); 923 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
924 ASSERT(be32_to_cpu(free->hdr.firstdb) == 924 ASSERT(be32_to_cpu(free->hdr.firstdb) ==
@@ -1169,11 +1169,10 @@ xfs_dir2_leafn_toosmall(
1169 /* 1169 /*
1170 * Read the sibling leaf block. 1170 * Read the sibling leaf block.
1171 */ 1171 */
1172 if ((error = 1172 error = xfs_da_read_buf(state->args->trans, state->args->dp,
1173 xfs_da_read_buf(state->args->trans, state->args->dp, blkno, 1173 blkno, -1, &bp, XFS_DATA_FORK, NULL);
1174 -1, &bp, XFS_DATA_FORK))) { 1174 if (error)
1175 return error; 1175 return error;
1176 }
1177 ASSERT(bp != NULL); 1176 ASSERT(bp != NULL);
1178 /* 1177 /*
1179 * Count bytes in the two blocks combined. 1178 * Count bytes in the two blocks combined.
@@ -1454,14 +1453,13 @@ xfs_dir2_node_addname_int(
1454 * This should be really rare, so there's no reason 1453 * This should be really rare, so there's no reason
1455 * to avoid it. 1454 * to avoid it.
1456 */ 1455 */
1457 if ((error = xfs_da_read_buf(tp, dp, 1456 error = xfs_da_read_buf(tp, dp,
1458 xfs_dir2_db_to_da(mp, fbno), -2, &fbp, 1457 xfs_dir2_db_to_da(mp, fbno), -2,
1459 XFS_DATA_FORK))) { 1458 &fbp, XFS_DATA_FORK, NULL);
1459 if (error)
1460 return error; 1460 return error;
1461 } 1461 if (!fbp)
1462 if (unlikely(fbp == NULL)) {
1463 continue; 1462 continue;
1464 }
1465 free = fbp->b_addr; 1463 free = fbp->b_addr;
1466 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); 1464 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
1467 findex = 0; 1465 findex = 0;
@@ -1520,9 +1518,9 @@ xfs_dir2_node_addname_int(
1520 * that was just allocated. 1518 * that was just allocated.
1521 */ 1519 */
1522 fbno = xfs_dir2_db_to_fdb(mp, dbno); 1520 fbno = xfs_dir2_db_to_fdb(mp, dbno);
1523 if (unlikely(error = xfs_da_read_buf(tp, dp, 1521 error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, fbno), -2,
1524 xfs_dir2_db_to_da(mp, fbno), -2, &fbp, 1522 &fbp, XFS_DATA_FORK, NULL);
1525 XFS_DATA_FORK))) 1523 if (error)
1526 return error; 1524 return error;
1527 1525
1528 /* 1526 /*
@@ -1631,7 +1629,7 @@ xfs_dir2_node_addname_int(
1631 * Read the data block in. 1629 * Read the data block in.
1632 */ 1630 */
1633 error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, dbno), 1631 error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, dbno),
1634 -1, &dbp, XFS_DATA_FORK); 1632 -1, &dbp, XFS_DATA_FORK, NULL);
1635 if (error) 1633 if (error)
1636 return error; 1634 return error;
1637 hdr = dbp->b_addr; 1635 hdr = dbp->b_addr;
@@ -1917,11 +1915,10 @@ xfs_dir2_node_trim_free(
1917 /* 1915 /*
1918 * Read the freespace block. 1916 * Read the freespace block.
1919 */ 1917 */
1920 if (unlikely(error = xfs_da_read_buf(tp, dp, (xfs_dablk_t)fo, -2, &bp, 1918 error = xfs_da_read_buf(tp, dp, (xfs_dablk_t)fo, -2, &bp,
1921 XFS_DATA_FORK))) { 1919 XFS_DATA_FORK, NULL);
1920 if (error)
1922 return error; 1921 return error;
1923 }
1924
1925 /* 1922 /*
1926 * There can be holes in freespace. If fo is a hole, there's 1923 * There can be holes in freespace. If fo is a hole, there's
1927 * nothing to do. 1924 * nothing to do.
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index c42f99e71f14..f6dab7da7bcc 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -891,7 +891,7 @@ xfs_dir_open(
891 */ 891 */
892 mode = xfs_ilock_map_shared(ip); 892 mode = xfs_ilock_map_shared(ip);
893 if (ip->i_d.di_nextents > 0) 893 if (ip->i_d.di_nextents > 0)
894 xfs_da_reada_buf(NULL, ip, 0, XFS_DATA_FORK); 894 xfs_da_reada_buf(NULL, ip, 0, XFS_DATA_FORK, NULL);
895 xfs_iunlock(ip, mode); 895 xfs_iunlock(ip, mode);
896 return 0; 896 return 0;
897} 897}