@@ -2509,48 +2509,6 @@ xfs_agfl_reset(
2509
2509
clear_bit (XFS_AGSTATE_AGFL_NEEDS_RESET , & pag -> pag_opstate );
2510
2510
}
2511
2511
2512
- /*
2513
- * Defer an AGFL block free. This is effectively equivalent to
2514
- * xfs_free_extent_later() with some special handling particular to AGFL blocks.
2515
- *
2516
- * Deferring AGFL frees helps prevent log reservation overruns due to too many
2517
- * allocation operations in a transaction. AGFL frees are prone to this problem
2518
- * because for one they are always freed one at a time. Further, an immediate
2519
- * AGFL block free can cause a btree join and require another block free before
2520
- * the real allocation can proceed. Deferring the free disconnects freeing up
2521
- * the AGFL slot from freeing the block.
2522
- */
2523
- static int
2524
- xfs_defer_agfl_block (
2525
- struct xfs_trans * tp ,
2526
- xfs_agnumber_t agno ,
2527
- xfs_agblock_t agbno ,
2528
- struct xfs_owner_info * oinfo )
2529
- {
2530
- struct xfs_mount * mp = tp -> t_mountp ;
2531
- struct xfs_extent_free_item * xefi ;
2532
- xfs_fsblock_t fsbno = XFS_AGB_TO_FSB (mp , agno , agbno );
2533
-
2534
- ASSERT (xfs_extfree_item_cache != NULL );
2535
- ASSERT (oinfo != NULL );
2536
-
2537
- if (XFS_IS_CORRUPT (mp , !xfs_verify_fsbno (mp , fsbno )))
2538
- return - EFSCORRUPTED ;
2539
-
2540
- xefi = kmem_cache_zalloc (xfs_extfree_item_cache ,
2541
- GFP_KERNEL | __GFP_NOFAIL );
2542
- xefi -> xefi_startblock = fsbno ;
2543
- xefi -> xefi_blockcount = 1 ;
2544
- xefi -> xefi_owner = oinfo -> oi_owner ;
2545
- xefi -> xefi_agresv = XFS_AG_RESV_AGFL ;
2546
-
2547
- trace_xfs_agfl_free_defer (mp , xefi );
2548
-
2549
- xfs_extent_free_get_group (mp , xefi );
2550
- xfs_defer_add (tp , & xefi -> xefi_list , & xfs_agfl_free_defer_type );
2551
- return 0 ;
2552
- }
2553
-
2554
2512
/*
2555
2513
* Add the extent to the list of extents to be free at transaction end.
2556
2514
* The list is maintained sorted (by block number).
@@ -2571,7 +2529,6 @@ xfs_defer_extent_free(
2571
2529
ASSERT (len <= XFS_MAX_BMBT_EXTLEN );
2572
2530
ASSERT (!isnullstartblock (bno ));
2573
2531
ASSERT (!(free_flags & ~XFS_FREE_EXTENT_ALL_FLAGS ));
2574
- ASSERT (type != XFS_AG_RESV_AGFL );
2575
2532
2576
2533
if (XFS_IS_CORRUPT (mp , !xfs_verify_fsbext (mp , bno , len )))
2577
2534
return - EFSCORRUPTED ;
@@ -2598,7 +2555,13 @@ xfs_defer_extent_free(
2598
2555
trace_xfs_extent_free_defer (mp , xefi );
2599
2556
2600
2557
xfs_extent_free_get_group (mp , xefi );
2601
- * dfpp = xfs_defer_add (tp , & xefi -> xefi_list , & xfs_extent_free_defer_type );
2558
+
2559
+ if (xefi -> xefi_agresv == XFS_AG_RESV_AGFL )
2560
+ * dfpp = xfs_defer_add (tp , & xefi -> xefi_list ,
2561
+ & xfs_agfl_free_defer_type );
2562
+ else
2563
+ * dfpp = xfs_defer_add (tp , & xefi -> xefi_list ,
2564
+ & xfs_extent_free_defer_type );
2602
2565
return 0 ;
2603
2566
}
2604
2567
@@ -2856,8 +2819,21 @@ xfs_alloc_fix_freelist(
2856
2819
if (error )
2857
2820
goto out_agbp_relse ;
2858
2821
2859
- /* defer agfl frees */
2860
- error = xfs_defer_agfl_block (tp , args -> agno , bno , & targs .oinfo );
2822
+ /*
2823
+ * Defer the AGFL block free.
2824
+ *
2825
+ * This helps to prevent log reservation overruns due to too
2826
+ * many allocation operations in a transaction. AGFL frees are
2827
+ * prone to this problem because for one they are always freed
2828
+ * one at a time. Further, an immediate AGFL block free can
2829
+ * cause a btree join and require another block free before the
2830
+ * real allocation can proceed.
2831
+ * Deferring the free disconnects freeing up the AGFL slot from
2832
+ * freeing the block.
2833
+ */
2834
+ error = xfs_free_extent_later (tp ,
2835
+ XFS_AGB_TO_FSB (mp , args -> agno , bno ), 1 ,
2836
+ & targs .oinfo , XFS_AG_RESV_AGFL , 0 );
2861
2837
if (error )
2862
2838
goto out_agbp_relse ;
2863
2839
}
0 commit comments