Re: [PATCH 04/23] MM: move responsibility for setting SWP_FS_OPS to ->swap_activate

From: Christoph Hellwig
Date: Mon Jan 24 2022 - 02:30:33 EST


On Mon, Jan 24, 2022 at 02:48:32PM +1100, NeilBrown wrote:
> If a filesystem wishes to handle all swap IO itself (via ->direct_IO),

Right now it's half ->direct_IO and half ->readpage and about to change
with your series, isn't it?

> rather than just providing devices addresses for submit_bio(),
> SWP_FS_OPS must be set.
> Currently the protocol for setting this it to have ->swap_activate
> return zero. In that case SWP_FS_OPS is set, and add_swap_extent()
> is called for the entire file.
>
> This is a little clumsy as different return values for ->swap_activate
> have quite different meanings, and it makes it hard to search for which
> filesystems require SWP_FS_OPS to be set.
>
> So remove the special meaning of a zero return, and require the
> filesystem to set SWP_FS_OPS if it so desires, and to always call
> add_swap_extent() as required.
>
> Currently only NFS and CIFS return zero for add_swap_extent().
>
> Signed-off-by: NeilBrown <neilb@xxxxxxx>

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>