Re: [RFC][PATCH v3 0/9] mm: Use DIO for swap and fix NFS swapfiles

David Howells
2021-09-29T15:45:14Z

David Sterba <dsterba@suse.cz> wrote:

> > There are additional patches to get rid of noop_direct_IO and replace it
> > with a feature bitmask, to make btrfs, ext4, xfs and raw blockdevs use the
> > new ->swap_rw method and thence remove the direct BIO submission paths from
> > swap.
> >
> > I kept the IOCB_SWAP flag, using it to enable REQ_SWAP. I'm not sure if
> > that's necessary, but it seems accounting related.
>
> There was probably some step missing. The file must not have holes, so
> either do 'dd' to the right size or use fallocate (which is recommended
> in manual page btrfs(5) SWAPFILE SUPPORT). There are some fstests
> exercising swapfile (grep -l _format_swapfile tests/generic/*) so you
> could try that without having to set up the swapfile manually.

Yeah. As advised elsewhere, I removed the file and recreated it, doing the
chattr before extending the file. At that point swapon worked. It didn't
work though, and various userspace programs started dying. I'm guessing my
btrfs_swap_rw() is wrong somehow.

David