lkml.org 
[lkml]   [2023]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] block: Remove special-casing of compound pages
On Thu, Dec 07, 2023 at 03:10:13PM -0700, Keith Busch wrote:
> On Mon, Aug 14, 2023 at 03:41:00PM +0100, Matthew Wilcox (Oracle) wrote:
> > void __bio_release_pages(struct bio *bio, bool mark_dirty)
> > {
> > - struct bvec_iter_all iter_all;
> > - struct bio_vec *bvec;
> > + struct folio_iter fi;
> > +
> > + bio_for_each_folio_all(fi, bio) {
> > + struct page *page;
> > + size_t done = 0;
> >
> > - bio_for_each_segment_all(bvec, bio, iter_all) {
> > - if (mark_dirty && !PageCompound(bvec->bv_page))
> > - set_page_dirty_lock(bvec->bv_page);
> > - bio_release_page(bio, bvec->bv_page);
> > + if (mark_dirty) {
> > + folio_lock(fi.folio);
> > + folio_mark_dirty(fi.folio);
> > + folio_unlock(fi.folio);
> > + }
> > + page = folio_page(fi.folio, fi.offset / PAGE_SIZE);
> > + do {
> > + bio_release_page(bio, page++);
> > + done += PAGE_SIZE;
> > + } while (done < fi.length);
> > }
> > }
>
> Is it okay to release same-folio pages while creating the bio instead of
> releasing all the pages at the completion? If so, the completion could
> provide just the final bio_release_page() instead looping. I'm more
> confirming if that's an appropriate way to use folios here.

For this patch, I'm just replicating the existing behaviour. We can
probably do much better. Honestly, the whole thing is kind of grotesque
and needs to be reformed ... but I think that's part of the physr project.

\
 
 \ /
  Last update: 2023-12-08 00:59    [W:3.182 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site