diff options
author | Dave Chinner <dchinner@redhat.com> | 2023-02-13 01:14:53 +0300 |
---|---|---|
committer | Dave Chinner <dchinner@redhat.com> | 2023-02-13 01:14:53 +0300 |
commit | 2a7f6d41d8b72412228ede538bdf0e81bf9738f4 (patch) | |
tree | caa513dbfa286d2420eb4f750aaaed9dc61b71e2 /fs/xfs/libxfs/xfs_bmap.c | |
parent | 319c9e874ac8721acdb6583e3459ef595e5ed0a6 (diff) | |
download | linux-2a7f6d41d8b72412228ede538bdf0e81bf9738f4.tar.xz |
xfs: use xfs_alloc_vextent_start_bno() where appropriate
Change obvious callers of single AG allocation to use
xfs_alloc_vextent_start_bno(). Callers no long need to specify
XFS_ALLOCTYPE_START_BNO, and so the type can be driven inward and
removed.
While doing this, also pass the allocation target fsb as a parameter
rather than encoding it in args->fsbno.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs/xfs_bmap.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index efca40fea8f1..94826f35fdae 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -646,12 +646,11 @@ xfs_bmap_extents_to_btree( args.mp = mp; xfs_rmap_ino_bmbt_owner(&args.oinfo, ip->i_ino, whichfork); - args.type = XFS_ALLOCTYPE_START_BNO; - args.fsbno = XFS_INO_TO_FSB(mp, ip->i_ino); args.minlen = args.maxlen = args.prod = 1; args.wasdel = wasdel; *logflagsp = 0; - error = xfs_alloc_vextent(&args); + error = xfs_alloc_vextent_start_ag(&args, + XFS_INO_TO_FSB(mp, ip->i_ino)); if (error) goto out_root_realloc; @@ -792,15 +791,15 @@ xfs_bmap_local_to_extents( args.total = total; args.minlen = args.maxlen = args.prod = 1; xfs_rmap_ino_owner(&args.oinfo, ip->i_ino, whichfork, 0); + /* * Allocate a block. We know we need only one, since the * file currently fits in an inode. */ - args.fsbno = XFS_INO_TO_FSB(args.mp, ip->i_ino); - args.type = XFS_ALLOCTYPE_START_BNO; args.total = total; args.minlen = args.maxlen = args.prod = 1; - error = xfs_alloc_vextent(&args); + error = xfs_alloc_vextent_start_ag(&args, + XFS_INO_TO_FSB(args.mp, ip->i_ino)); if (error) goto done; @@ -3208,7 +3207,6 @@ xfs_bmap_btalloc_select_lengths( int notinit = 0; int error = 0; - args->type = XFS_ALLOCTYPE_START_BNO; if (ap->tp->t_flags & XFS_TRANS_LOWMODE) { args->total = ap->minlen; args->minlen = ap->minlen; @@ -3500,7 +3498,8 @@ xfs_bmap_btalloc_at_eof( struct xfs_bmalloca *ap, struct xfs_alloc_arg *args, xfs_extlen_t blen, - int stripe_align) + int stripe_align, + bool ag_only) { struct xfs_mount *mp = args->mp; xfs_alloctype_t atype; @@ -3565,7 +3564,10 @@ xfs_bmap_btalloc_at_eof( args->minalignslop = 0; } - error = xfs_alloc_vextent(args); + if (ag_only) + error = xfs_alloc_vextent(args); + else + error = xfs_alloc_vextent_start_ag(args, ap->blkno); if (error) return error; @@ -3591,13 +3593,17 @@ xfs_bmap_btalloc_best_length( { struct xfs_mount *mp = args->mp; xfs_extlen_t blen = 0; + bool is_filestream = false; int error; + if ((ap->datatype & XFS_ALLOC_USERDATA) && + xfs_inode_is_filestream(ap->ip)) + is_filestream = true; + /* * Determine the initial block number we will target for allocation. */ - if ((ap->datatype & XFS_ALLOC_USERDATA) && - xfs_inode_is_filestream(ap->ip)) { + if (is_filestream) { xfs_agnumber_t agno = xfs_filestream_lookup_ag(ap->ip); if (agno == NULLAGNUMBER) agno = 0; @@ -3613,8 +3619,7 @@ xfs_bmap_btalloc_best_length( * the request. If one isn't found, then adjust the minimum allocation * size to the largest space found. */ - if ((ap->datatype & XFS_ALLOC_USERDATA) && - xfs_inode_is_filestream(ap->ip)) { + if (is_filestream) { /* * If there is very little free space before we start a * filestreams allocation, we're almost guaranteed to fail to @@ -3639,14 +3644,18 @@ xfs_bmap_btalloc_best_length( * trying. */ if (ap->aeof && !(ap->tp->t_flags & XFS_TRANS_LOWMODE)) { - error = xfs_bmap_btalloc_at_eof(ap, args, blen, stripe_align); + error = xfs_bmap_btalloc_at_eof(ap, args, blen, stripe_align, + is_filestream); if (error) return error; if (args->fsbno != NULLFSBLOCK) return 0; } - error = xfs_alloc_vextent(args); + if (is_filestream) + error = xfs_alloc_vextent(args); + else + error = xfs_alloc_vextent_start_ag(args, ap->blkno); if (error) return error; if (args->fsbno != NULLFSBLOCK) @@ -3658,9 +3667,7 @@ xfs_bmap_btalloc_best_length( */ if (args->minlen > ap->minlen) { args->minlen = ap->minlen; - args->type = XFS_ALLOCTYPE_START_BNO; - args->fsbno = ap->blkno; - error = xfs_alloc_vextent(args); + error = xfs_alloc_vextent_start_ag(args, ap->blkno); if (error) return error; } |