On Mon, Jan 23, 2023 at 05:41:09AM +0000, Allison Henderson wrote: > On Thu, 2023-01-19 at 09:44 +1100, Dave Chinner wrote: > > @@ -3218,21 +3214,21 @@ xfs_bmap_btalloc_select_lengths( > > } > > > > args->total = ap->total; > > - startag = ag = XFS_FSB_TO_AGNO(mp, args->fsbno); > > + startag = XFS_FSB_TO_AGNO(mp, args->fsbno); > > if (startag == NULLAGNUMBER) > > - startag = ag = 0; > > + startag = 0; > > > > - while (*blen < args->maxlen) { > > - error = xfs_bmap_longest_free_extent(args->tp, ag, > > blen, > > + *blen = 0; > > + for_each_perag_wrap(mp, startag, agno, pag) { > > + error = xfs_bmap_longest_free_extent(pag, args->tp, > > blen, > > ¬init); > > if (error) > > - return error; > > - > > - if (++ag == mp->m_sb.sb_agcount) > > - ag = 0; > > - if (ag == startag) > > + break; > > + if (*blen >= args->maxlen) > > break; > > } > > + if (pag) > > + xfs_perag_rele(pag); > > > > xfs_bmap_select_minlen(ap, args, blen, notinit); > > return 0; > Hmm, did you want to return error here? Since now we only break on > error in the loop body above? Yup, good catch Allison, that needs fixing. -Dave. -- Dave Chinner david@xxxxxxxxxxxxx