diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-04-03 01:11:29 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-04-27 14:01:06 -0400 |
commit | d75afeb3d302019527331520a2632b6614425b40 (patch) | |
tree | 181dec415cdae00398086764a6229d115114354d /fs/xfs/xfs_dir2_leaf.c | |
parent | d2e448d5fdebdcda93ed171339a3d864f65c227e (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_leaf.c')
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index 7352e41d2aaa..84f4c9cfe95a 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -279,7 +279,7 @@ xfs_dir3_leafn_write_verify( | |||
279 | __write_verify(bp, XFS_DIR2_LEAFN_MAGIC); | 279 | __write_verify(bp, XFS_DIR2_LEAFN_MAGIC); |
280 | } | 280 | } |
281 | 281 | ||
282 | static const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops = { | 282 | const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops = { |
283 | .verify_read = xfs_dir3_leaf1_read_verify, | 283 | .verify_read = xfs_dir3_leaf1_read_verify, |
284 | .verify_write = xfs_dir3_leaf1_write_verify, | 284 | .verify_write = xfs_dir3_leaf1_write_verify, |
285 | }; | 285 | }; |
@@ -297,8 +297,13 @@ xfs_dir3_leaf_read( | |||
297 | xfs_daddr_t mappedbno, | 297 | xfs_daddr_t mappedbno, |
298 | struct xfs_buf **bpp) | 298 | struct xfs_buf **bpp) |
299 | { | 299 | { |
300 | return xfs_da_read_buf(tp, dp, fbno, mappedbno, bpp, | 300 | int err; |
301 | |||
302 | err = xfs_da_read_buf(tp, dp, fbno, mappedbno, bpp, | ||
301 | XFS_DATA_FORK, &xfs_dir3_leaf1_buf_ops); | 303 | XFS_DATA_FORK, &xfs_dir3_leaf1_buf_ops); |
304 | if (!err && tp) | ||
305 | xfs_trans_buf_set_type(tp, *bpp, XFS_BLF_DIR_LEAF1_BUF); | ||
306 | return err; | ||
302 | } | 307 | } |
303 | 308 | ||
304 | int | 309 | int |
@@ -309,8 +314,13 @@ xfs_dir3_leafn_read( | |||
309 | xfs_daddr_t mappedbno, | 314 | xfs_daddr_t mappedbno, |
310 | struct xfs_buf **bpp) | 315 | struct xfs_buf **bpp) |
311 | { | 316 | { |
312 | return xfs_da_read_buf(tp, dp, fbno, mappedbno, bpp, | 317 | int err; |
318 | |||
319 | err = xfs_da_read_buf(tp, dp, fbno, mappedbno, bpp, | ||
313 | XFS_DATA_FORK, &xfs_dir3_leafn_buf_ops); | 320 | XFS_DATA_FORK, &xfs_dir3_leafn_buf_ops); |
321 | if (!err && tp) | ||
322 | xfs_trans_buf_set_type(tp, *bpp, XFS_BLF_DIR_LEAFN_BUF); | ||
323 | return err; | ||
314 | } | 324 | } |
315 | 325 | ||
316 | /* | 326 | /* |
@@ -319,6 +329,7 @@ xfs_dir3_leafn_read( | |||
319 | static void | 329 | static void |
320 | xfs_dir3_leaf_init( | 330 | xfs_dir3_leaf_init( |
321 | struct xfs_mount *mp, | 331 | struct xfs_mount *mp, |
332 | struct xfs_trans *tp, | ||
322 | struct xfs_buf *bp, | 333 | struct xfs_buf *bp, |
323 | xfs_ino_t owner, | 334 | xfs_ino_t owner, |
324 | __uint16_t type) | 335 | __uint16_t type) |
@@ -353,8 +364,11 @@ xfs_dir3_leaf_init( | |||
353 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); | 364 | ltp = xfs_dir2_leaf_tail_p(mp, leaf); |
354 | ltp->bestcount = 0; | 365 | ltp->bestcount = 0; |
355 | bp->b_ops = &xfs_dir3_leaf1_buf_ops; | 366 | bp->b_ops = &xfs_dir3_leaf1_buf_ops; |
356 | } else | 367 | xfs_trans_buf_set_type(tp, bp, XFS_BLF_DIR_LEAF1_BUF); |
368 | } else { | ||
357 | bp->b_ops = &xfs_dir3_leafn_buf_ops; | 369 | bp->b_ops = &xfs_dir3_leafn_buf_ops; |
370 | xfs_trans_buf_set_type(tp, bp, XFS_BLF_DIR_LEAFN_BUF); | ||
371 | } | ||
358 | } | 372 | } |
359 | 373 | ||
360 | int | 374 | int |
@@ -379,7 +393,7 @@ xfs_dir3_leaf_get_buf( | |||
379 | if (error) | 393 | if (error) |
380 | return error; | 394 | return error; |
381 | 395 | ||
382 | xfs_dir3_leaf_init(mp, bp, dp->i_ino, magic); | 396 | xfs_dir3_leaf_init(mp, tp, bp, dp->i_ino, magic); |
383 | xfs_dir3_leaf_log_header(tp, bp); | 397 | xfs_dir3_leaf_log_header(tp, bp); |
384 | if (magic == XFS_DIR2_LEAF1_MAGIC) | 398 | if (magic == XFS_DIR2_LEAF1_MAGIC) |
385 | xfs_dir3_leaf_log_tail(tp, bp); | 399 | xfs_dir3_leaf_log_tail(tp, bp); |
@@ -474,6 +488,7 @@ xfs_dir2_block_to_leaf( | |||
474 | * Fix up the block header, make it a data block. | 488 | * Fix up the block header, make it a data block. |
475 | */ | 489 | */ |
476 | dbp->b_ops = &xfs_dir3_data_buf_ops; | 490 | dbp->b_ops = &xfs_dir3_data_buf_ops; |
491 | xfs_trans_buf_set_type(tp, dbp, XFS_BLF_DIR_DATA_BUF); | ||
477 | if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)) | 492 | if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)) |
478 | hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC); | 493 | hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC); |
479 | else | 494 | else |
@@ -2182,6 +2197,7 @@ xfs_dir2_node_to_leaf( | |||
2182 | xfs_dir3_leaf_compact(args, &leafhdr, lbp); | 2197 | xfs_dir3_leaf_compact(args, &leafhdr, lbp); |
2183 | 2198 | ||
2184 | lbp->b_ops = &xfs_dir3_leaf1_buf_ops; | 2199 | lbp->b_ops = &xfs_dir3_leaf1_buf_ops; |
2200 | xfs_trans_buf_set_type(tp, lbp, XFS_BLF_DIR_LEAF1_BUF); | ||
2185 | leafhdr.magic = (leafhdr.magic == XFS_DIR2_LEAFN_MAGIC) | 2201 | leafhdr.magic = (leafhdr.magic == XFS_DIR2_LEAFN_MAGIC) |
2186 | ? XFS_DIR2_LEAF1_MAGIC | 2202 | ? XFS_DIR2_LEAF1_MAGIC |
2187 | : XFS_DIR3_LEAF1_MAGIC; | 2203 | : XFS_DIR3_LEAF1_MAGIC; |