diff options
author | Dave Chinner <dchinner@redhat.com> | 2012-11-12 06:54:14 -0500 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-11-15 22:34:45 -0500 |
commit | e4813572640e27d3a5cce3f06751a9f54f77aaa5 (patch) | |
tree | f181db296dace8bac868f89a0a016f5973c18ba1 /fs/xfs/xfs_dir2_leaf.c | |
parent | 2025207ca6738a1217126ef14af9d104433f9824 (diff) |
xfs: factor out dir2 data block reading
And add a verifier callback function while there.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_leaf.c')
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index 6c1359dc9898..0fdf765c917f 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -493,14 +493,14 @@ xfs_dir2_leaf_addname( | |||
493 | hdr = dbp->b_addr; | 493 | hdr = dbp->b_addr; |
494 | bestsp[use_block] = hdr->bestfree[0].length; | 494 | bestsp[use_block] = hdr->bestfree[0].length; |
495 | grown = 1; | 495 | grown = 1; |
496 | } | 496 | } else { |
497 | /* | 497 | /* |
498 | * Already had space in some data block. | 498 | * Already had space in some data block. |
499 | * Just read that one in. | 499 | * Just read that one in. |
500 | */ | 500 | */ |
501 | else { | 501 | error = xfs_dir2_data_read(tp, dp, |
502 | error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, use_block), | 502 | xfs_dir2_db_to_da(mp, use_block), |
503 | -1, &dbp, XFS_DATA_FORK, NULL); | 503 | -1, &dbp); |
504 | if (error) { | 504 | if (error) { |
505 | xfs_trans_brelse(tp, lbp); | 505 | xfs_trans_brelse(tp, lbp); |
506 | return error; | 506 | return error; |
@@ -508,7 +508,6 @@ xfs_dir2_leaf_addname( | |||
508 | hdr = dbp->b_addr; | 508 | hdr = dbp->b_addr; |
509 | grown = 0; | 509 | grown = 0; |
510 | } | 510 | } |
511 | xfs_dir2_data_check(dp, dbp); | ||
512 | /* | 511 | /* |
513 | * Point to the biggest freespace in our data block. | 512 | * Point to the biggest freespace in our data block. |
514 | */ | 513 | */ |
@@ -891,10 +890,9 @@ xfs_dir2_leaf_readbuf( | |||
891 | * Read the directory block starting at the first mapping. | 890 | * Read the directory block starting at the first mapping. |
892 | */ | 891 | */ |
893 | mip->curdb = xfs_dir2_da_to_db(mp, map->br_startoff); | 892 | mip->curdb = xfs_dir2_da_to_db(mp, map->br_startoff); |
894 | error = xfs_da_read_buf(NULL, dp, map->br_startoff, | 893 | error = xfs_dir2_data_read(NULL, dp, map->br_startoff, |
895 | map->br_blockcount >= mp->m_dirblkfsbs ? | 894 | map->br_blockcount >= mp->m_dirblkfsbs ? |
896 | XFS_FSB_TO_DADDR(mp, map->br_startblock) : -1, | 895 | XFS_FSB_TO_DADDR(mp, map->br_startblock) : -1, &bp); |
897 | &bp, XFS_DATA_FORK, NULL); | ||
898 | 896 | ||
899 | /* | 897 | /* |
900 | * Should just skip over the data block instead of giving up. | 898 | * Should just skip over the data block instead of giving up. |
@@ -1408,14 +1406,13 @@ xfs_dir2_leaf_lookup_int( | |||
1408 | if (newdb != curdb) { | 1406 | if (newdb != curdb) { |
1409 | if (dbp) | 1407 | if (dbp) |
1410 | xfs_trans_brelse(tp, dbp); | 1408 | xfs_trans_brelse(tp, dbp); |
1411 | error = xfs_da_read_buf(tp, dp, | 1409 | error = xfs_dir2_data_read(tp, dp, |
1412 | xfs_dir2_db_to_da(mp, newdb), | 1410 | xfs_dir2_db_to_da(mp, newdb), |
1413 | -1, &dbp, XFS_DATA_FORK, NULL); | 1411 | -1, &dbp); |
1414 | if (error) { | 1412 | if (error) { |
1415 | xfs_trans_brelse(tp, lbp); | 1413 | xfs_trans_brelse(tp, lbp); |
1416 | return error; | 1414 | return error; |
1417 | } | 1415 | } |
1418 | xfs_dir2_data_check(dp, dbp); | ||
1419 | curdb = newdb; | 1416 | curdb = newdb; |
1420 | } | 1417 | } |
1421 | /* | 1418 | /* |
@@ -1450,9 +1447,9 @@ xfs_dir2_leaf_lookup_int( | |||
1450 | ASSERT(cidb != -1); | 1447 | ASSERT(cidb != -1); |
1451 | if (cidb != curdb) { | 1448 | if (cidb != curdb) { |
1452 | xfs_trans_brelse(tp, dbp); | 1449 | xfs_trans_brelse(tp, dbp); |
1453 | error = xfs_da_read_buf(tp, dp, | 1450 | error = xfs_dir2_data_read(tp, dp, |
1454 | xfs_dir2_db_to_da(mp, cidb), | 1451 | xfs_dir2_db_to_da(mp, cidb), |
1455 | -1, &dbp, XFS_DATA_FORK, NULL); | 1452 | -1, &dbp); |
1456 | if (error) { | 1453 | if (error) { |
1457 | xfs_trans_brelse(tp, lbp); | 1454 | xfs_trans_brelse(tp, lbp); |
1458 | return error; | 1455 | return error; |
@@ -1737,8 +1734,7 @@ xfs_dir2_leaf_trim_data( | |||
1737 | /* | 1734 | /* |
1738 | * Read the offending data block. We need its buffer. | 1735 | * Read the offending data block. We need its buffer. |
1739 | */ | 1736 | */ |
1740 | error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, db), -1, &dbp, | 1737 | error = xfs_dir2_data_read(tp, dp, xfs_dir2_db_to_da(mp, db), -1, &dbp); |
1741 | XFS_DATA_FORK, NULL); | ||
1742 | if (error) | 1738 | if (error) |
1743 | return error; | 1739 | return error; |
1744 | 1740 | ||