[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRVlDZRIm8zTjDIh@casper.infradead.org>
Date: Thu, 12 Aug 2021 19:14:37 +0100
From: Matthew Wilcox <willy@...radead.org>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: Christoph Hellwig <hch@....de>,
David Howells <dhowells@...hat.com>,
trond.myklebust@...marydata.com, darrick.wong@...cle.com,
jlayton@...nel.org, sfrench@...ba.org,
torvalds@...ux-foundation.org, linux-nfs@...r.kernel.org,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] mm: Make swap_readpage() for SWP_FS_OPS use
->direct_IO() not ->readpage()
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?
Well ... this would actually allow the filesystem to break COWs and
allocate new blocks for holes. Maybe you don't want to be doing that
in a low-memory situation though ;-)
Powered by blists - more mailing lists