From nobody Fri Apr 10 01:05:15 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 E58AC3DA5DC for ; Wed, 4 Mar 2026 19:04:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772651078; cv=none; b=prApLOR/T2pvZe139eIil5qL7fdtoT7eCPjcgPxCgR8SKV9u6G9ofTYb3csN7Zfp5zcLTG6RZXuI7AJ1gMqPgGTqppOnBA6cLW+o8wU7ty2RImaVdpRhUbHL/8O7Xxibia0JtrYf1Laf14zHfzjFf6DXVOdOARpNLMVr2VynUKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772651078; c=relaxed/simple; bh=z5DcHO21FkkM2jLsixG55fluSxfkaZB9FrzRy7NEkSA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sAD7K448smI8FQaaCS3O4focwJKcOuJsScjbElQDb00qzRMI3ZJwBxozrIycyGIevb+9Ct2OjuPkj4V/N19h9VUyvXNZE229CeMnwyPTvvFxE2lp92UyUJ36F9R2G0gnB6RqIBvyfbW6glrpczvLmYMqgNjZd5Dvu6a7BP5PJc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=amREQSHN; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="amREQSHN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772651076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BaLtYgei9IWIO1DSr3vx23YgMlhkxC2wxvdO5uumCI4=; b=amREQSHNzzhSDzaZ8jrzXTjitrTOqiTlOkS0Q9/YkeiWpBrF3beFTKOekCVlL+Y1dCSIns AuUjL8uugP+MWVJM8b801OcUS78D6Q4E5HPS4lCMgnRSUAv8N4icsJC9D4ZfgNMuV17bel 5W5Fb8Ea8HSuOTgGnKvXMdLLBUd/Xag= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-RvUA3WaMPNqHxqOGAKktYw-1; Wed, 04 Mar 2026 14:04:32 -0500 X-MC-Unique: RvUA3WaMPNqHxqOGAKktYw-1 X-Mimecast-MFC-AGG-ID: RvUA3WaMPNqHxqOGAKktYw_1772651071 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7551C1800464; Wed, 4 Mar 2026 19:04:31 +0000 (UTC) Received: from pasta.fast.eng.rdu2.dc.redhat.com (unknown [10.44.32.29]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0E76418002A6; Wed, 4 Mar 2026 19:04:28 +0000 (UTC) From: Andreas Gruenbacher To: Jens Axboe Cc: Andreas Gruenbacher , linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] block: consecutive blk_status_t error codes Date: Wed, 4 Mar 2026 20:04:06 +0100 Message-ID: <20260304190424.291743-2-agruenba@redhat.com> In-Reply-To: <20260304190424.291743-1-agruenba@redhat.com> References: <20260304190424.291743-1-agruenba@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Since commit 9da3d1e912f3 ("block: Add core atomic write support"), there is a gap in the blk_status_t codes and block status code 18 is unused. This causes blk_status_to_errno() and blk_status_to_str() to return incorrect values for that code. Make the blk_status_t codes consecutive again to avoid that. Fixes: 9da3d1e912f3 ("block: Add core atomic write support") Signed-off-by: Andreas Gruenbacher Reviewed-by: Christoph Hellwig Reviewed-by: John Garry --- include/linux/blk_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 8808ee76e73c..89a722d76c28 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -168,7 +168,7 @@ typedef u16 blk_short_t; /* * Invalid size or alignment. */ -#define BLK_STS_INVAL ((__force blk_status_t)19) +#define BLK_STS_INVAL ((__force blk_status_t)18) =20 /** * blk_path_error - returns true if error may be path related --=20 2.52.0 From nobody Fri Apr 10 01:05:15 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 A2F8F3DBD6F for ; Wed, 4 Mar 2026 19:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772651080; cv=none; b=QKS6g5Kp3sRdPqjTiht0Eg6Qg415PqNbufYkSAGOgt2BY19xPRvNusPrQ9k09rMPZANmJPA6jX6o0cz8Y9Olc4/MFuubX2QSvE2HfGXh4d3NU8wkDyJhAUCFwY7xoYEDlZqeOyxkXqlbv5jgOpt4nJ0AbKOEj4JlR7/pXYmLIrY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772651080; c=relaxed/simple; bh=gPdzuSJ4OpIx0ANFGSXNp22Imqcrhnh1C52bd5cSU98=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=thEDbLzLXMJpPp3rhaZ+TLhuqYvUrMl5BJxS9/zRqbEQWaOoIeogXmuXEOuLAlrMXWJj87lF2cteYed2cGkUO+yUk5/wYrMXpr/K9e23sWREpl6s4Y4sEckjs4b/bvL++qO8C6wYkocFlZEzQc/cGVQaNE/MhGaKIIJ7Kvanb40= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=A5opi+DM; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="A5opi+DM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772651078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nM7kNBSEq9uce0DB9nBNjzTI/YSlQuc5UuGQ7K2UugI=; b=A5opi+DMcv8zotlHk30B02kWujh9axhNHrSaTts5clpwsO3HtnUJMGdCfqKJQ/e5XCdWpv VJSdb9WvLRK2sYWokSowQr+69iWoqFhhP2Hcz5HTuP4dkTsj8MA2pGVr9U/DxH/t9Dx2el VAfcCV/QFpYuO4aCI2PvXonimTSxmZE= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-317-ng3K5dKrOE6uUqSz4RUfzQ-1; Wed, 04 Mar 2026 14:04:35 -0500 X-MC-Unique: ng3K5dKrOE6uUqSz4RUfzQ-1 X-Mimecast-MFC-AGG-ID: ng3K5dKrOE6uUqSz4RUfzQ_1772651074 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6B99019560A3; Wed, 4 Mar 2026 19:04:34 +0000 (UTC) Received: from pasta.fast.eng.rdu2.dc.redhat.com (unknown [10.44.32.29]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E2E941800576; Wed, 4 Mar 2026 19:04:31 +0000 (UTC) From: Andreas Gruenbacher To: Jens Axboe Cc: Andreas Gruenbacher , linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] block: get rid of blk_status_to_{errno,str} inconsistency Date: Wed, 4 Mar 2026 20:04:07 +0100 Message-ID: <20260304190424.291743-3-agruenba@redhat.com> In-Reply-To: <20260304190424.291743-1-agruenba@redhat.com> References: <20260304190424.291743-1-agruenba@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Change blk_status_to_str() to be consistent with blk_status_to_errno() and return "I/O" for undefined status codes. With that, the fallback case in the blk_errors array can be removed with no change in behavior. Signed-off-by: Andreas Gruenbacher Reviewed-by: Christoph Hellwig Reviewed-by: John Garry --- block/blk-core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 474700ffaa1c..a20042f15790 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -161,9 +161,6 @@ static const struct { [BLK_STS_DURATION_LIMIT] =3D { -ETIME, "duration limit exceeded" }, =20 [BLK_STS_INVAL] =3D { -EINVAL, "invalid" }, - - /* everything else not covered above: */ - [BLK_STS_IOERR] =3D { -EIO, "I/O" }, }; =20 blk_status_t errno_to_blk_status(int errno) @@ -194,7 +191,7 @@ const char *blk_status_to_str(blk_status_t status) int idx =3D (__force int)status; =20 if (WARN_ON_ONCE(idx >=3D ARRAY_SIZE(blk_errors))) - return ""; + return "I/O"; return blk_errors[idx].name; } EXPORT_SYMBOL_GPL(blk_status_to_str); --=20 2.52.0 From nobody Fri Apr 10 01:05:15 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 8333B3DBD6D for ; Wed, 4 Mar 2026 19:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772651082; cv=none; b=ezGW6MWIlVz7lDJGAi6uWWkimMu4hd7oBVk7gi5P3dMcgPsV3jFZKvYLXDkXqxPmCusqYdJJFp1lOKQ1r0xMp415tpUcCOJhwfvuhau6yrhWXOWBLt05XnitZJJX+zc8dHC8TNjQXyJbdtlGpxvUFw/XxoNdQoG5gNtZ8vWcSa4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772651082; c=relaxed/simple; bh=Mlj/9K3KlIWlpIMKlBt+1viGCig6d33F+gd4tCZ6LAM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tDf721zcqW+tXcKcIoCbhSyh8eryWo53v+NvUxgWskdLiiINdlOqohhjfvuZ6R/VoWWwH0jFV/uZpqLLhK2tk6oXj/lodB9BUL+N8l1xwbd/dkNKHaSFN91w8CePlIFSdE4rWmqCzTIcERXS7Oy9UBFG59+hspG+A049rLpJX6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KUj9uH19; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KUj9uH19" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772651080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c4/gvWAc7jMA8PiPw4OjdtXDR+vFdse+XnqHD39G+E8=; b=KUj9uH199S6zMh8OTjAFTJgHAMjME/BXW/0l35qLJl4dEsf3uOwe+VEZHr5Pxilsbzpiq0 W3VMvshIW+vTfLIFBK4kE0CY7/oxmqGrR1ymBY4dXMN4UFf3jWtD7EU0idBHkjggpHv+yi pPOYyD8JpqohuNLXNMRfxjZukY1Dllk= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-2-RnlrEz9nMkejANd1DJV44g-1; Wed, 04 Mar 2026 14:04:39 -0500 X-MC-Unique: RnlrEz9nMkejANd1DJV44g-1 X-Mimecast-MFC-AGG-ID: RnlrEz9nMkejANd1DJV44g_1772651077 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6C4491956088; Wed, 4 Mar 2026 19:04:37 +0000 (UTC) Received: from pasta.fast.eng.rdu2.dc.redhat.com (unknown [10.44.32.29]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D82EB1800576; Wed, 4 Mar 2026 19:04:34 +0000 (UTC) From: Andreas Gruenbacher To: Jens Axboe Cc: Andreas Gruenbacher , linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 3/4] bio: rename bio_chain arguments Date: Wed, 4 Mar 2026 20:04:08 +0100 Message-ID: <20260304190424.291743-4-agruenba@redhat.com> In-Reply-To: <20260304190424.291743-1-agruenba@redhat.com> References: <20260304190424.291743-1-agruenba@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Use the same argument names in bio_chain() as in bio_chain_and_submit() to be consistent. Slightly improve the function description. Signed-off-by: Andreas Gruenbacher Reviewed-by: Christoph Hellwig --- block/bio.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/block/bio.c b/block/bio.c index eadf4c1e9994..5e60bf3730af 100644 --- a/block/bio.c +++ b/block/bio.c @@ -369,22 +369,22 @@ static void bio_chain_endio(struct bio *bio) =20 /** * bio_chain - chain bio completions - * @bio: the target bio - * @parent: the parent bio of @bio + * @prev: the bio to chain + * @new: the bio to chain to * - * The caller won't have a bi_end_io called when @bio completes - instead, - * @parent's bi_end_io won't be called until both @parent and @bio have - * completed; the chained bio will also be freed when it completes. + * The caller won't have a bi_end_io called when @prev completes. Instead, + * @new's bi_end_io will be called once both @new and @prev have completed. + * Like an unchained bio, @prev will be put when it completes. * - * The caller must not set bi_private or bi_end_io in @bio. + * The caller must not set bi_private or bi_end_io in @prev. */ -void bio_chain(struct bio *bio, struct bio *parent) +void bio_chain(struct bio *prev, struct bio *new) { - BUG_ON(bio->bi_private || bio->bi_end_io); + BUG_ON(prev->bi_private || prev->bi_end_io); =20 - bio->bi_private =3D parent; - bio->bi_end_io =3D bio_chain_endio; - bio_inc_remaining(parent); + prev->bi_private =3D new; + prev->bi_end_io =3D bio_chain_endio; + bio_inc_remaining(new); } EXPORT_SYMBOL(bio_chain); =20 --=20 2.52.0 From nobody Fri Apr 10 01:05:15 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 863013DBD71 for ; Wed, 4 Mar 2026 19:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772651089; cv=none; b=Qn7bf2njh9GmrDrF3c6ngLS714QsNIu58zFEUcjU4CkYP9T1QzUqrTJzu89N/6d/dRYkXLb/xE+kiQloVbh4bU0Nk4TJ8Bt2/KOVRdLInwreFlI29E+YriP4hDJnjrtNIU703Av291u/slEbK38VLAuV9BoZu5x6ZRkNnmD7sa8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772651089; c=relaxed/simple; bh=BGwt7vwDCNf5WQi6ZmYsfu/4zMuWe7hZj2XX4UEX1oA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ouvt1hYo/mRY33Vcz+kFGa4Pz4ak0cxsKEX2qoGH9flcs/zah7uN7oIEpckxi2msDwmtOPHlJA7w2UUmiMGR82pOq/XMSmUyFEDk4+YQ7ESHqfqE6dxlPkbp+i5K1ZSIiYq9/IsE/TijvchfVdBtqb5UUm3xaE7QnKdk/pjytlY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=cL1lIvnr; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cL1lIvnr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772651087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cjLvbwBfqfXiZnaMfS45T56EHtgzdALqjSiM9T5ouBw=; b=cL1lIvnrlDprS3HBPPAmEV/XuTK2kzX0pXR8w5e6bph4Cb+e+7QTNJtG37PBchyhS2rqJk wkB4Pnb+j9sBqVoVzzLlXu+ittgMXp5xd/txkeJA8EQ0LIU9saHeADsyaM4Uz7NSpx5nfb 0VUmj12F34bmZrfYQyog6eL/koWosj8= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-321--lemc0VmNrClkT2m_r8aQg-1; Wed, 04 Mar 2026 14:04:42 -0500 X-MC-Unique: -lemc0VmNrClkT2m_r8aQg-1 X-Mimecast-MFC-AGG-ID: -lemc0VmNrClkT2m_r8aQg_1772651081 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A3448195605C; Wed, 4 Mar 2026 19:04:40 +0000 (UTC) Received: from pasta.fast.eng.rdu2.dc.redhat.com (unknown [10.44.32.29]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D8CD81800576; Wed, 4 Mar 2026 19:04:37 +0000 (UTC) From: Andreas Gruenbacher To: Jens Axboe Cc: Andreas Gruenbacher , linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 4/4] bio: use bio_io_error more often Date: Wed, 4 Mar 2026 20:04:09 +0100 Message-ID: <20260304190424.291743-5-agruenba@redhat.com> In-Reply-To: <20260304190424.291743-1-agruenba@redhat.com> References: <20260304190424.291743-1-agruenba@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Instead of setting bio->bi_status to BLK_STS_IOERR and calling bio_endio(bio), use the shorthand bio_io_error(bio). Created with Coccinelle using the following semantic patch: @@ struct bio *bio; @@ - bio->bi_status =3D BLK_STS_IOERR; - bio_endio(bio); + bio_io_error(bio); Signed-off-by: Andreas Gruenbacher Reviewed-by: Christoph Hellwig --- block/fops.c | 3 +-- drivers/block/drbd/drbd_int.h | 3 +-- drivers/md/bcache/bcache.h | 3 +-- drivers/md/bcache/request.c | 6 ++---- drivers/md/dm-mpath.c | 3 +-- drivers/md/dm-writecache.c | 3 +-- fs/f2fs/segment.c | 3 +-- 7 files changed, 8 insertions(+), 16 deletions(-) diff --git a/block/fops.c b/block/fops.c index bb6642b45937..9547f656904d 100644 --- a/block/fops.c +++ b/block/fops.c @@ -218,8 +218,7 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, s= truct iov_iter *iter, =20 ret =3D blkdev_iov_iter_get_pages(bio, iter, bdev); if (unlikely(ret)) { - bio->bi_status =3D BLK_STS_IOERR; - bio_endio(bio); + bio_io_error(bio); break; } if (iocb->ki_flags & IOCB_NOWAIT) { diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index f6d6276974ee..32639e8ea72a 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h @@ -1491,8 +1491,7 @@ static inline void drbd_submit_bio_noacct(struct drbd= _device *device, __release(local); if (!bio->bi_bdev) { drbd_err(device, "drbd_submit_bio_noacct: bio->bi_bdev =3D=3D NULL\n"); - bio->bi_status =3D BLK_STS_IOERR; - bio_endio(bio); + bio_io_error(bio); return; } =20 diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index ec9ff9715081..e0c9d9eef0a0 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -947,8 +947,7 @@ static inline void closure_bio_submit(struct cache_set = *c, { closure_get(cl); if (unlikely(test_bit(CACHE_SET_IO_DISABLE, &c->flags))) { - bio->bi_status =3D BLK_STS_IOERR; - bio_endio(bio); + bio_io_error(bio); return; } submit_bio_noacct(bio); diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 3fa3b13a410f..0f6fa0a2920b 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -1178,8 +1178,7 @@ void cached_dev_submit_bio(struct bio *bio) =20 if (unlikely((d->c && test_bit(CACHE_SET_IO_DISABLE, &d->c->flags)) || dc->io_disable)) { - bio->bi_status =3D BLK_STS_IOERR; - bio_endio(bio); + bio_io_error(bio); return; } =20 @@ -1283,8 +1282,7 @@ void flash_dev_submit_bio(struct bio *bio) struct bcache_device *d =3D bio->bi_bdev->bd_disk->private_data; =20 if (unlikely(d->c && test_bit(CACHE_SET_IO_DISABLE, &d->c->flags))) { - bio->bi_status =3D BLK_STS_IOERR; - bio_endio(bio); + bio_io_error(bio); return; } =20 diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 7cb7bb6233b6..bf4927f58d7f 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -712,8 +712,7 @@ static void process_queued_bios(struct work_struct *wor= k) r =3D __multipath_map_bio(m, bio, mpio); switch (r) { case DM_MAPIO_KILL: - bio->bi_status =3D BLK_STS_IOERR; - bio_endio(bio); + bio_io_error(bio); break; case DM_MAPIO_REQUEUE: bio->bi_status =3D BLK_STS_DM_REQUEUE; diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 98bd945f6da7..78a730a9b1ef 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1876,8 +1876,7 @@ static void __writecache_writeback_pmem(struct dm_wri= tecache *wc, struct writeba if (WC_MODE_FUA(wc)) bio->bi_opf |=3D REQ_FUA; if (writecache_has_error(wc)) { - bio->bi_status =3D BLK_STS_IOERR; - bio_endio(bio); + bio_io_error(bio); } else if (unlikely(!bio_sectors(bio))) { bio->bi_status =3D BLK_STS_OK; bio_endio(bio); diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 6a97fe76712b..2dac0cbb5540 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -4101,8 +4101,7 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio) if (fio->bio && *(fio->bio)) { struct bio *bio =3D *(fio->bio); =20 - bio->bi_status =3D BLK_STS_IOERR; - bio_endio(bio); + bio_io_error(bio); *(fio->bio) =3D NULL; } return err; --=20 2.52.0