From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D18430C35C; Mon, 13 Oct 2025 15:24:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760369090; cv=none; b=CcVoct+T7H6eZ7mFDADB6OVJQPBM6GoHcyoJel6dYZ+fEjvZ9wZWNONGOWAXqM8LxxyUIGGt8SQDM8U1l/E0WEYD8V7BGByoXVx6MldTr3IVBA5afb4Bs+4FYr9eNf7jZiutKmt2vKsqy43lemu26E5FAj58ukwxfJoxelkkX+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760369090; c=relaxed/simple; bh=Jj7Ebs5D1rUUdBoFnjQpprEhC+Hx+eRY0/Tc3R/Z+eU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KBIMVgFPMcOhZjkUWaZkk9FZmdiKck8M7NOyngeOXXAMfXiUZDeEpB7AawckQCBCrGA8oNmx1iiBSYuj/3QObGMDtGu6qklJSlgbnEPfVqQPy/Ydwd54c3Hvv1BC5zEnBAOUdqRAETliE4aGigfDvwEjTGN9MPfAiOnMM6b2O98= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yup7bkW8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yup7bkW8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78601C4CEFE; Mon, 13 Oct 2025 15:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760369089; bh=Jj7Ebs5D1rUUdBoFnjQpprEhC+Hx+eRY0/Tc3R/Z+eU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yup7bkW8cN8tNyiBxN5I5MctTQPEW6FhjBKwInKEe5G264My3N+0S76V1cwKmRcQk Ilb+elqthEeonfIiYPfPCETyHFopSCT3dGM4VC9vX9ueIKicPIHFHNLiqXCgN0rMpM PEfvZq9TQ3aB3i4Z9wX2q6kXwRBlk3UVHx7lQUtY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yu Kuai , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 6.17 123/563] block: skip unnecessary checks for split bio Date: Mon, 13 Oct 2025 16:39:44 +0200 Message-ID: <20251013144415.749291210@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251013144411.274874080@linuxfoundation.org> References: <20251013144411.274874080@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yu Kuai [ Upstream commit 0b64682e78f7a53ea863e368b1aa66f05767858d ] Lots of checks are already done while submitting this bio the first time, and there is no need to check them again when this bio is resubmitted after split. Hence open code should_fail_bio() and blk_throtl_bio() that are still necessary from submit_bio_split_bioset(). Signed-off-by: Yu Kuai Reviewed-by: Christoph Hellwig Signed-off-by: Jens Axboe Stable-dep-of: b2f5974079d8 ("block: fix ordering of recursive split IO") Signed-off-by: Sasha Levin --- block/blk-core.c | 2 +- block/blk-merge.c | 6 +++++- block/blk.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index e5af6eda5a459..03a5d4c9cbf72 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -539,7 +539,7 @@ static inline void bio_check_ro(struct bio *bio) } } -static noinline int should_fail_bio(struct bio *bio) +int should_fail_bio(struct bio *bio) { if (should_fail_request(bdev_whole(bio->bi_bdev), bio->bi_iter.bi_size)) return -EIO; diff --git a/block/blk-merge.c b/block/blk-merge.c index 51fe4ed5b7c0b..c411045fcf03a 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -130,7 +130,11 @@ struct bio *bio_submit_split_bioset(struct bio *bio, unsigned int split_sectors, bio_chain(split, bio); trace_block_split(split, bio->bi_iter.bi_sector); WARN_ON_ONCE(bio_zone_write_plugging(bio)); - submit_bio_noacct(bio); + + if (should_fail_bio(bio)) + bio_io_error(bio); + else if (!blk_throtl_bio(bio)) + submit_bio_noacct_nocheck(bio); return split; } diff --git a/block/blk.h b/block/blk.h index 0268deb222688..18cc3c2afdd4d 100644 --- a/block/blk.h +++ b/block/blk.h @@ -615,6 +615,7 @@ extern const struct address_space_operations def_blk_aops; int disk_register_independent_access_ranges(struct gendisk *disk); void disk_unregister_independent_access_ranges(struct gendisk *disk); +int should_fail_bio(struct bio *bio); #ifdef CONFIG_FAIL_MAKE_REQUEST bool should_fail_request(struct block_device *part, unsigned int bytes); #else /* CONFIG_FAIL_MAKE_REQUEST */ -- 2.51.0