Re: [PATCH v15 02/17] block: Add bio_for_each_folio_all()

From
Christoph Hellwig <hch@infradead.org>
Date
2021-07-20 06:50:23
Also in
linux-fsdevel, linux-mm
Reply to
Matthew Wilcox (Oracle), 2021-07-19
On Mon, Jul 19, 2021 at 07:39:46PM +0100, Matthew Wilcox (Oracle) wrote:
quoted hunk ↗ jump to hunk
 #define bio_for_each_bvec_all(bvl, bio, i)		\
 	for (i = 0, bvl = bio_first_bvec_all(bio);	\
-	     i < (bio)->bi_vcnt; i++, bvl++)		\
+	     i < (bio)->bi_vcnt; i++, bvl++)
Pleae split out this unrelated fixup.
+static inline
+void bio_first_folio(struct folio_iter *fi, struct bio *bio, int i)
Please fix the strange formatting.
quoted hunk ↗ jump to hunk
+{
+	struct bio_vec *bvec = bio_first_bvec_all(bio) + i;
+
+	fi->folio = page_folio(bvec->bv_page);
+	fi->offset = bvec->bv_offset +
+			PAGE_SIZE * (bvec->bv_page - &fi->folio->page);
Can we have a little helper for the offset in folio calculation, like:

static inline size_t offset_of_page_in_folio(struct page *page)
{
	return (bvec->bv_page - &page_folio(page)->page) * PAGE;
}

as that makes the callers a lot easier to read.
Thread (62 messages) 62 messages, 5 authors, last reply 2021-07-30
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help