aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_node.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-04-03 01:11:29 -0400
committerBen Myers <bpm@sgi.com>2013-04-27 14:01:06 -0400
commitd75afeb3d302019527331520a2632b6614425b40 (patch)
tree181dec415cdae00398086764a6229d115114354d /fs/xfs/xfs_dir2_node.c
parentd2e448d5fdebdcda93ed171339a3d864f65c227e (diff)
xfs: add buffer types to directory and attribute buffers
Add buffer types to the buffer log items so that log recovery can validate the buffers and calculate CRCs correctly after the buffers are recovered. 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_node.c')
-rw-r--r--fs/xfs/xfs_dir2_node.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index 122449b33f5e..1806a22d5593 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -147,7 +147,7 @@ xfs_dir3_free_write_verify(
147 xfs_update_cksum(bp->b_addr, BBTOB(bp->b_length), XFS_DIR3_FREE_CRC_OFF); 147 xfs_update_cksum(bp->b_addr, BBTOB(bp->b_length), XFS_DIR3_FREE_CRC_OFF);
148} 148}
149 149
150static const struct xfs_buf_ops xfs_dir3_free_buf_ops = { 150const struct xfs_buf_ops xfs_dir3_free_buf_ops = {
151 .verify_read = xfs_dir3_free_read_verify, 151 .verify_read = xfs_dir3_free_read_verify,
152 .verify_write = xfs_dir3_free_write_verify, 152 .verify_write = xfs_dir3_free_write_verify,
153}; 153};
@@ -161,8 +161,15 @@ __xfs_dir3_free_read(
161 xfs_daddr_t mappedbno, 161 xfs_daddr_t mappedbno,
162 struct xfs_buf **bpp) 162 struct xfs_buf **bpp)
163{ 163{
164 return xfs_da_read_buf(tp, dp, fbno, mappedbno, bpp, 164 int err;
165
166 err = xfs_da_read_buf(tp, dp, fbno, mappedbno, bpp,
165 XFS_DATA_FORK, &xfs_dir3_free_buf_ops); 167 XFS_DATA_FORK, &xfs_dir3_free_buf_ops);
168
169 /* try read returns without an error or *bpp if it lands in a hole */
170 if (!err && tp && *bpp)
171 xfs_trans_buf_set_type(tp, *bpp, XFS_BLF_DIR_FREE_BUF);
172 return err;
166} 173}
167 174
168int 175int
@@ -249,6 +256,7 @@ xfs_dir3_free_get_buf(
249 if (error) 256 if (error)
250 return error; 257 return error;
251 258
259 xfs_trans_buf_set_type(tp, bp, XFS_BLF_DIR_FREE_BUF);
252 bp->b_ops = &xfs_dir3_free_buf_ops; 260 bp->b_ops = &xfs_dir3_free_buf_ops;
253 261
254 /* 262 /*
@@ -396,6 +404,7 @@ xfs_dir2_leaf_to_node(
396 else 404 else
397 leaf->hdr.info.magic = cpu_to_be16(XFS_DIR3_LEAFN_MAGIC); 405 leaf->hdr.info.magic = cpu_to_be16(XFS_DIR3_LEAFN_MAGIC);
398 lbp->b_ops = &xfs_dir3_leafn_buf_ops; 406 lbp->b_ops = &xfs_dir3_leafn_buf_ops;
407 xfs_trans_buf_set_type(tp, lbp, XFS_BLF_DIR_LEAFN_BUF);
399 xfs_dir3_leaf_log_header(tp, lbp); 408 xfs_dir3_leaf_log_header(tp, lbp);
400 xfs_dir3_leaf_check(mp, lbp); 409 xfs_dir3_leaf_check(mp, lbp);
401 return 0; 410 return 0;
@@ -811,6 +820,7 @@ xfs_dir2_leafn_lookup_for_entry(
811 (char *)curbp->b_addr); 820 (char *)curbp->b_addr);
812 state->extrablk.magic = XFS_DIR2_DATA_MAGIC; 821 state->extrablk.magic = XFS_DIR2_DATA_MAGIC;
813 curbp->b_ops = &xfs_dir3_data_buf_ops; 822 curbp->b_ops = &xfs_dir3_data_buf_ops;
823 xfs_trans_buf_set_type(tp, curbp, XFS_BLF_DIR_DATA_BUF);
814 if (cmp == XFS_CMP_EXACT) 824 if (cmp == XFS_CMP_EXACT)
815 return XFS_ERROR(EEXIST); 825 return XFS_ERROR(EEXIST);
816 } 826 }
@@ -825,6 +835,7 @@ xfs_dir2_leafn_lookup_for_entry(
825 state->extrablk.blkno = curdb; 835 state->extrablk.blkno = curdb;
826 state->extrablk.magic = XFS_DIR2_DATA_MAGIC; 836 state->extrablk.magic = XFS_DIR2_DATA_MAGIC;
827 curbp->b_ops = &xfs_dir3_data_buf_ops; 837 curbp->b_ops = &xfs_dir3_data_buf_ops;
838 xfs_trans_buf_set_type(tp, curbp, XFS_BLF_DIR_DATA_BUF);
828 } else { 839 } else {
829 /* If the curbp is not the CI match block, drop it */ 840 /* If the curbp is not the CI match block, drop it */
830 if (state->extrablk.bp != curbp) 841 if (state->extrablk.bp != curbp)