Re: [PATCH v3 3/4] ceph: remove error return from ceph_process_folio_batch()

From: Ilya Dryomov

Date: Wed Feb 11 2026 - 12:56:06 EST


On Thu, Jan 29, 2026 at 1:30 AM Sam Edwards <cfsworks@xxxxxxxxx> wrote:
>
> On Mon, Jan 26, 2026 at 2:55 PM Viacheslav Dubeyko
> <Slava.Dubeyko@xxxxxxx> wrote:
> >
> > On Sun, 2026-01-25 at 18:30 -0800, Sam Edwards wrote:
> > > Following an earlier commit, ceph_process_folio_batch() no longer
> > > returns errors because the writeback loop cannot handle them.
> > >
> > > Since this function already indicates failure to lock any pages by
> > > leaving `ceph_wbc.locked_pages == 0`, and the writeback loop has no way
> > > to handle abandonment of a locked batch, change the return type of
> > > ceph_process_folio_batch() to `void` and remove the pathological goto in
> > > the writeback loop. The lack of a return code emphasizes that
> > > ceph_process_folio_batch() is designed to be abort-free: that is, once
> > > it commits a folio for writeback, it will not later abandon it or
> > > propagate an error for that folio. Any future changes requiring "abort"
> > > logic should follow this invariant by cleaning up its array and
> > > resetting ceph_wbc.locked_pages appropriately.
> > >
> > > Signed-off-by: Sam Edwards <CFSworks@xxxxxxxxx>
> > > ---
> > > fs/ceph/addr.c | 17 +++++------------
> > > 1 file changed, 5 insertions(+), 12 deletions(-)
> > >
> > > diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> > > index 39064893f35b..cdf11288d6b7 100644
> > > --- a/fs/ceph/addr.c
> > > +++ b/fs/ceph/addr.c
> > > @@ -1284,16 +1284,16 @@ static inline int move_dirty_folio_in_page_array(struct address_space *mapping,
> > > }
> > >
> > > static
> > > -int ceph_process_folio_batch(struct address_space *mapping,
> > > - struct writeback_control *wbc,
> > > - struct ceph_writeback_ctl *ceph_wbc)
> >
> > I still prefer to return the error code from the function.
>
> Hi Slava,
>
> Since the objection to this patch is mere preference at this point, we
> need to seek broader consensus before either of us unilaterally
> decides whether this style is appropriate for the CephFS subsystem.
> I'm willing to follow the preferences of the group, we just need a
> "group" first. :)

Hi Sam,

The rationale that you provided on v2 [1] and in other responses makes
sense to me. If the need for signaling an error that would be handled
by the (currently only) caller in a meaningful way arises, the signature
can be rolled back but until then I don't see any point in continuing
to always returning 0. Having this rc variable that one needs to
remember to reset on every error path only brings confusion; the bug
that is getting fixed in the first patch of the series is a clear proof
of that.

[1] https://lore.kernel.org/ceph-devel/CAH5Ym4jn8wg+mYGqKGb17OZGBkyDeX-Vx3wgfVT0cqPtn36QFQ@xxxxxxxxxxxxxx/

Thanks,

Ilya