On Thu, May 10, 2018 at 11:17:58AM +1000, Dave Chinner wrote:
> > + if (ret <= 0)
> > + break;
> > + pos += ret;
> > + length -= ret;
> > + }
> > +
> > + ret = 0;
>
> This means the function will always return zero, regardless of
> whether iomap_apply returned an error or not.
>
> > + if (ctx.bio)
> > + submit_bio(ctx.bio);
> > + if (ctx.cur_page) {
> > + if (!ctx.cur_page_in_bio)
> > + unlock_page(ctx.cur_page);
> > + put_page(ctx.cur_page);
> > + }
> > + WARN_ON_ONCE(ret && !list_empty(ctx.pages));
>
> And this warning will never trigger. Was this intended behaviour?
> If it is, it needs a comment, because it looks wrong....
Yes, the break should have been a goto out which jumps after the
ret.