From: Matthew Wilcox <willy@infradead.org>
To: Kundan Kumar <kundan.kumar@samsung.com>
Cc: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org,
linux-block@vger.kernel.org, joshi.k@samsung.com,
mcgrof@kernel.org, anuj20.g@samsung.com, nj.shetty@samsung.com,
c.gameti@samsung.com, gost.dev@samsung.com
Subject: Re: [PATCH v8 1/5] block: Added folio-ized version of bvec_try_merge_hw_page()
Date: Sat, 17 Aug 2024 05:23:14 +0100 [thread overview]
Message-ID: <ZsAlsjZeNmsBI6J0@casper.infradead.org> (raw)
In-Reply-To: <20240711050750.17792-2-kundan.kumar@samsung.com>
On Thu, Jul 11, 2024 at 10:37:46AM +0530, Kundan Kumar wrote:
> -bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv,
> - struct page *page, unsigned len, unsigned offset,
> +bool bvec_try_merge_hw_folio(struct request_queue *q, struct bio_vec *bv,
> + struct folio *folio, size_t len, size_t offset,
> bool *same_page)
> {
> + struct page *page = folio_page(folio, 0);
> unsigned long mask = queue_segment_boundary(q);
> phys_addr_t addr1 = bvec_phys(bv);
> phys_addr_t addr2 = page_to_phys(page) + offset + len - 1;
[...]
> +bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv,
> + struct page *page, unsigned int len, unsigned int offset,
> + bool *same_page)
> +{
> + struct folio *folio = page_folio(page);
> +
> + return bvec_try_merge_hw_folio(q, bv, folio, len,
> + ((size_t)folio_page_idx(folio, page) << PAGE_SHIFT) +
> + offset, same_page);
> +}
This is the wrong way to do it. bio_add_folio() does it correctly
by being a wrapper around bio_add_page().
The reason is that in the future, not all pages will belong to folios.
For those pages, page_folio() will return NULL, and this will crash.
next prev parent reply other threads:[~2024-08-17 4:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240711051521epcas5p348f2cd84a1a80577754929143255352b@epcas5p3.samsung.com>
2024-07-11 5:07 ` [PATCH v8 0/5] block: add larger order folio instead of pages Kundan Kumar
[not found] ` <CGME20240711051529epcas5p1aaf694dfa65859b8a32bdffce5239bf6@epcas5p1.samsung.com>
2024-07-11 5:07 ` [PATCH v8 1/5] block: Added folio-ized version of bvec_try_merge_hw_page() Kundan Kumar
2024-08-17 4:23 ` Matthew Wilcox [this message]
2024-08-20 7:43 ` Kundan Kumar
2024-08-27 8:22 ` Kundan Kumar
[not found] ` <CGME20240711051532epcas5p360e92f46b86eca56e73643a71950783a@epcas5p3.samsung.com>
2024-07-11 5:07 ` [PATCH v8 2/5] block: Added folio-ized version of bio_add_hw_page() Kundan Kumar
[not found] ` <CGME20240711051536epcas5p369e005a83fb16d9f6d9636585cc66e3b@epcas5p3.samsung.com>
2024-07-11 5:07 ` [PATCH v8 3/5] block: introduce folio awareness and add a bigger size from folio Kundan Kumar
2024-07-25 20:56 ` Anuj gupta
[not found] ` <CGME20240711051539epcas5p2842f564375dc2f1c3de1a869c938436b@epcas5p2.samsung.com>
2024-07-11 5:07 ` [PATCH v8 4/5] mm: release number of pages of a folio Kundan Kumar
[not found] ` <CGME20240711051543epcas5p364f770974e2367d27c685a626cc9dbb5@epcas5p3.samsung.com>
2024-07-11 5:07 ` [PATCH v8 5/5] block: unpin user pages belonging to a folio at once Kundan Kumar
2024-07-18 6:17 ` Kundan Kumar
2024-07-25 20:40 ` Anuj gupta
2024-08-17 4:36 ` Matthew Wilcox
2024-08-08 23:04 ` [PATCH v8 0/5] block: add larger order folio instead of pages Luis Chamberlain
2024-08-12 13:38 ` Christoph Hellwig
2024-08-12 16:35 ` Luis Chamberlain
2024-08-16 8:45 ` Kundan Kumar
2024-08-17 1:22 ` Luis Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZsAlsjZeNmsBI6J0@casper.infradead.org \
--to=willy@infradead.org \
--cc=anuj20.g@samsung.com \
--cc=axboe@kernel.dk \
--cc=c.gameti@samsung.com \
--cc=gost.dev@samsung.com \
--cc=hch@lst.de \
--cc=joshi.k@samsung.com \
--cc=kbusch@kernel.org \
--cc=kundan.kumar@samsung.com \
--cc=linux-block@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=nj.shetty@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).