@@ -3479,28 +3479,17 @@ xfs_bmap_process_allocated_extent(
3479
3479
3480
3480
static int
3481
3481
xfs_bmap_exact_minlen_extent_alloc (
3482
- struct xfs_bmalloca * ap )
3482
+ struct xfs_bmalloca * ap ,
3483
+ struct xfs_alloc_arg * args )
3483
3484
{
3484
- struct xfs_mount * mp = ap -> ip -> i_mount ;
3485
- struct xfs_alloc_arg args = { .tp = ap -> tp , .mp = mp };
3486
- xfs_fileoff_t orig_offset ;
3487
- xfs_extlen_t orig_length ;
3488
- int error ;
3489
-
3490
- ASSERT (ap -> length );
3491
-
3492
3485
if (ap -> minlen != 1 ) {
3493
- ap -> blkno = NULLFSBLOCK ;
3494
- ap -> length = 0 ;
3486
+ args -> fsbno = NULLFSBLOCK ;
3495
3487
return 0 ;
3496
3488
}
3497
3489
3498
- orig_offset = ap -> offset ;
3499
- orig_length = ap -> length ;
3500
-
3501
- args .alloc_minlen_only = 1 ;
3502
-
3503
- xfs_bmap_compute_alignments (ap , & args );
3490
+ args -> alloc_minlen_only = 1 ;
3491
+ args -> minlen = args -> maxlen = ap -> minlen ;
3492
+ args -> total = ap -> total ;
3504
3493
3505
3494
/*
3506
3495
* Unlike the longest extent available in an AG, we don't track
@@ -3510,33 +3499,9 @@ xfs_bmap_exact_minlen_extent_alloc(
3510
3499
* we need not be concerned about a drop in performance in
3511
3500
* "debug only" code paths.
3512
3501
*/
3513
- ap -> blkno = XFS_AGB_TO_FSB (mp , 0 , 0 );
3502
+ ap -> blkno = XFS_AGB_TO_FSB (ap -> ip -> i_mount , 0 , 0 );
3514
3503
3515
- args .oinfo = XFS_RMAP_OINFO_SKIP_UPDATE ;
3516
- args .minlen = args .maxlen = ap -> minlen ;
3517
- args .total = ap -> total ;
3518
-
3519
- args .alignment = 1 ;
3520
- args .minalignslop = 0 ;
3521
-
3522
- args .minleft = ap -> minleft ;
3523
- args .wasdel = ap -> wasdel ;
3524
- args .resv = XFS_AG_RESV_NONE ;
3525
- args .datatype = ap -> datatype ;
3526
-
3527
- error = xfs_alloc_vextent_first_ag (& args , ap -> blkno );
3528
- if (error )
3529
- return error ;
3530
-
3531
- if (args .fsbno != NULLFSBLOCK ) {
3532
- xfs_bmap_process_allocated_extent (ap , & args , orig_offset ,
3533
- orig_length );
3534
- } else {
3535
- ap -> blkno = NULLFSBLOCK ;
3536
- ap -> length = 0 ;
3537
- }
3538
-
3539
- return 0 ;
3504
+ return xfs_alloc_vextent_first_ag (args , ap -> blkno );
3540
3505
}
3541
3506
3542
3507
/*
@@ -3795,8 +3760,11 @@ xfs_bmap_btalloc(
3795
3760
/* Trim the allocation back to the maximum an AG can fit. */
3796
3761
args .maxlen = min (ap -> length , mp -> m_ag_max_usable );
3797
3762
3798
- if ((ap -> datatype & XFS_ALLOC_USERDATA ) &&
3799
- xfs_inode_is_filestream (ap -> ip ))
3763
+ if (unlikely (XFS_TEST_ERROR (false, mp ,
3764
+ XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT )))
3765
+ error = xfs_bmap_exact_minlen_extent_alloc (ap , & args );
3766
+ else if ((ap -> datatype & XFS_ALLOC_USERDATA ) &&
3767
+ xfs_inode_is_filestream (ap -> ip ))
3800
3768
error = xfs_bmap_btalloc_filestreams (ap , & args , stripe_align );
3801
3769
else
3802
3770
error = xfs_bmap_btalloc_best_length (ap , & args , stripe_align );
@@ -4211,9 +4179,6 @@ xfs_bmapi_allocate(
4211
4179
if ((bma -> datatype & XFS_ALLOC_USERDATA ) &&
4212
4180
XFS_IS_REALTIME_INODE (bma -> ip ))
4213
4181
error = xfs_bmap_rtalloc (bma );
4214
- else if (unlikely (XFS_TEST_ERROR (false, mp ,
4215
- XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT )))
4216
- error = xfs_bmap_exact_minlen_extent_alloc (bma );
4217
4182
else
4218
4183
error = xfs_bmap_btalloc (bma );
4219
4184
if (error )
0 commit comments