Re: [PATCH v3 9/9] mm: Remove swap BIO paths and only use DIO paths

From: David Howells
Date: Sat Sep 25 2021 - 11:37:10 EST


Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:

> On Fri, Sep 24, 2021 at 06:19:23PM +0100, David Howells wrote:
> > Delete the BIO-generating swap read/write paths and always use ->swap_rw().
> > This puts the mapping layer in the filesystem.
>
> Is SWP_FS_OPS now unused after this patch?

Ummm. Interesting question - it's only used in swap_set_page_dirty():

int swap_set_page_dirty(struct page *page)
{
struct swap_info_struct *sis = page_swap_info(page);

if (data_race(sis->flags & SWP_FS_OPS)) {
struct address_space *mapping = sis->swap_file->f_mapping;

VM_BUG_ON_PAGE(!PageSwapCache(page), page);
return mapping->a_ops->set_page_dirty(page);
} else {
return __set_page_dirty_no_writeback(page);
}
}


> Also, do we still need ->swap_activate and ->swap_deactivate?

f2fs does quite a lot of work in its ->swap_activate(), as does btrfs. I'm
not sure how necessary it is. cifs looks like it intends to use it, but it's
not fully implemented yet. zonefs and nfs do some checking, including hole
checking in nfs's case. nfs also does some setting up for the sunrpc
transport.

btrfs, cifs, f2fs and nfs all supply ->swap_deactivate() to undo the effects
of the activation.

David