Message ID | 20231004001943.349265-4-david@fromorbit.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xfs: push perags further into allocation routines | expand |
> + if (max_blen > *blen) { > + if (max_blen_agno != startag) { > + ap->blkno = XFS_AGB_TO_FSB(mp, max_blen_agno, 0); > + ap->aeof = false; > + } > + *blen = max_blen; > + } A comment based on the commit message on why we do this would be nice here. Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
On Wed, Oct 04, 2023 at 11:19:37AM +1100, Dave Chinner wrote: > + if (max_blen > *blen) { > + if (max_blen_agno != startag) { > + ap->blkno = XFS_AGB_TO_FSB(mp, max_blen_agno, 0); > + ap->aeof = false; > + } > + *blen = max_blen; > + } A comment explaining that we at least want the longest freespace if no perfect match is available here would be useful to future readers. Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Oct 05, 2023 at 02:46:18AM -0700, Christoph Hellwig wrote: > On Wed, Oct 04, 2023 at 11:19:37AM +1100, Dave Chinner wrote: > > + if (max_blen > *blen) { > > + if (max_blen_agno != startag) { > > + ap->blkno = XFS_AGB_TO_FSB(mp, max_blen_agno, 0); > > + ap->aeof = false; > > + } > > + *blen = max_blen; > > + } > > A comment explaining that we at least want the longest freespace > if no perfect match is available here would be useful to future > readers. With Christoph's request for an extra comment added, Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > > Otherwise looks good: > > Reviewed-by: Christoph Hellwig <hch@lst.de> >
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index e64ba7e2d13d..ee1c1415c67a 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -3233,6 +3233,8 @@ xfs_bmap_btalloc_select_lengths( struct xfs_mount *mp = args->mp; struct xfs_perag *pag; xfs_agnumber_t agno, startag; + xfs_agnumber_t max_blen_agno; + xfs_extlen_t max_blen = 0; int error = 0; if (ap->tp->t_flags & XFS_TRANS_LOWMODE) { @@ -3264,10 +3266,22 @@ xfs_bmap_btalloc_select_lengths( } break; } + if (*blen > max_blen) { + max_blen = *blen; + max_blen_agno = agno; + } } if (pag) xfs_perag_rele(pag); + if (max_blen > *blen) { + if (max_blen_agno != startag) { + ap->blkno = XFS_AGB_TO_FSB(mp, max_blen_agno, 0); + ap->aeof = false; + } + *blen = max_blen; + } + args->minlen = xfs_bmap_select_minlen(ap, args, *blen); return error; }