[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZXJCxbAm1_V7lPnF@kbusch-mbp>
Date: Thu, 7 Dec 2023 15:10:13 -0700
From: Keith Busch <kbusch@...nel.org>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc: Jens Axboe <axboe@...nel.dk>,
Andrew Morton <akpm@...ux-foundation.org>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Hugh Dickins <hughd@...gle.com>, linux-mm@...ck.org,
linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] block: Remove special-casing of compound pages
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.
Powered by blists - more mailing lists