[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y6XEOtT9Gc3p0kd4@infradead.org>
Date: Fri, 23 Dec 2022 07:07:38 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Andreas Gruenbacher <agruenba@...hat.com>
Cc: Christoph Hellwig <hch@...radead.org>,
"Darrick J . Wong" <djwong@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Matthew Wilcox <willy@...radead.org>,
linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-ext4@...r.kernel.org, cluster-devel@...hat.com
Subject: Re: [RFC v3 5/7] iomap: Get page in page_prepare handler
On Fri, Dec 16, 2022 at 04:06:24PM +0100, Andreas Gruenbacher wrote:
> Change the iomap ->page_prepare() handler to get and return a locked
> folio instead of doing that in iomap_write_begin(). This allows to
> recover from out-of-memory situations in ->page_prepare(), which
> eliminates the corresponding error handling code in iomap_write_begin().
> The ->page_done() handler is now not called with a NULL folio anymore.
Ah, okay - this is the other half of what I asked for earlier, so
we're aligned. Sorry for the noise earlier. I'd still prefer the
naming I suggest, though.
> + if (page_ops && page_ops->page_prepare)
> + folio = page_ops->page_prepare(iter, pos, len);
> + else
> + folio = iomap_folio_prepare(iter, pos);
> + if (IS_ERR_OR_NULL(folio)) {
> + if (!folio)
> + return (iter->flags & IOMAP_NOWAIT) ? -EAGAIN : -ENOMEM;
> + return PTR_ERR(folio);
> }
Maybe encapsulate this in a iomap_get_folio wrapper just to keep the
symmetry with the done side.
Powered by blists - more mailing lists