Re: [PATCH] xfs: Use for_each_perag() to iterate all available AGs

From: Eric Sandeen
Date: Tue Apr 04 2023 - 10:27:10 EST


On 4/4/23 3:47 AM, Ryosuke Yasuoka wrote:
> for_each_perag_wrap() doesn't expect 0 as 2nd arg.
> To iterate all the available AGs, just use for_each_perag() instead.

Can you explain what goes wrong if it is zero? Is there a test for this?

If it's a general problem, what if the other 2 callers pass in the variable
start_agno with a value of 0?

(I may well be missing something obvious as those macros are a bit dense)

Thanks,
-Eric

> Signed-off-by: Ryosuke Yasuoka <ryasuoka@xxxxxxxxxx>
> ---
> fs/xfs/xfs_filestream.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c
> index 22c13933c8f8..48f43c340c58 100644
> --- a/fs/xfs/xfs_filestream.c
> +++ b/fs/xfs/xfs_filestream.c
> @@ -151,7 +151,7 @@ xfs_filestream_pick_ag(
> * grab.
> */
> if (!max_pag) {
> - for_each_perag_wrap(args->mp, 0, start_agno, args->pag)
> + for_each_perag(args->mp, start_agno, args->pag)
> break;
> atomic_inc(&args->pag->pagf_fstrms);
> *longest = 0;