All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>,
	Matthew Wilcox <willy@infradead.org>,
	David Howells <dhowells@redhat.com>,
	trond.myklebust@primarydata.com, darrick.wong@oracle.com,
	jlayton@kernel.org, sfrench@samba.org,
	torvalds@linux-foundation.org, linux-nfs@vger.kernel.org,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm: Make swap_readpage() for SWP_FS_OPS use ->direct_IO() not ->readpage()
Date: Fri, 13 Aug 2021 08:54:26 +0200	[thread overview]
Message-ID: <20210813065426.GA26243@lst.de> (raw)
In-Reply-To: <20210812174818.GK3601405@magnolia>

On Thu, Aug 12, 2021 at 10:48:18AM -0700, Darrick J. Wong wrote:
> On Thu, Aug 12, 2021 at 07:02:33PM +0200, Christoph Hellwig wrote:
> > On Thu, Aug 12, 2021 at 04:39:40PM +0100, Matthew Wilcox wrote:
> > > I agree with David; we want something lower-level for swap to call into.
> > > I'd suggest aops->swap_rw and an implementation might well look
> > > something like:
> > > 
> > > static ssize_t ext4_swap_rw(struct kiocb *iocb, struct iov_iter *iter)
> > > {
> > > 	return iomap_dio_rw(iocb, iter, &ext4_iomap_ops, NULL, 0);
> > > }
> > 
> > Yes, that might make sense and would also replace the awkward IOCB_SWAP
> > flag for the write side.
> > 
> > For file systems like ext4 and xfs that have an in-memory block mapping
> > tree this would be way better than the current version and also support
> > swap on say multi-device file systems properly.  We'd just need to be
> > careful to read the extent information in at extent_activate time,
> > by doing xfs_iread_extents for XFS or the equivalents in other file
> > systems.
> 
> You'd still want to walk the extent map at activation time to reject
> swapfiles with holes, shared extents, etc., right?

Yes.  While direct I/O code could do allocation at swap I/O time that
probably is not a good idea due to the memory requirements.

  parent reply	other threads:[~2021-08-13  6:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 11:57 [PATCH 0/2] mm: Fix NFS swapfiles and use DIO read for swapfiles David Howells
2021-08-12 11:57 ` [PATCH 1/2] nfs: Fix write to swapfile failure due to generic_write_checks() David Howells
2021-08-12 11:57 ` [PATCH 2/2] mm: Make swap_readpage() for SWP_FS_OPS use ->direct_IO() not ->readpage() David Howells
2021-08-12 12:21   ` Christoph Hellwig
2021-08-12 12:57   ` David Howells
2021-08-12 15:39     ` Matthew Wilcox
2021-08-12 17:02       ` Christoph Hellwig
2021-08-12 17:48         ` Darrick J. Wong
2021-08-12 18:14           ` Matthew Wilcox
2021-08-12 20:13             ` Theodore Ts'o
2021-08-13  6:54           ` Christoph Hellwig [this message]
2021-08-12 13:00   ` Matthew Wilcox
2021-08-12 13:23   ` David Howells
2021-08-12 13:37   ` David Howells
2021-08-12 13:50     ` Matthew Wilcox
2021-08-12 14:16     ` David Howells
2021-08-12 12:18 ` [PATCH 0/2] mm: Fix NFS swapfiles and use DIO read for swapfiles Christoph Hellwig
2021-08-13  2:59 ` Hillf Danton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210813065426.GA26243@lst.de \
    --to=hch@lst.de \
    --cc=darrick.wong@oracle.com \
    --cc=dhowells@redhat.com \
    --cc=djwong@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=sfrench@samba.org \
    --cc=torvalds@linux-foundation.org \
    --cc=trond.myklebust@primarydata.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.