@@ -437,15 +437,6 @@ xfs_bmap_update_cancel_item(
437437 kmem_cache_free (xfs_bmap_intent_cache , bi );
438438}
439439
440- const struct xfs_defer_op_type xfs_bmap_update_defer_type = {
441- .max_items = XFS_BUI_MAX_FAST_EXTENTS ,
442- .create_intent = xfs_bmap_update_create_intent ,
443- .abort_intent = xfs_bmap_update_abort_intent ,
444- .create_done = xfs_bmap_update_create_done ,
445- .finish_item = xfs_bmap_update_finish_item ,
446- .cancel_item = xfs_bmap_update_cancel_item ,
447- };
448-
449440/* Is this recovered BUI ok? */
450441static inline bool
451442xfs_bui_validate (
@@ -484,9 +475,15 @@ static inline struct xfs_bmap_intent *
484475xfs_bui_recover_work (
485476 struct xfs_mount * mp ,
486477 struct xfs_defer_pending * dfp ,
478+ struct xfs_inode * * ipp ,
487479 struct xfs_map_extent * map )
488480{
489481 struct xfs_bmap_intent * bi ;
482+ int error ;
483+
484+ error = xlog_recover_iget (mp , map -> me_owner , ipp );
485+ if (error )
486+ return ERR_PTR (error );
490487
491488 bi = kmem_cache_zalloc (xfs_bmap_intent_cache , GFP_NOFS | __GFP_NOFAIL );
492489 bi -> bi_whichfork = (map -> me_flags & XFS_BMAP_EXTENT_ATTR_FORK ) ?
@@ -497,6 +494,7 @@ xfs_bui_recover_work(
497494 bi -> bi_bmap .br_blockcount = map -> me_len ;
498495 bi -> bi_bmap .br_state = (map -> me_flags & XFS_BMAP_EXTENT_UNWRITTEN ) ?
499496 XFS_EXT_UNWRITTEN : XFS_EXT_NORM ;
497+ bi -> bi_owner = * ipp ;
500498 xfs_bmap_update_get_group (mp , bi );
501499
502500 xfs_defer_add_item (dfp , & bi -> bi_list );
@@ -508,7 +506,7 @@ xfs_bui_recover_work(
508506 * We need to update some inode's bmbt.
509507 */
510508STATIC int
511- xfs_bui_item_recover (
509+ xfs_bmap_recover_work (
512510 struct xfs_defer_pending * dfp ,
513511 struct list_head * capture_list )
514512{
@@ -530,11 +528,9 @@ xfs_bui_item_recover(
530528 }
531529
532530 map = & buip -> bui_format .bui_extents [0 ];
533- work = xfs_bui_recover_work (mp , dfp , map );
534-
535- error = xlog_recover_iget (mp , map -> me_owner , & ip );
536- if (error )
537- return error ;
531+ work = xfs_bui_recover_work (mp , dfp , & ip , map );
532+ if (IS_ERR (work ))
533+ return PTR_ERR (work );
538534
539535 /* Allocate transaction and do the work. */
540536 resv = xlog_recover_resv (& M_RES (mp )-> tr_itruncate );
@@ -557,8 +553,6 @@ xfs_bui_item_recover(
557553 if (error )
558554 goto err_cancel ;
559555
560- work -> bi_owner = ip ;
561-
562556 error = xlog_recover_finish_intent (tp , dfp );
563557 if (error == - EFSCORRUPTED )
564558 XFS_CORRUPTION_ERROR (__func__ , XFS_ERRLEVEL_LOW , mp ,
@@ -587,6 +581,16 @@ xfs_bui_item_recover(
587581 return error ;
588582}
589583
584+ const struct xfs_defer_op_type xfs_bmap_update_defer_type = {
585+ .max_items = XFS_BUI_MAX_FAST_EXTENTS ,
586+ .create_intent = xfs_bmap_update_create_intent ,
587+ .abort_intent = xfs_bmap_update_abort_intent ,
588+ .create_done = xfs_bmap_update_create_done ,
589+ .finish_item = xfs_bmap_update_finish_item ,
590+ .cancel_item = xfs_bmap_update_cancel_item ,
591+ .recover_work = xfs_bmap_recover_work ,
592+ };
593+
590594STATIC bool
591595xfs_bui_item_match (
592596 struct xfs_log_item * lip ,
@@ -627,7 +631,6 @@ static const struct xfs_item_ops xfs_bui_item_ops = {
627631 .iop_format = xfs_bui_item_format ,
628632 .iop_unpin = xfs_bui_item_unpin ,
629633 .iop_release = xfs_bui_item_release ,
630- .iop_recover = xfs_bui_item_recover ,
631634 .iop_match = xfs_bui_item_match ,
632635 .iop_relog = xfs_bui_item_relog ,
633636};
0 commit comments