lkml.org 
[lkml]   [2023]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 15/17] writeback: Add for_each_writeback_folio()
On Thu, Dec 21, 2023 at 12:51:49PM +0100, Jan Kara wrote:
> On Mon 18-12-23 16:35:51, Christoph Hellwig wrote:
> > From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> >
> > Wrap up the iterator with a nice bit of syntactic sugar. Now the
> > caller doesn't need to know about wbc->err and can just return error,
> > not knowing that the iterator took care of storing errors correctly.
> >
> > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Not sure if the trick with 'error' variable isn't a bit too clever for us
> ;) We'll see how many bugs it will cause in the future...

It's a bit too much syntactic sugar for my taste, but if we want a magic
for macro I can't really see a good way around it. I personally wouldn't
mind a version where the writeback_get_folio moves out of
writeback_iter_init and the pattern would look more like:

writeback_iter_init(mapping, wbc);
while ((folio = writeback_iter_next(mapping, wbc, folio))) {
wbc->err = <do something>
}

return wbc->err;


\
 
 \ /
  Last update: 2023-12-21 13:30    [W:0.096 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site