@@ -438,15 +438,6 @@ xfs_bmap_update_cancel_item(
438438 kmem_cache_free (xfs_bmap_intent_cache , bi );
439439}
440440
441- const struct xfs_defer_op_type xfs_bmap_update_defer_type = {
442- .max_items = XFS_BUI_MAX_FAST_EXTENTS ,
443- .create_intent = xfs_bmap_update_create_intent ,
444- .abort_intent = xfs_bmap_update_abort_intent ,
445- .create_done = xfs_bmap_update_create_done ,
446- .finish_item = xfs_bmap_update_finish_item ,
447- .cancel_item = xfs_bmap_update_cancel_item ,
448- };
449-
450441/* Is this recovered BUI ok? */
451442static inline bool
452443xfs_bui_validate (
@@ -485,9 +476,15 @@ static inline struct xfs_bmap_intent *
485476xfs_bui_recover_work (
486477 struct xfs_mount * mp ,
487478 struct xfs_defer_pending * dfp ,
479+ struct xfs_inode * * ipp ,
488480 struct xfs_map_extent * map )
489481{
490482 struct xfs_bmap_intent * bi ;
483+ int error ;
484+
485+ error = xlog_recover_iget (mp , map -> me_owner , ipp );
486+ if (error )
487+ return ERR_PTR (error );
491488
492489 bi = kmem_cache_zalloc (xfs_bmap_intent_cache , GFP_NOFS | __GFP_NOFAIL );
493490 bi -> bi_whichfork = (map -> me_flags & XFS_BMAP_EXTENT_ATTR_FORK ) ?
@@ -498,6 +495,7 @@ xfs_bui_recover_work(
498495 bi -> bi_bmap .br_blockcount = map -> me_len ;
499496 bi -> bi_bmap .br_state = (map -> me_flags & XFS_BMAP_EXTENT_UNWRITTEN ) ?
500497 XFS_EXT_UNWRITTEN : XFS_EXT_NORM ;
498+ bi -> bi_owner = * ipp ;
501499 xfs_bmap_update_get_group (mp , bi );
502500
503501 xfs_defer_add_item (dfp , & bi -> bi_list );
@@ -509,7 +507,7 @@ xfs_bui_recover_work(
509507 * We need to update some inode's bmbt.
510508 */
511509STATIC int
512- xfs_bui_item_recover (
510+ xfs_bmap_recover_work (
513511 struct xfs_defer_pending * dfp ,
514512 struct list_head * capture_list )
515513{
@@ -531,11 +529,9 @@ xfs_bui_item_recover(
531529 }
532530
533531 map = & buip -> bui_format .bui_extents [0 ];
534- work = xfs_bui_recover_work (mp , dfp , map );
535-
536- error = xlog_recover_iget (mp , map -> me_owner , & ip );
537- if (error )
538- return error ;
532+ work = xfs_bui_recover_work (mp , dfp , & ip , map );
533+ if (IS_ERR (work ))
534+ return PTR_ERR (work );
539535
540536 /* Allocate transaction and do the work. */
541537 resv = xlog_recover_resv (& M_RES (mp )-> tr_itruncate );
@@ -558,8 +554,6 @@ xfs_bui_item_recover(
558554 if (error )
559555 goto err_cancel ;
560556
561- work -> bi_owner = ip ;
562-
563557 error = xlog_recover_finish_intent (tp , dfp );
564558 if (error == - EFSCORRUPTED )
565559 XFS_CORRUPTION_ERROR (__func__ , XFS_ERRLEVEL_LOW , mp ,
@@ -588,6 +582,16 @@ xfs_bui_item_recover(
588582 return error ;
589583}
590584
585+ const struct xfs_defer_op_type xfs_bmap_update_defer_type = {
586+ .max_items = XFS_BUI_MAX_FAST_EXTENTS ,
587+ .create_intent = xfs_bmap_update_create_intent ,
588+ .abort_intent = xfs_bmap_update_abort_intent ,
589+ .create_done = xfs_bmap_update_create_done ,
590+ .finish_item = xfs_bmap_update_finish_item ,
591+ .cancel_item = xfs_bmap_update_cancel_item ,
592+ .recover_work = xfs_bmap_recover_work ,
593+ };
594+
591595STATIC bool
592596xfs_bui_item_match (
593597 struct xfs_log_item * lip ,
@@ -628,7 +632,6 @@ static const struct xfs_item_ops xfs_bui_item_ops = {
628632 .iop_format = xfs_bui_item_format ,
629633 .iop_unpin = xfs_bui_item_unpin ,
630634 .iop_release = xfs_bui_item_release ,
631- .iop_recover = xfs_bui_item_recover ,
632635 .iop_match = xfs_bui_item_match ,
633636 .iop_relog = xfs_bui_item_relog ,
634637};
0 commit comments