aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_item.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_bmap_item.c')
-rw-r--r--fs/xfs/xfs_bmap_item.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
index dd136f7275e4..e5fb008d75e8 100644
--- a/fs/xfs/xfs_bmap_item.c
+++ b/fs/xfs/xfs_bmap_item.c
@@ -389,7 +389,8 @@ xfs_bud_init(
389int 389int
390xfs_bui_recover( 390xfs_bui_recover(
391 struct xfs_mount *mp, 391 struct xfs_mount *mp,
392 struct xfs_bui_log_item *buip) 392 struct xfs_bui_log_item *buip,
393 struct xfs_defer_ops *dfops)
393{ 394{
394 int error = 0; 395 int error = 0;
395 unsigned int bui_type; 396 unsigned int bui_type;
@@ -404,9 +405,7 @@ xfs_bui_recover(
404 xfs_exntst_t state; 405 xfs_exntst_t state;
405 struct xfs_trans *tp; 406 struct xfs_trans *tp;
406 struct xfs_inode *ip = NULL; 407 struct xfs_inode *ip = NULL;
407 struct xfs_defer_ops dfops;
408 struct xfs_bmbt_irec irec; 408 struct xfs_bmbt_irec irec;
409 xfs_fsblock_t firstfsb;
410 409
411 ASSERT(!test_bit(XFS_BUI_RECOVERED, &buip->bui_flags)); 410 ASSERT(!test_bit(XFS_BUI_RECOVERED, &buip->bui_flags));
412 411
@@ -464,7 +463,6 @@ xfs_bui_recover(
464 463
465 if (VFS_I(ip)->i_nlink == 0) 464 if (VFS_I(ip)->i_nlink == 0)
466 xfs_iflags_set(ip, XFS_IRECOVERY); 465 xfs_iflags_set(ip, XFS_IRECOVERY);
467 xfs_defer_init(&dfops, &firstfsb);
468 466
469 /* Process deferred bmap item. */ 467 /* Process deferred bmap item. */
470 state = (bmap->me_flags & XFS_BMAP_EXTENT_UNWRITTEN) ? 468 state = (bmap->me_flags & XFS_BMAP_EXTENT_UNWRITTEN) ?
@@ -479,16 +477,16 @@ xfs_bui_recover(
479 break; 477 break;
480 default: 478 default:
481 error = -EFSCORRUPTED; 479 error = -EFSCORRUPTED;
482 goto err_dfops; 480 goto err_inode;
483 } 481 }
484 xfs_trans_ijoin(tp, ip, 0); 482 xfs_trans_ijoin(tp, ip, 0);
485 483
486 count = bmap->me_len; 484 count = bmap->me_len;
487 error = xfs_trans_log_finish_bmap_update(tp, budp, &dfops, type, 485 error = xfs_trans_log_finish_bmap_update(tp, budp, dfops, type,
488 ip, whichfork, bmap->me_startoff, 486 ip, whichfork, bmap->me_startoff,
489 bmap->me_startblock, &count, state); 487 bmap->me_startblock, &count, state);
490 if (error) 488 if (error)
491 goto err_dfops; 489 goto err_inode;
492 490
493 if (count > 0) { 491 if (count > 0) {
494 ASSERT(type == XFS_BMAP_UNMAP); 492 ASSERT(type == XFS_BMAP_UNMAP);
@@ -496,16 +494,11 @@ xfs_bui_recover(
496 irec.br_blockcount = count; 494 irec.br_blockcount = count;
497 irec.br_startoff = bmap->me_startoff; 495 irec.br_startoff = bmap->me_startoff;
498 irec.br_state = state; 496 irec.br_state = state;
499 error = xfs_bmap_unmap_extent(tp->t_mountp, &dfops, ip, &irec); 497 error = xfs_bmap_unmap_extent(tp->t_mountp, dfops, ip, &irec);
500 if (error) 498 if (error)
501 goto err_dfops; 499 goto err_inode;
502 } 500 }
503 501
504 /* Finish transaction, free inodes. */
505 error = xfs_defer_finish(&tp, &dfops);
506 if (error)
507 goto err_dfops;
508
509 set_bit(XFS_BUI_RECOVERED, &buip->bui_flags); 502 set_bit(XFS_BUI_RECOVERED, &buip->bui_flags);
510 error = xfs_trans_commit(tp); 503 error = xfs_trans_commit(tp);
511 xfs_iunlock(ip, XFS_ILOCK_EXCL); 504 xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -513,8 +506,6 @@ xfs_bui_recover(
513 506
514 return error; 507 return error;
515 508
516err_dfops:
517 xfs_defer_cancel(&dfops);
518err_inode: 509err_inode:
519 xfs_trans_cancel(tp); 510 xfs_trans_cancel(tp);
520 if (ip) { 511 if (ip) {