diff options
author | Dave Chinner <dchinner@redhat.com> | 2012-11-12 06:54:10 -0500 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-11-15 22:34:36 -0500 |
commit | 4bb20a83a2a5ac4dcb62780c9950e47939956126 (patch) | |
tree | 2eef49464d5d58a54ab0bd0299e5054e8b657ce6 /fs/xfs/xfs_dir2_node.c | |
parent | c6319198702350a2215a8c0cacd6cc4283728a1b (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/xfs_dir2_node.c')
-rw-r--r-- | fs/xfs/xfs_dir2_node.c | 43 |
1 files changed, 20 insertions, 23 deletions
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. |