[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e80d8dc3-97df-4dc1-b93f-a5add503b3bf@oracle.com>
Date: Mon, 23 Sep 2024 11:33:41 +0100
From: John Garry <john.g.garry@...cle.com>
To: Christoph Hellwig <hch@....de>
Cc: axboe@...nel.dk, linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-raid@...r.kernel.org, martin.petersen@...cle.com
Subject: Re: [PATCH RFC 3/6] block: Handle bio_split() errors in
bio_submit_split()
On 20/09/2024 15:09, Christoph Hellwig wrote:
> On Thu, Sep 19, 2024 at 09:22:59AM +0000, John Garry wrote:
>> + if (IS_ERR(split)) {
>> + bio->bi_status = errno_to_blk_status(PTR_ERR(split));
>> + bio_endio(bio);
>> + return NULL;
>> + }
> This could use a goto to have a single path that ends the bio and
> return NULL instead of duplicating the logic.
Sure, ok.
I was also considering adding a helper for these cases, similar to
bio_io_error(), which accepts a bio and an int errorno or blk_status_t
type, like:
void bio_end_error(struct bio* bio, int errno)
{
bio->bi_status = errno_to_blk_status(errno);
bio_endio(bio);
}
I didn't bother though. Sometimes we already have the blk_status_t
value, which made this a half-useful API.
Powered by blists - more mailing lists