aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_block.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-04-03 01:11:22 -0400
committerBen Myers <bpm@sgi.com>2013-04-27 13:00:00 -0400
commit33363feed1614def83d0a6870051f0a7828cd61b (patch)
tree87fc721e32537e981264a1662de2c44d1d195607 /fs/xfs/xfs_dir2_block.c
parentcbc8adf89724b961c08b823d8bfb6dadbfa8733d (diff)
xfs: add CRC checking to dir2 data blocks
This addition follows the same pattern as the dir2 block CRCs. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_block.c')
-rw-r--r--fs/xfs/xfs_dir2_block.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index 79a3f1b2bc7d..7ec87c20cbd2 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -77,7 +77,7 @@ xfs_dir3_block_verify(
77 if (hdr3->magic != cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)) 77 if (hdr3->magic != cpu_to_be32(XFS_DIR2_BLOCK_MAGIC))
78 return false; 78 return false;
79 } 79 }
80 if (__xfs_dir2_data_check(NULL, bp)) 80 if (__xfs_dir3_data_check(NULL, bp))
81 return false; 81 return false;
82 return true; 82 return true;
83} 83}
@@ -553,7 +553,7 @@ xfs_dir2_block_addname(
553 xfs_dir2_data_log_header(tp, bp); 553 xfs_dir2_data_log_header(tp, bp);
554 xfs_dir2_block_log_tail(tp, bp); 554 xfs_dir2_block_log_tail(tp, bp);
555 xfs_dir2_data_log_entry(tp, bp, dep); 555 xfs_dir2_data_log_entry(tp, bp, dep);
556 xfs_dir2_data_check(dp, bp); 556 xfs_dir3_data_check(dp, bp);
557 return 0; 557 return 0;
558} 558}
559 559
@@ -596,7 +596,7 @@ xfs_dir2_block_getdents(
596 */ 596 */
597 wantoff = xfs_dir2_dataptr_to_off(mp, *offset); 597 wantoff = xfs_dir2_dataptr_to_off(mp, *offset);
598 hdr = bp->b_addr; 598 hdr = bp->b_addr;
599 xfs_dir2_data_check(dp, bp); 599 xfs_dir3_data_check(dp, bp);
600 /* 600 /*
601 * Set up values for the loop. 601 * Set up values for the loop.
602 */ 602 */
@@ -720,7 +720,7 @@ xfs_dir2_block_lookup(
720 dp = args->dp; 720 dp = args->dp;
721 mp = dp->i_mount; 721 mp = dp->i_mount;
722 hdr = bp->b_addr; 722 hdr = bp->b_addr;
723 xfs_dir2_data_check(dp, bp); 723 xfs_dir3_data_check(dp, bp);
724 btp = xfs_dir2_block_tail_p(mp, hdr); 724 btp = xfs_dir2_block_tail_p(mp, hdr);
725 blp = xfs_dir2_block_leaf_p(btp); 725 blp = xfs_dir2_block_leaf_p(btp);
726 /* 726 /*
@@ -771,7 +771,7 @@ xfs_dir2_block_lookup_int(
771 return error; 771 return error;
772 772
773 hdr = bp->b_addr; 773 hdr = bp->b_addr;
774 xfs_dir2_data_check(dp, bp); 774 xfs_dir3_data_check(dp, bp);
775 btp = xfs_dir2_block_tail_p(mp, hdr); 775 btp = xfs_dir2_block_tail_p(mp, hdr);
776 blp = xfs_dir2_block_leaf_p(btp); 776 blp = xfs_dir2_block_leaf_p(btp);
777 /* 777 /*
@@ -908,7 +908,7 @@ xfs_dir2_block_removename(
908 xfs_dir2_data_freescan(mp, hdr, &needlog); 908 xfs_dir2_data_freescan(mp, hdr, &needlog);
909 if (needlog) 909 if (needlog)
910 xfs_dir2_data_log_header(tp, bp); 910 xfs_dir2_data_log_header(tp, bp);
911 xfs_dir2_data_check(dp, bp); 911 xfs_dir3_data_check(dp, bp);
912 /* 912 /*
913 * See if the size as a shortform is good enough. 913 * See if the size as a shortform is good enough.
914 */ 914 */
@@ -965,7 +965,7 @@ xfs_dir2_block_replace(
965 */ 965 */
966 dep->inumber = cpu_to_be64(args->inumber); 966 dep->inumber = cpu_to_be64(args->inumber);
967 xfs_dir2_data_log_entry(args->trans, bp, dep); 967 xfs_dir2_data_log_entry(args->trans, bp, dep);
968 xfs_dir2_data_check(dp, bp); 968 xfs_dir3_data_check(dp, bp);
969 return 0; 969 return 0;
970} 970}
971 971
@@ -1046,12 +1046,14 @@ xfs_dir2_leaf_to_block(
1046 * Read the data block if we don't already have it, give up if it fails. 1046 * Read the data block if we don't already have it, give up if it fails.
1047 */ 1047 */
1048 if (!dbp) { 1048 if (!dbp) {
1049 error = xfs_dir2_data_read(tp, dp, mp->m_dirdatablk, -1, &dbp); 1049 error = xfs_dir3_data_read(tp, dp, mp->m_dirdatablk, -1, &dbp);
1050 if (error) 1050 if (error)
1051 return error; 1051 return error;
1052 } 1052 }
1053 hdr = dbp->b_addr; 1053 hdr = dbp->b_addr;
1054 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC)); 1054 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
1055 hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC));
1056
1055 /* 1057 /*
1056 * Size of the "leaf" area in the block. 1058 * Size of the "leaf" area in the block.
1057 */ 1059 */
@@ -1329,6 +1331,6 @@ xfs_dir2_sf_to_block(
1329 ASSERT(needscan == 0); 1331 ASSERT(needscan == 0);
1330 xfs_dir2_block_log_leaf(tp, bp, 0, be32_to_cpu(btp->count) - 1); 1332 xfs_dir2_block_log_leaf(tp, bp, 0, be32_to_cpu(btp->count) - 1);
1331 xfs_dir2_block_log_tail(tp, bp); 1333 xfs_dir2_block_log_tail(tp, bp);
1332 xfs_dir2_data_check(dp, bp); 1334 xfs_dir3_data_check(dp, bp);
1333 return 0; 1335 return 0;
1334} 1336}