Re: [PATCH v2 16/16] iomap: Make readpage synchronous

From: Christoph Hellwig
Date: Fri Oct 16 2020 - 02:37:01 EST


On Thu, Oct 15, 2020 at 08:03:12PM +0100, Matthew Wilcox wrote:
> I honestly don't see the problem. We have to assign the status
> conditionally anyway so we don't overwrite an error with a subsequent
> success.

Yes, but having a potential NULL pointer to a common structure is just
waiting for trouble.

>
> > True. I'd still prefer the AOP_UPDATED_PAGE as the fallthrough case
> > and an explicit goto out_unlock, though.
>
> So this?
>
> if (ctx.bio) {
> submit_bio(ctx.bio);
> wait_for_completion(&ctx.done);
> if (ret < 0)
> goto err;
> ret = blk_status_to_errno(ctx.status);
> }
>
> if (ret < 0)
> goto err;
> return AOP_UPDATED_PAGE;
> err:
> unlock_page(page);
> return ret;
>

Looks good.