block: Rework bio_split() return value
authorJohn Garry <john.g.garry@oracle.com>
Thu, 31 Oct 2024 09:59:13 +0000 (09:59 +0000)
committerJens Axboe <axboe@kernel.dk>
Thu, 7 Nov 2024 18:25:28 +0000 (11:25 -0700)
commit3dae8e52874106505bd77b0c7a0601b29bd3a787
treeed4aecac352b291d468b3608cde514e879ede780
parent1eadb157947163ca72ba8963b915fdc099ce6cca
block: Rework bio_split() return value

Instead of returning an inconclusive value of NULL for an error in calling
bio_split(), return a ERR_PTR() always.

Also remove the BUG_ON() calls, and WARN_ON_ONCE() instead. Indeed, since
almost all callers don't check the return code from bio_split(), we'll
crash anyway (for those failures).

Fix up the only user which checks bio_split() return code today (directly
or indirectly), blk_crypto_fallback_split_bio_if_needed(). The md/bcache
code does check the return code in cached_dev_cache_miss() ->
bio_next_split() -> bio_split(), but only to see if there was a split, so
there would be no change in behaviour here (when returning a ERR_PTR()).

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20241031095918.99964-2-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c
block/blk-crypto-fallback.c