Re: [PATCH v2 00/16] Allow readpage to return a locked page

From: Matthew Wilcox
Date: Thu Oct 15 2020 - 07:55:23 EST


On Thu, Oct 15, 2020 at 10:02:42AM +0100, Christoph Hellwig wrote:
> On Fri, Oct 09, 2020 at 03:30:48PM +0100, Matthew Wilcox (Oracle) wrote:
> > Ideally all filesystems would return from ->readpage with the page
> > Uptodate and Locked, but it's a bit painful to convert all the
> > asynchronous readpage implementations to synchronous. The first 14
> > filesystems converted are already synchronous. The last two patches
> > convert iomap to synchronous readpage.
>
> Is it really that bad? It seems like a lot of the remainig file systems
> use the generic mpage/buffer/nobh helpers.
>
> But I guess this series is a good first step.

I'm just testing a patch to mpage_readpage():

+++ b/fs/mpage.c
@@ -406,11 +406,17 @@ int mpage_readpage(struct page *page, get_block_t get_block)
.nr_pages = 1,
.get_block = get_block,
};
+ int err;

args.bio = do_mpage_readpage(&args);
- if (args.bio)
- mpage_bio_submit(REQ_OP_READ, 0, args.bio);
- return 0;
+ if (!args.bio)
+ return 0;
+ bio_set_op_attrs(args.bio, REQ_OP_READ, 0);
+ guard_bio_eod(args.bio);
+ err = submit_bio_wait(args.bio);
+ if (!err)
+ err = AOP_UPDATED_PAGE;
+ return err;
}
EXPORT_SYMBOL(mpage_readpage);


but I'm not looking forward to block_read_full_page().