@@ -3479,28 +3479,17 @@ xfs_bmap_process_allocated_extent(
34793479
34803480static int
34813481xfs_bmap_exact_minlen_extent_alloc (
3482- struct xfs_bmalloca * ap )
3482+ struct xfs_bmalloca * ap ,
3483+ struct xfs_alloc_arg * args )
34833484{
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-
34923485 if (ap -> minlen != 1 ) {
3493- ap -> blkno = NULLFSBLOCK ;
3494- ap -> length = 0 ;
3486+ args -> fsbno = NULLFSBLOCK ;
34953487 return 0 ;
34963488 }
34973489
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 ;
35043493
35053494 /*
35063495 * Unlike the longest extent available in an AG, we don't track
@@ -3510,33 +3499,9 @@ xfs_bmap_exact_minlen_extent_alloc(
35103499 * we need not be concerned about a drop in performance in
35113500 * "debug only" code paths.
35123501 */
3513- ap -> blkno = XFS_AGB_TO_FSB (mp , 0 , 0 );
3502+ ap -> blkno = XFS_AGB_TO_FSB (ap -> ip -> i_mount , 0 , 0 );
35143503
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 );
35403505}
35413506
35423507/*
@@ -3795,8 +3760,11 @@ xfs_bmap_btalloc(
37953760 /* Trim the allocation back to the maximum an AG can fit. */
37963761 args .maxlen = min (ap -> length , mp -> m_ag_max_usable );
37973762
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 ))
38003768 error = xfs_bmap_btalloc_filestreams (ap , & args , stripe_align );
38013769 else
38023770 error = xfs_bmap_btalloc_best_length (ap , & args , stripe_align );
@@ -4211,9 +4179,6 @@ xfs_bmapi_allocate(
42114179 if ((bma -> datatype & XFS_ALLOC_USERDATA ) &&
42124180 XFS_IS_REALTIME_INODE (bma -> ip ))
42134181 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 );
42174182 else
42184183 error = xfs_bmap_btalloc (bma );
42194184 if (error )
0 commit comments