From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Thumshirn Date: Wed, 19 Apr 2023 17:49:28 +0200 Subject: [Cluster-devel] [PATCH v3 19/19] block: mark bio_add_page as __must_check In-Reply-To: References: <20230419140929.5924-1-jth@kernel.org> <20230419140929.5924-20-jth@kernel.org> Message-ID: <0388e267-6a5f-85b8-83eb-62ea5aae06e1@kernel.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 19/04/2023 16:19, Matthew Wilcox wrote: > On Wed, Apr 19, 2023 at 04:09:29PM +0200, Johannes Thumshirn wrote: >> Now that all users of bio_add_page check for the return value, mark >> bio_add_page as __must_check. > > Should probably add __must_check to bio_add_folio too? If this is > really the way you want to go ... means we also need a > __bio_add_folio(). I admit I haven't thought of folios, mea culpa. 3 of the callers of bio_add_folio() don't check the return value: $ git grep -E '\sbio_add_folio\b' fs/iomap/buffered-io.c: bio_add_folio(ctx->bio, folio, plen, poff); fs/iomap/buffered-io.c: bio_add_folio(&bio, folio, plen, poff); fs/iomap/buffered-io.c: bio_add_folio(wpc->ioend->io_bio, folio, len, poff); But from a quick look they look OK to me. Does that look reasonable to you: diff --git a/block/bio.c b/block/bio.c index fd11614bba4d..f3a3524b53e4 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1138,6 +1138,14 @@ int bio_add_page(struct bio *bio, struct page *page, } EXPORT_SYMBOL(bio_add_page); +void __bio_add_folio(struct bio *bio, struct folio *folio, size_t len, + size_t off) +{ + WARN_ON_ONCE(len > UINT_MAX); + WARN_ON_ONCE(off > UINT_MAX); + __bio_add_page(bio, &folio->page, len, off); +} + /** * bio_add_folio - Attempt to add part of a folio to a bio. * @bio: BIO to add to. Byte, Johannes