lkml.org 
[lkml]   [2023]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 08/12] writeback: Factor writeback_get_folio() out of write_cache_pages()
On Mon, Jun 26, 2023 at 09:34:17PM -0700, Christoph Hellwig wrote:
> > + for (;;) {
> > + folio = writeback_get_next(mapping, wbc);
> > + if (!folio)
> > + return NULL;
> > + wbc->done_index = folio->index;
> > +
> > + folio_lock(folio);
> > + if (likely(should_writeback_folio(mapping, wbc, folio)))
> > + break;
> > + folio_unlock(folio);
> > + }
> > +
> > + trace_wbc_writepage(wbc, inode_to_bdi(mapping->host));
> > + return folio;
>
> Same minor nitpick, why not:
>
>
> while ((folio = writeback_get_next(mapping, wbc)) {
> wbc->done_index = folio->index;
>
> folio_lock(folio);
> if (likely(should_writeback_folio(mapping, wbc, folio))) {
> trace_wbc_writepage(wbc, inode_to_bdi(mapping->host));
> break;
> }
> folio_unlock(folio);
> }
>
> return folio;
>
> ?

Because we end up having to call writeback_finish() somewhere, and it's
neater to do it here than in either writeback_get_next() or both callers
of writeback_get_folio().

\
 
 \ /
  Last update: 2023-06-27 17:25    [W:0.066 / U:2.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site