From nobody Mon Dec 1 22:36:27 2025 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AFCC275105 for ; Sat, 29 Nov 2025 09:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406902; cv=none; b=g0tkm5Wj4RFovNfhwu7JrumgxuSQm5qQfF76fzOboH2CfMNsLkhZ7oAmjEOvD45obNTgo/GG5AhzhxaBHdfO4ZAo78SoezdnHgWixRUhyLVF3W0G/dKR5TCj3KnvfKTHaFyRQK7cWEib0Jid+ScZVe1q/gZlJese9GVVUOKT2io= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406902; c=relaxed/simple; bh=JLIdNXPMejF737Jv1xzF5GicNRibkuRDb9iX4pmjoI8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EboZp8lCOqUSw5VTqMHEO77u9lA+mIHjih6QuILcCcWvk6REbwqVGl+/F+a/ArCFOnXeRO3p/HphkXSyGNV+Z0WxNOT3VUfNGi3VoPiKGv3/nfiUXrQ1w8+fUg7LuQrEheTs+QH+dYVZ5zym0owWbAEHrnV7BIW16bZJvJ6O3Wg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KRn9SGir; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KRn9SGir" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-7aad4823079so2259914b3a.0 for ; Sat, 29 Nov 2025 01:01:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764406900; x=1765011700; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3B+NwUppxNtx5dO3GeNOAlGv3QVGc2Q+cteUdMRhiTw=; b=KRn9SGir2pBgh1mKiywJ7/hOt0zGejR1vm2MBrEsl9f98GNlgZ/GLGwsccVj/GsjQX WJaVuzCpvoMb/UJx1OOcLfeoU1A/jDTVXGHxrowGhucL/qEMCFP1gcKC54LawCmjQwvH 4LehKy4Y1P+381T+jI5VC/xbtgUkSPJ8vWy2Ve0ciJcUgnMJA+TeWj72zRDM22mSCA3+ HaVLwYO7KEArcs+UnmlxLk2MfYaOC13SfWk+mkQ4qx3hXXJpFEIUY1uGw5HMKKQv2vIJ hlgUAzJiWWPKKU6SZX/HM3Tc2Mts55PI6bwy4Ie6e3qKFW36wyCvXBwAwa2vzNj5MqbY FzTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764406900; x=1765011700; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=3B+NwUppxNtx5dO3GeNOAlGv3QVGc2Q+cteUdMRhiTw=; b=bsgSrrQA1Qy8aEjo6UTOHNGxT0kYQaB0oJTpQX20rKnwdjuLN6rGVhZOgt9A2ASU7o uxVCuiQ7CIzFB4PwWWqwv2o+br41AqAiM3rF/CBGrh14RIav3fGrYfakMe2r4vrwYVZ+ SzAaNf3HMAm5DJojXu7Q4LScT6Fa1Fy0dMFROflDg8ZKZOlNyan04CLJP9uNatJqWBkV rduDqkzJz2ifxhsbRbJoRgCqCiXAcwjg29VNSnX/4rEX5xTgRJ9Cy/uWX1rsAmJJiwYo ayLZq1B4Cdu8rbXARzgLbL7SAW2uYz/CDZkx9/0rYO0lixYywXV9jlkrsZoow3aWdFDA HWaA== X-Forwarded-Encrypted: i=1; AJvYcCXNaZJKWmCdPK9+7bhwVlbwjxs/vL3pZ4n5dU46ZK/WMlCE6aVR6tznpdhtwsSQNW8gqevs1H60aP8zZSc=@vger.kernel.org X-Gm-Message-State: AOJu0YzhLJNKzuDWzem8nCyZ5oAk69oGL7IN33/x1QnUAqufFFv70fcD W7MDe/gwnHMyKvUZRihlh10ziicQWxhpqTW4UEyRE+4ClbbYccQW6hoG X-Gm-Gg: ASbGncvEubYmYrORGa3/s2PnyeiBiNEHYwU4qfLYyB9UOHcmxbQ9iA91gjKl6l/UGPv CKl+JX0Lys9BRDBYh2nA9b5X5ZGm7mpybG4OYSlRpCmRVsUc60EZ7KTCRBxM6R+c1GZBmYVKsPZ wdAF3Z0ECIkY79kcvJCuvvJGH9g/cAhg+Pw1ybdDK9WO0R19ffpG6Cmgesm/LGFzExdCxbEyVdg VZK2Q0Icl2JMT8VcV/6xSoDci98O2Xt9/MaQN6vURK8qX6LIrBkoZturu8B5Y2Jzw9mJYyCIDDw 4gBu3LFgs1Ft5gSXl0lQ04zbHS7LVMzvU4gHZPip3Zs68wolCi0+A0njC1jPcmUU4tsQ/d30wc7 oZNRmkyy+NnWob9SdZlw9ClecvTabsjQbO00XOKoDHUUwy/KqlvscmSu+yEOkwKF9jgk/W4z3ic /PlBkjADMZExpdUMRcqT7fdjUrWC6KfBSih3+J X-Google-Smtp-Source: AGHT+IF9fpUjxnsoJ856uo76C4AbEbv+isvtq3QMxPEeI8s0lui+ms4Diwary4B5eKv1gtl0O4hKMQ== X-Received: by 2002:a05:7022:ec0d:b0:11b:9386:825b with SMTP id a92af1059eb24-11dc87b150cmr7316305c88.48.1764406900072; Sat, 29 Nov 2025 01:01:40 -0800 (PST) Received: from localhost.localdomain ([104.128.72.44]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcae73bedsm28114394c88.0.2025.11.29.01.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 01:01:39 -0800 (PST) From: zhangshida X-Google-Original-From: zhangshida To: Johannes.Thumshirn@wdc.com, hch@infradead.org, agruenba@redhat.com, ming.lei@redhat.com, hsiangkao@linux.alibaba.com, csander@purestorage.com Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev, virtualization@lists.linux.dev, ntfs3@lists.linux.dev, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangshida@kylinos.cn, starzhangzsd@gmail.com Subject: [PATCH v3 1/9] md: bcache: fix improper use of bi_end_io Date: Sat, 29 Nov 2025 17:01:14 +0800 Message-Id: <20251129090122.2457896-2-zhangshida@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20251129090122.2457896-1-zhangshida@kylinos.cn> References: <20251129090122.2457896-1-zhangshida@kylinos.cn> 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 Content-Type: text/plain; charset="utf-8" From: Shida Zhang Don't call bio->bi_end_io() directly. Use the bio_endio() helper function instead, which handles completion more safely and uniformly. Suggested-by: Christoph Hellwig Signed-off-by: Shida Zhang --- drivers/md/bcache/request.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index af345dc6fde..82fdea7dea7 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -1104,7 +1104,7 @@ static void detached_dev_end_io(struct bio *bio) } =20 kfree(ddip); - bio->bi_end_io(bio); + bio_endio(bio); } =20 static void detached_dev_do_request(struct bcache_device *d, struct bio *b= io, @@ -1121,7 +1121,7 @@ static void detached_dev_do_request(struct bcache_dev= ice *d, struct bio *bio, ddip =3D kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO); if (!ddip) { bio->bi_status =3D BLK_STS_RESOURCE; - bio->bi_end_io(bio); + bio_endio(bio); return; } =20 @@ -1136,7 +1136,7 @@ static void detached_dev_do_request(struct bcache_dev= ice *d, struct bio *bio, =20 if ((bio_op(bio) =3D=3D REQ_OP_DISCARD) && !bdev_max_discard_sectors(dc->bdev)) - bio->bi_end_io(bio); + detached_dev_end_io(bio); else submit_bio_noacct(bio); } --=20 2.34.1 From nobody Mon Dec 1 22:36:27 2025 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A71002773CC for ; Sat, 29 Nov 2025 09:01:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406907; cv=none; b=C9LD9ofISEs+0uMVUSsLbEWAvx8VRjHOov1PtEPHVwlH5XJUMgCFFtgdXH4T407oteLksdxvOdnFxtVXH5FWUYe/DIeinXjH0Yh1OLFCFHcCo0sV0RIF+VnHwlJgzM8JTO1AkAORyGvVPYj0YGnE21+X5gNkrbgLIB/zlJIhk3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406907; c=relaxed/simple; bh=jExYI2jaoXiycbQo0Q43ubPRMYOXkZVZRm5nOe4POx4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fOhfgU8rKMSNITWGp7ETCvyF/pT4pYDWX1iqkU16LmIkrhIrdVUj2VbL+HFx+uX70r4ogWH//S2eTNyJWU1fIo3fEi2FCa3j+vaPXUj/yyMyVe2/ZF9fISyr7TJCe57N+GdeYNlBiFmrEGQm5SCKj9YRTxzcllrqzVM+z8lQVvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TvRXDnxg; arc=none smtp.client-ip=209.85.216.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TvRXDnxg" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-3436a97f092so3171656a91.3 for ; Sat, 29 Nov 2025 01:01:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764406905; x=1765011705; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=06c4CDfEOBNFQOCEh49v+FDqCuxNhXoe5zY9J+9QjgY=; b=TvRXDnxgYMTshHKZhCkNuQ8FV3gg1bdYMVAug+4q2m7RRIJFZP3bof47t8xMRAwQlt sfyTFiIZZuuha8Hz8Ne2dkWvL2hUjjM63zPUh8CuJYHc3B/Uteja/oe46MPZWoA3yZzB 3LMMCQ/5opwPbW7tW1owwPc0eBfi+cxKVM2bujQFczwpyMq2T6/EULqBvibxevSUXKKz J9z7FyBAcYtD0q2gOfX6TLpbPu8zbiHkT5Pv7rnd0vqwnhda/51Qx5yEy9bse7VGr3ze ydw9cmZkHB2ELAbaa/CMzlg+Q7Q7MTh075eQ77AxuBGoXv01GceI/QVGQ4zUXSCDHSyT AhUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764406905; x=1765011705; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=06c4CDfEOBNFQOCEh49v+FDqCuxNhXoe5zY9J+9QjgY=; b=IP+uWcFQHHUU3dwnAueYjCPQDABdz3R+JHVZ6n9TjmlZVOLa9UilcJUKyQ8MqTBVDp kn35bJPOqkojOr78L5dzrztgMNIJcFgHWleyEzc1rprV9gvzjX0DViGeC6p7A8pKyLJN PsVGMla0rViWnicndrum5ZAKTwtxI7unGuSn0IPOTB/cMtbdPH8BUYlAoQr5eusqaBtf iW+oxPhJ0I5pRzq+loNOzhmI1C6wgxIxLwUVt+lh+wgIy0v9e4zTBgkCVgpUiFQm2pth qGLeEsUdEVCI38ZTBOV7e8iViuB0zyzGQ/MTc3umc3U36lhidhLuqUrDfdqxR+miKtoA S4eQ== X-Forwarded-Encrypted: i=1; AJvYcCXaTteW3bg4/9P4Xe3WPOZ/xWWh/7iX3gxjJMa4p9MrIzW6hjLEjZwhF2OsaQX8kpG+4F00DAYFgl8Mulg=@vger.kernel.org X-Gm-Message-State: AOJu0Ywa7QaBa23rW5lV0NIRseSp5jjszvoxlcpa9elJAaBvup34vvGY gWKJcX7ZanUz6KkINw76FHW0fInB5E4d0yZqNGJmIAiUJols8XrqOiEn X-Gm-Gg: ASbGncuP7wsFSpreSYqFRZ91ThV/NtnYlYsQQdZ49iLlDlJE3HgcQqy34oqIj8qJa8X ypYKQcjcymOfsM1t70Q6qnzZxTx6Ay84BVzy7ncehbWmcmXDpLxwm8IE3UCmifY16StZphS859P 695d5dxNshCjZYLoQwczmqpu5OQ8H7QJLvfh445tKOPTkTzLAEoYmcT02xi3fuWyivjmbw2Jv+m ea+w/E7Mr6HBDBetYplsg/p3NivHuc5lOex0KGZljjuDz0OwpuzhcUZcvLXT/+Dp/skZ6XwbNLg qKGz9Jmxc0CIC4Zhs2nBGByXBmqCz5ueTKQESdC3MGHBBviNemnDpef5TgBiwsXINPPUZe205iN SrgZOzIbI9JDTJoP7zPy7wBko6f1yuYW9b9T8n/1mctMZOC+ahQ93rX4lOGkcFs5awsQn7KOwHS 7eYlfL9qI04Y35xoKm3rlB4cBp1Q== X-Google-Smtp-Source: AGHT+IEFFhMF6u7tNXXwfE6dPq1pkaM+HsOKRV95Dom9e3MOSpru2Keq8NWtpHMva0MzTN1ZATf4vQ== X-Received: by 2002:a05:7022:62aa:b0:11b:c1ab:bdd4 with SMTP id a92af1059eb24-11cbba4ab67mr12173129c88.38.1764406904816; Sat, 29 Nov 2025 01:01:44 -0800 (PST) Received: from localhost.localdomain ([104.128.72.44]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcae73bedsm28114394c88.0.2025.11.29.01.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 01:01:44 -0800 (PST) From: zhangshida X-Google-Original-From: zhangshida To: Johannes.Thumshirn@wdc.com, hch@infradead.org, agruenba@redhat.com, ming.lei@redhat.com, hsiangkao@linux.alibaba.com, csander@purestorage.com Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev, virtualization@lists.linux.dev, ntfs3@lists.linux.dev, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangshida@kylinos.cn, starzhangzsd@gmail.com Subject: [PATCH v3 2/9] block: prohibit calls to bio_chain_endio Date: Sat, 29 Nov 2025 17:01:15 +0800 Message-Id: <20251129090122.2457896-3-zhangshida@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20251129090122.2457896-1-zhangshida@kylinos.cn> References: <20251129090122.2457896-1-zhangshida@kylinos.cn> 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 Content-Type: text/plain; charset="utf-8" From: Shida Zhang Now that all potential callers of bio_chain_endio have been eliminated, completely prohibit any future calls to this function. Suggested-by: Ming Lei Suggested-by: Andreas Gruenbacher Suggested-by: Christoph Hellwig Signed-off-by: Shida Zhang Reviewed-by: Christoph Hellwig --- block/bio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/bio.c b/block/bio.c index b3a79285c27..1b5e4577f4c 100644 --- a/block/bio.c +++ b/block/bio.c @@ -320,9 +320,13 @@ static struct bio *__bio_chain_endio(struct bio *bio) return parent; } =20 +/** + * This function should only be used as a flag and must never be called. + * If execution reaches here, it indicates a serious programming error. + */ static void bio_chain_endio(struct bio *bio) { - bio_endio(__bio_chain_endio(bio)); + BUG_ON(1); } =20 /** --=20 2.34.1 From nobody Mon Dec 1 22:36:27 2025 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1668327B34D for ; Sat, 29 Nov 2025 09:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406911; cv=none; b=mqMaprjffyqiKROH5U1ha5kJuEr3TK8V/ACh6nETpz1OS5/3FIpRkt2xNwxaB2HngLxjYyV/pSP9rvM4DnCSFpaAsyTGxmVI4KvrUjF7dL6N3OMpYMqy1vF56EipHVgH8+rHSY1KNeMyiKe0PV/uzg/kE6EeXyD2U9Z21UT1+fI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406911; c=relaxed/simple; bh=b80xEn7EdjxWTN/ci1ysQxp/kAR6AhTP55Nuwyj6diA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l8e9ZtKzBKj7hqZugGy3PtWNACa6Rh4h1tnHZuEv5cL+I5obH9yeacHQFh4NPxh6ws9aPttF1W0N77cBToaFtQOirvSGVUuh8Qv0o509FcrKDCQCnlOZDCTH4E62JsOHzXpIaIf0avA7o/p+iUXrswz8UzhW1HDCwc80VPay7Wo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QiV5+N+K; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QiV5+N+K" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-7aad4823079so2259989b3a.0 for ; Sat, 29 Nov 2025 01:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764406909; x=1765011709; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1fxHcLru6xJPrGlRM61sm3BLmSBVukho7BhSnyNPRbc=; b=QiV5+N+K8rvRLBeotMRxe/ceAipnmm4/K5XqUM9OFWx31hIlK6IZHh5SfP6vTbIT3z Z+HDEC8rJrsSImM8J/c3LXbLeMkemS5zgfgijEuileBY7KOVDiMbG5dSZYXtpkuV38is dXgCZD8NV0h3nnw/ZdQhxhkVbwOLDCAvObTBfh9MxNTN+js7T6IUtvvtL+lBf4h1xFyi sZHodfUm50tGwTYUEMPTjRJ1JrzOGkXJ+AMJ1viFrI0uBKsOI4WI/bkgqn7nFOFQ2ifn uDArfq6uqsHHo8Ts8Yna3i45vAnZ7mqN9kaEXwvif4nYBAq/6KE/UlXA8mR/DZaGWX8D rF0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764406909; x=1765011709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1fxHcLru6xJPrGlRM61sm3BLmSBVukho7BhSnyNPRbc=; b=UWvUoay4YwjdsaRfBXw3tF4WPyG+soOFqjFJcGD2q0Lqrang1ehCzOk2gSAUVh2RxG ko96OfTd97LpmB0k6o0IBRuIMgnNQ2A0mPuJj/m06B8IrbCVvnw/HR37+iwPmNOtLX/h a/vee0lk3LOF09eQ3KoyUegdeqhZ4Hp/sCCVh7CQv8MG2FmWuQCFAYG9FuN+L8akDoiS diXQI2BJqJa1ARUHs46GdMOZrhv6QsNg2ZR288clAPVEKVdNziHdPRHuWDM96LlhTLvw /xIzQE4vP5+gFSp5RAyjP+rkB9Q/qjRqbXb4OLlkq41JfDotoI4YxsUmMM0lLg1OipqN NeTg== X-Forwarded-Encrypted: i=1; AJvYcCULg7ESba1tYCD7NfuAkY4b9cku+MgaFzR+HgtPX7XSYxF8VRnaEYAIUZrjmlDZHxFhG9viFZ2otjwe6go=@vger.kernel.org X-Gm-Message-State: AOJu0Yyxv37x3Uycn376XE4C/g5qJfe2xsoZ0gZa1ITd4muzt/cM1JgC unl9krJlHRG9JVVfYe3PoareEgD/Hz1w27sVW5ilpRYQVJ36SN/qHZMT X-Gm-Gg: ASbGnctR9TOJWIBFcX8wWU7TFKmtkqm4VvbdvCQtaS7bJtnrbPCCcVwRpNr5lSphB/M zh27q6hNrweLuCaKlKPAB5HnYXNZhBIPU3xH9H8lHO881WY/6ImeeXfHnD8vowGK1V1UP2c3ro7 7EgoYDyrwgi2SjrhMJhTbDWs+SpWp67JWOIV/ydRyHM7jIy6xeJoB3p34x0BAh5C53yyQlFKZot voWPosPMR4iL4FJnex39pBwG+s6irZSElCaaEHYI/dMInGOzHqM0hLS9vMB3z7PHOu9yEY6SOvM bpg0MvjntGRclkX8aasRuAtWaPw/eANcGjw4DBQ1ZS1a+y/fZkWVVSyXZFRBKhr2m+CHkd0KzxS 6zpF6SWiCt7JUDKfliBPFMXmCXISzcLCEJFjc+ZOdwIkeqf8SFpqPQevvMJI7uqjRMcvImHcoDG csds2QeAofO+ADg5uqvNwPl4w3Wg== X-Google-Smtp-Source: AGHT+IFEuvilLkDJGqcsWwCIedr283xueadWd1RQPKrotWNJSiN6yvq7rXU8DgdpE+SxH743dNudrQ== X-Received: by 2002:a05:7022:221a:b0:11a:2698:87c8 with SMTP id a92af1059eb24-11c9d710498mr16125897c88.1.1764406909336; Sat, 29 Nov 2025 01:01:49 -0800 (PST) Received: from localhost.localdomain ([104.128.72.44]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcae73bedsm28114394c88.0.2025.11.29.01.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 01:01:48 -0800 (PST) From: zhangshida X-Google-Original-From: zhangshida To: Johannes.Thumshirn@wdc.com, hch@infradead.org, agruenba@redhat.com, ming.lei@redhat.com, hsiangkao@linux.alibaba.com, csander@purestorage.com Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev, virtualization@lists.linux.dev, ntfs3@lists.linux.dev, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangshida@kylinos.cn, starzhangzsd@gmail.com Subject: [PATCH v3 3/9] block: prevent race condition on bi_status in __bio_chain_endio Date: Sat, 29 Nov 2025 17:01:16 +0800 Message-Id: <20251129090122.2457896-4-zhangshida@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20251129090122.2457896-1-zhangshida@kylinos.cn> References: <20251129090122.2457896-1-zhangshida@kylinos.cn> 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 Content-Type: text/plain; charset="utf-8" From: Shida Zhang Andreas point out that multiple completions can race setting bi_status. The check (parent->bi_status) and the subsequent write are not an atomic operation. The value of parent->bi_status could have changed between the time you read it for the if check and the time you write to it. So we use cmpxchg to fix the race, as suggested by Christoph. Suggested-by: Andreas Gruenbacher Suggested-by: Christoph Hellwig Suggested-by: Caleb Sander Mateos Signed-off-by: Shida Zhang Reviewed-by: Christoph Hellwig --- block/bio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/bio.c b/block/bio.c index 1b5e4577f4c..097c1cd2054 100644 --- a/block/bio.c +++ b/block/bio.c @@ -314,8 +314,9 @@ static struct bio *__bio_chain_endio(struct bio *bio) { struct bio *parent =3D bio->bi_private; =20 - if (bio->bi_status && !parent->bi_status) - parent->bi_status =3D bio->bi_status; + if (bio->bi_status) + cmpxchg(&parent->bi_status, 0, bio->bi_status); + bio_put(bio); return parent; } --=20 2.34.1 From nobody Mon Dec 1 22:36:27 2025 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC873274B29 for ; Sat, 29 Nov 2025 09:01:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406916; cv=none; b=SFTilOOVmGgOx+bhR0IaivRKJTt56s3fNZeoSSpsEDg7itkiOxY9YRCcTIjf2baXFgBCvsLN92Noh88B8OywvYAdzXoy5Egn6f4umYddfcmAvZAHF7y6GiIDWrcTrSMCTMl51Ss8sJze7u/sLOOzwWvwPF2gr4Fwl0UwASYj0G8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406916; c=relaxed/simple; bh=pDPxpgP4y7Y34S846UZ5pdageZyT3VDirSvStDnHRd4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rPlVDdiVJzI0lVxujps1ZC2Zc2c/63548aYvH4emtNZAMQ2TVuTrDYNYdCnhvgunQXO1/jsXiOhfPcVE9mIUHFGwGh8JaBq5/93Y11zXLLB8KmvNB0CUP58AnWlDeJqzezS1Capg3XiNed6G3s7PWtVZMQtFCkuEYhCdeBkqxEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eCQquR5g; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eCQquR5g" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-7bab7c997eeso3137444b3a.0 for ; Sat, 29 Nov 2025 01:01:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764406914; x=1765011714; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t8NoibJSiNHVArlLUK5xHvDn/GmQ96N4NjNkgGx3wcU=; b=eCQquR5g2nzkSn2xhtf/misuhs+3/XAS8F89freoYMhp/QU2qz/W7KUKu01a/B+W+B qnt8HseNzz86ai9qT4vvsoI0a1AkF/PujnGoqDBMjIvv13WLo2vV8hSgARMExFaic8Qy 6cHt1lezisfN6o/qaY5VGjok8CJkHHLi//N9zsORIFU07TrNviikiX0OMaeV/YlWSjUX yf1L068Hrtnde45bQb7zfgSePLkZQAkyF7A5MSsfY9+5Y2wv31mq+nUxc76XXG5W2Q6c 2W7XzjtCSM7AMVBb/tne8Qf5Im1KuKZJk88r4q7+B4iR9HxlRHwoiJxREo8T/vtTDn6B Do/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764406914; x=1765011714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=t8NoibJSiNHVArlLUK5xHvDn/GmQ96N4NjNkgGx3wcU=; b=M4uDh61SIPn5AVyCLQijiZyvtM44uN/URXvCY83+SzgO274c79rsUSO80kJmiKsf/e pDQ5EcJdbBV4/yEMBmTrfF04gyWx5QcBSzyPjlKVP12ZCj18DPduacTTE6mdZUpcqtPf cgG5pO6IUkcOOtBlqHaTkt3Saz9S/iERLMPvnRVEfVtk8rQqd3E755nFkQAffNt77GSr BOlwhyOaNK9lUXlI3eBbCtDMin5TUuafNkjznq9EFIlGZRiXSBd8humlSnpnvKO91Gge ZEwSe4jaiKDJqvvNo96K5nueY6u/RoCmalOpHg26MyNUqcTVNFbU9BizOdeF6sXT9K5i VdQA== X-Forwarded-Encrypted: i=1; AJvYcCWMX66pIbyIvSiTwMikgWWBiRSp+L72qcdpnyJDPuvlzU6uyTs6XOSYgpH0KWslck7NXSoN9LT81byZtrk=@vger.kernel.org X-Gm-Message-State: AOJu0YwFE6mLplSeZ0lMeJQJIJk1+RSzMoyIaX6mFPXgPDDDj0IYQHe1 sB5/v6sCjN0bPyO5AHqShPc0AupPC81VEZjzeifWbriKgXA9/d2iJcwN X-Gm-Gg: ASbGnctPEL6Ufmbf8vqDeWFlb1Gyxx0AlyyCKc2w1lX9BMbfuSLXnM7etJ7cWiB/gac 7tJclp5mske9CfCzCkxCW1f5IR/JW4SIWlvFmnuMgiQbBMV0MqYS964pWfiYr7ncSq6aQ7rzWe8 TM2Lzaa+vuikkibzxsu/2nZ9mOAhbcNTSvVped5+Dtt602YneSKjvzkZ9l7z6kK+LoQDgZlxCBi AyvNdWzcKH/rS2dBMdearJSHozw/E0Cx+QSpM2/HiHrGE4If8eGNI//DPcdIeqztOcXofLkz5+H GnZ28eotL03uK2XMzkebf6oV4Q2OanUj9YblrMou/2l/J0LRopwrZhOkoOE2rbp0+ekfjZ6EWK2 pS4oN7Mx1RU8giOD037aZF6zOFH+LoviC2svS3wguQQM9x31IODyPEdwNI0fx6BWcqwy+6jFnFS tafMKQzWaYh01vsEmhqPl0h8cXJoHdEN4v0TJU X-Google-Smtp-Source: AGHT+IG2wahiB2PBWVfrDNRf7p52lLBDrzQQGimm/4V6gX8Dcmjw91342gxhdzWR3iErnl9Stx9Lzw== X-Received: by 2002:a05:7022:3c84:b0:119:e569:f277 with SMTP id a92af1059eb24-11c9d864eddmr16724097c88.32.1764406914041; Sat, 29 Nov 2025 01:01:54 -0800 (PST) Received: from localhost.localdomain ([104.128.72.44]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcae73bedsm28114394c88.0.2025.11.29.01.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 01:01:53 -0800 (PST) From: zhangshida X-Google-Original-From: zhangshida To: Johannes.Thumshirn@wdc.com, hch@infradead.org, agruenba@redhat.com, ming.lei@redhat.com, hsiangkao@linux.alibaba.com, csander@purestorage.com Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev, virtualization@lists.linux.dev, ntfs3@lists.linux.dev, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangshida@kylinos.cn, starzhangzsd@gmail.com Subject: [PATCH v3 4/9] block: export bio_chain_and_submit Date: Sat, 29 Nov 2025 17:01:17 +0800 Message-Id: <20251129090122.2457896-5-zhangshida@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20251129090122.2457896-1-zhangshida@kylinos.cn> References: <20251129090122.2457896-1-zhangshida@kylinos.cn> 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 Content-Type: text/plain; charset="utf-8" From: Shida Zhang Export the bio_chain_and_submit function to make it available as a common utility. This will allow replacing repetitive bio chaining patterns found in multiple locations throughout the codebase. Signed-off-by: Shida Zhang --- block/bio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/bio.c b/block/bio.c index 097c1cd2054..7aa4a1d3672 100644 --- a/block/bio.c +++ b/block/bio.c @@ -368,6 +368,7 @@ struct bio *bio_chain_and_submit(struct bio *prev, stru= ct bio *new) } return new; } +EXPORT_SYMBOL_GPL(bio_chain_and_submit); =20 struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev, unsigned int nr_pages, blk_opf_t opf, gfp_t gfp) --=20 2.34.1 From nobody Mon Dec 1 22:36:27 2025 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CA87274B29 for ; Sat, 29 Nov 2025 09:01:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406921; cv=none; b=UzQt2L/ZLsLBzdnzD4iiYlUY+bhKTCdF9KHqOgjFHql/RavnTTZkv1KIJLtHODTYq3uwWKd2WXlkI9f9SkqGQjjVbf7OoJQlswV2JymhMAfFQPgbjd8HXTF1DAXOpb3bNDNQSaM9R8w8LM1kxhMMjCbnhzMmm3slyTlwVmH+pcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406921; c=relaxed/simple; bh=rZqecGhzp3NmtFjaYLSNOTM+/xsMiNIYX8VY+Bn+fL0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DxAwLghx6zIxkDAgHudNKSWJBjci1gCfDOiX7AX8XDp3ohh2GRfI3SM4aT38tRgIvvE8LHLoZ00BBkqs2R2n85jPNaK6n2EmqpWUkiAy3ZuYjBW5rithcB1MQa98TQOXNpf/JkKng4/1IbTpdj81VlWFToVIF2WyKiTpxZaQ+H4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OpCq5xV0; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OpCq5xV0" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-7aab061e7cbso3025736b3a.1 for ; Sat, 29 Nov 2025 01:01:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764406919; x=1765011719; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h7vHs8yXaPj8mv/GRmviioQ8omsZI2Wqns1LW2Ikl6c=; b=OpCq5xV0GpYV4qxg49HqK8ixRDljLimfEEj14WmRfrjYfpR5HNvOpbtgtvfDbb1JQU PjIXGyqpJaoYAup3h5BOmV16imgDbeOqmuCZpGNFoAPAjMLKYOAb7GLZAhDTZsLb/7RK rK6+7uJKk85G5FJ9a+Fio6BBbWsk/B1Yw6he1A1AXzUU9HN6DZ9RHxFXolWtrnrwHXvk MAvKA/2qBAQDCTxl7D3Jjxh6hHRfidgQhmz9cHt+WeBpXaiGOr/2uWMavfMFFEobSNDi lZGpixsfz04G5WowFHqgCbQakJ8vW+p69P0G5tqi981sNpbX5x7y2+iKEAheyIRjnlh/ 7pSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764406919; x=1765011719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=h7vHs8yXaPj8mv/GRmviioQ8omsZI2Wqns1LW2Ikl6c=; b=OfOmJCT7TcpU2GcFg46C7hLaM+P9GBevrjeA/039ihzeAdpzpOCPv/r0Wha23DYVGc Vy8t8qxS9EYELr5Oafo2sBB3i12bOvNXQbXWXcpolmbJi0SxKltfvp6POI1hAfh4WL7n IAk62338IgauBRp9dyeDhsSEfPXGtuNWEendTSRdw8WlwTiVxp9PDbsHudYalvhqLn6M tCLgEy5h7CXH+5okvh1G7tt4/DLJEcTMFxA5KsEjxRHpEjJMd6nsPGm8yOF+bRhM5sI6 gwls2U17U1o2RF0jTyEMLsVR+s12/7aZav75EbH1ddf2BXFDnDYeOd5AKxIJqPKz8Q8k TJFw== X-Forwarded-Encrypted: i=1; AJvYcCUVUPY+w9TXbxVFAKxIIb3YcdtRUb9+B1I/jvm3XauQSXRlSeEcFjh4ujeWVenJVLkTr8sdAZd7zkSEe94=@vger.kernel.org X-Gm-Message-State: AOJu0YyLILiKcgJmfQ6zIGbjfAl0CgI1FaIr0/yms+9n1k3vTMr24DnU saFmLGtMasZhsngTKbhyf7/2h31lw8J8FVnt9Ga6Y6ukDkv7VEleVAqh X-Gm-Gg: ASbGncvKHKxCGXCuv/E5qBfwGPkbbti17fWSdMG8hwJiiLVeCi01JWJf5gpn1ZIzrHx jOzMWhGg0xgaMrXccm/Yy+Ep0NyqbKqIY3h5b6reYSgtdfcqFetDbXwwbkiJmgxLPqDpiJtul2v WK3dSFJqHiXu+H6plflKn7erIEJJd7lpM2TjzKlgpEJ4vx4JMN+xuWRx7Yfijj90yuKqQjQFSBk pNJZIgQUjtUroxu8lHarD+ckqEq1wUOMB4VBPThSVE77gZITj4L79aNDfEVcdDkGJEFnRS836aP e4JrBdQmRHDENOeLsNeKclQj69I6mW5Q0Y/AoH0uNiJUWjVDHmGNao4rQfsWLxcwiBcH9aocdod pr2vT7zDaikGI36774lIyyRz9PHEmFVK7o9S/NnugH/MWVvyWHZ/dPHKBfRWLzZihaxdzcbjCt+ oVUqDkRWxXsK5rgTDrkZ8Yb9tjJCA9z3+Hnvn3 X-Google-Smtp-Source: AGHT+IFdL+OyABUQodQSrM5NvvO0TZqbCFx6Z3c8afGQwuwppQB6YRBsN5vK+YoTkxr7MD5m+Dfwkw== X-Received: by 2002:a05:7022:41:b0:11b:b1ce:277a with SMTP id a92af1059eb24-11c9d8482b1mr17983636c88.28.1764406918534; Sat, 29 Nov 2025 01:01:58 -0800 (PST) Received: from localhost.localdomain ([104.128.72.44]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcae73bedsm28114394c88.0.2025.11.29.01.01.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 01:01:58 -0800 (PST) From: zhangshida X-Google-Original-From: zhangshida To: Johannes.Thumshirn@wdc.com, hch@infradead.org, agruenba@redhat.com, ming.lei@redhat.com, hsiangkao@linux.alibaba.com, csander@purestorage.com Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev, virtualization@lists.linux.dev, ntfs3@lists.linux.dev, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangshida@kylinos.cn, starzhangzsd@gmail.com Subject: [PATCH v3 5/9] xfs: Replace the repetitive bio chaining code patterns Date: Sat, 29 Nov 2025 17:01:18 +0800 Message-Id: <20251129090122.2457896-6-zhangshida@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20251129090122.2457896-1-zhangshida@kylinos.cn> References: <20251129090122.2457896-1-zhangshida@kylinos.cn> 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 Content-Type: text/plain; charset="utf-8" From: Shida Zhang Replace duplicate bio chaining logic with the common bio_chain_and_submit helper function. Signed-off-by: Shida Zhang --- fs/xfs/xfs_bio_io.c | 3 +-- fs/xfs/xfs_buf.c | 3 +-- fs/xfs/xfs_log.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/xfs/xfs_bio_io.c b/fs/xfs/xfs_bio_io.c index 2a736d10eaf..4a6577b0789 100644 --- a/fs/xfs/xfs_bio_io.c +++ b/fs/xfs/xfs_bio_io.c @@ -38,8 +38,7 @@ xfs_rw_bdev( bio_max_vecs(count - done), prev->bi_opf, GFP_KERNEL); bio->bi_iter.bi_sector =3D bio_end_sector(prev); - bio_chain(prev, bio); - submit_bio(prev); + bio_chain_and_submit(prev, bio); } done +=3D added; } while (done < count); diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 773d959965d..c26bd28edb4 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1357,8 +1357,7 @@ xfs_buf_submit_bio( split =3D bio_split(bio, bp->b_maps[map].bm_len, GFP_NOFS, &fs_bio_set); split->bi_iter.bi_sector =3D bp->b_maps[map].bm_bn; - bio_chain(split, bio); - submit_bio(split); + bio_chain_and_submit(split, bio); } bio->bi_iter.bi_sector =3D bp->b_maps[map].bm_bn; submit_bio(bio); diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 603e85c1ab4..f4c9ad1d148 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -1687,8 +1687,7 @@ xlog_write_iclog( =20 split =3D bio_split(&iclog->ic_bio, log->l_logBBsize - bno, GFP_NOIO, &fs_bio_set); - bio_chain(split, &iclog->ic_bio); - submit_bio(split); + bio_chain_and_submit(split, &iclog->ic_bio); =20 /* restart at logical offset zero for the remainder */ iclog->ic_bio.bi_iter.bi_sector =3D log->l_logBBstart; --=20 2.34.1 From nobody Mon Dec 1 22:36:27 2025 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1ABD728469A for ; Sat, 29 Nov 2025 09:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406925; cv=none; b=OVKLmcE3jB/Nk2bbQZAuLniO6b+erhuYHas5TSC4I5lgaSFQ3VxXVrrRz15I6HihNu8czkabIX+aNEMdRV4ethGs/rcDUz1pILGl/jRV4tNWosdYZB5lceToDplWf2WPXHT+mHeTq1A8Tc6G6QznXFBQFYThwOOGnakcuMisSmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406925; c=relaxed/simple; bh=Hfn+I4xKib6YHUNH+g6fjmCyECLvbavw8yPYoNL/5CA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rntlOcI1lV0aJxx3bq8WThUQRJJB+RPyAaC6Sqto+YTxcAVur1MIpkZnAVVZpKhPG3KSARLk8L61h4KCX3nlBsJCdyebDl2WBMiycJExGRwt0EM2dnm73E1qfYdp/YGcz+lx9XdQ0w84uN8y6RCD8+C2/IFGVmrJc+44I1uvVQU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dd1ocxGz; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dd1ocxGz" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-7b86e0d9615so3089590b3a.0 for ; Sat, 29 Nov 2025 01:02:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764406923; x=1765011723; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vdyx9mvaY+8x+eK9XImqi9TsYLR1v6CaCbGe/GD/N5s=; b=dd1ocxGzdhjSsgteQ1J8SNLo8OkTdBZAanb6vnoi7oFFq5bU9MJlGPjhuAytnKRXwd 7foxMQOWM9CeGrUlD1kcXTTvusKIKkyx13/f7/rFKW6layhbqq8l8U5wGBJ8Kgig59eJ p99Qc4DmI+mPpo5U5ok8IbPT0fhgeP3x9lRrqtvDlQhJ9QmDIDHVLCauvhgyhhmGfMG8 FFkIU8Zl1AFofkQhVPM6eE64bjWyk+7YTN9jf6MxPy15TjQlLCGmg68P2pBHzIP6EL4W RAQIEa5ud3nDqEtRoDP2v/ieowml3UaYUT+nzfVlXXDAK0DLgRBhxecyQrP3aL2K90zH QmNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764406923; x=1765011723; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vdyx9mvaY+8x+eK9XImqi9TsYLR1v6CaCbGe/GD/N5s=; b=U52o1bieS3DlSS8Mm68uC49+F27Kvhzs/Rz+xB0p/k8/siVmUvqVjkSrA88bBkWUxS yRsUXHR0eeDHal3kfECGNJcOzXK9ZU4KP3+UmoLTUYTSjffuYQfjuY9l3Zc52SXJvl3d Mvi5WtaEIVYhRJt1OA2ghbjTzgIF9tVSR00X2AeiI0uzzUnLX3GPpVxqpyxJW7uPDbqZ ykxjLjiB4/jJpF7vCmaQJbqohNK5AAfbS8dM2QBIhnY3nYt1C/M1deY5WwcmDgWGMxZu edpBg+mP9FE2UADpwVYHVTjiR40eAQ63wfMvHHXk+JbQ3Jwil6pNGy/MbvROAIlqxa+/ kgiQ== X-Forwarded-Encrypted: i=1; AJvYcCUIUi1Qw6d4mt7Gd8EPMtoCShxVygXiHIWepbz54R2mjlwUtCL0fpecxzjh2nlTUlfrL5pUXOBQmZb05MY=@vger.kernel.org X-Gm-Message-State: AOJu0YwWESJiYbUX4snig3Kn3vcuXcfiuwLaKK0vBmABteBYZghZes/T npcNvjQLPb9OacmVNwvjK7ZQgkEg2DIwAeGiJbSztmHXxmqQJW7WfxqFNsGMm8lTbfE= X-Gm-Gg: ASbGnctUnOxi3t9fgCkuB6pTdhalimqsckLjPdSdzZlZ5tqjixA8Cw7mmSoxtKItqzE 5n8DvY8b5mmsxj8etxBrppKdFXwg93brUT2De3v3xpFdLeBvAGhpPyoyZDoRN3cnkipp5vZMm92 PqJYBc8eqGqA1Gcgf+reL6kRBgESC8scERaZ5Kqmvmmm1D7/YqmWS0mWLsTViXdZ4NQ3iJlWmQy cBByMxNn0gzl9QCuAOlzz4T5z0Zh8nf3Fb+AJVul5cG2nA7iCUyzwsd6Kx7ke00+uqIpom8xrK9 4RyKdzD6dmzI/kAx3Hyoh/lW0SeG3Csd4LNwUo+NSA5HIPL3Kj5H+OrOfVxxA1kygmdtAMHzwT+ De5l5EWOzOFhLsG+8gOspgmTneYzWqCpN6+vp0eaUfYxJlS8tm6fYENRCteQyDDOlQLb22WVJRv U5fzfzOCjJhmLquwT7DV5rOFvtkTPTMS8mkuDX X-Google-Smtp-Source: AGHT+IH/QH6JeY8zEnnFSEp2edvSj4WvW2OiftF5ahPSC2LjhfBX3UeSnFliqzhG5QTteUkJDEx/bA== X-Received: by 2002:a05:7022:ebc2:b0:119:e56b:957d with SMTP id a92af1059eb24-11c9d6127f9mr19966464c88.2.1764406923339; Sat, 29 Nov 2025 01:02:03 -0800 (PST) Received: from localhost.localdomain ([104.128.72.44]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcae73bedsm28114394c88.0.2025.11.29.01.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 01:02:03 -0800 (PST) From: zhangshida X-Google-Original-From: zhangshida To: Johannes.Thumshirn@wdc.com, hch@infradead.org, agruenba@redhat.com, ming.lei@redhat.com, hsiangkao@linux.alibaba.com, csander@purestorage.com Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev, virtualization@lists.linux.dev, ntfs3@lists.linux.dev, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangshida@kylinos.cn, starzhangzsd@gmail.com Subject: [PATCH v3 6/9] block: Replace the repetitive bio chaining code patterns Date: Sat, 29 Nov 2025 17:01:19 +0800 Message-Id: <20251129090122.2457896-7-zhangshida@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20251129090122.2457896-1-zhangshida@kylinos.cn> References: <20251129090122.2457896-1-zhangshida@kylinos.cn> 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 Content-Type: text/plain; charset="utf-8" From: Shida Zhang Replace duplicate bio chaining logic with the common bio_chain_and_submit helper function. Signed-off-by: Shida Zhang --- fs/squashfs/block.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c index a05e3793f93..5818e473255 100644 --- a/fs/squashfs/block.c +++ b/fs/squashfs/block.c @@ -126,8 +126,7 @@ static int squashfs_bio_read_cached(struct bio *fullbio, if (bio) { bio_trim(bio, start_idx * PAGE_SECTORS, (end_idx - start_idx) * PAGE_SECTORS); - bio_chain(bio, new); - submit_bio(bio); + bio_chain_and_submit(bio, new); } =20 bio =3D new; --=20 2.34.1 From nobody Mon Dec 1 22:36:27 2025 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 648B9286D64 for ; Sat, 29 Nov 2025 09:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406930; cv=none; b=npVlojZFz0Q1mB9pQuPmDIMTEE7Kk83qIDux6oL0YdloOwyoSdP0pmSdbMET+cXnJFhJWH8EssjQOcacCjqnBC6S90fYScdU0QLDu1TmuRfwZYluvhxtysCHdwkNrZECtRd/f2NTrhOCaQXA1TEcadorMbb/yfXLwrRSZ5/+5LM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406930; c=relaxed/simple; bh=FvdW5UGbfZbg4/JUFTbGCNNccxPDUjVX1PnGr5SdWKY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XMeVN1MFT5b8f2wudp5tdfbJm57Mz6IZlXNdDDt75lVbJyEjWMKeWBdQZyi4PrZAPEMnQ5FQp1Z6qOgG4qK/0vy8meV/GjAkBU+28EwxObw0GpqdkoQ1EcTOKT2WqhK+b7bNT23akdGDLlvEMrlwIKmObVUv+P/Ruyg4BEf47To= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KvKEnGEd; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KvKEnGEd" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-7b9a98b751eso1910731b3a.1 for ; Sat, 29 Nov 2025 01:02:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764406928; x=1765011728; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fqwLZMa4ASc5Rs++C65X8rlK3EmN43I2MLDa5i9050U=; b=KvKEnGEdxZOSVJvpCWC96O0Ouki17yejWWuNkFLSgXJESMxTCcKV3R5H8SiECddFGo LGgoM6c3NM3wzleQDd4n6wah6ACk6oVNxDv2pALM/R6draIEob3rNiwrBDCvcUdHN0RH R8vThgv664gFfv65bawW5akKeAjAD2zYwPHiksE6BWz6TnsFp1Pt5nhsENWIrUBd1f4p HxXvsQVMYFo/IBJdJop0L94t24qoYhCNG8Y5+RtCoE+xOE1KEdWdLKJc6UfrCHrze9vz iNUNPYBy1qMNiCvKkwQNvBtxWKyMISN8HzFWXwaANoc5YEux1i8a9BOfNudlqzRF3QF8 Zmag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764406928; x=1765011728; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=fqwLZMa4ASc5Rs++C65X8rlK3EmN43I2MLDa5i9050U=; b=TdYaV8UbRpOkibTutmNs3JLZZk0i8906ZVC2icIdW0v8cqEguXJlRMx+s9ROxbgnTj ennH+iO1Ybq04eDYwxkUUTZBNGRvEMfa/VJ3XyPOtxMvOluPa785OEXyF8kwLwS5uMWU +5LcsbT/HxqSl3Ho1tmaHVpB1R7tMKdHXDKu55+ci9fuH83PjP7r7J0YwANvuRcyGdzU RxrDnU6/rJzx2Xq4TH2XB3cY2CsZ63mm0cXAhNBFFd8DoJvAhkoT6HMTbYFqrhUEt/MC nkdC6V8jrUeKb7QQDa5K6HLTJh7M8e44k17USPcKMm7+oMbFNGxA740gBQ+Rm3O5820H aLpA== X-Forwarded-Encrypted: i=1; AJvYcCWHBiBIj+46ETWFVEqAKxTvJVt7lBu7sN0haUEADJKeg0wilqppYSQX9oM6bX/iiPksAVcObcR5+0YVgrc=@vger.kernel.org X-Gm-Message-State: AOJu0YwXgUrOFoEKGHgfFFEbt5JQ7gN1VbUvweD0VEpQF8jyCePlCaNe 9r1dGrYVPxHTHK3wn+dsa5DZo+Rr0vXPGJdprdd2siXJlfnjnr1a/htQ X-Gm-Gg: ASbGnctdOUj6hHiTxbH2wavDKWhxDrughn/gHDe5+yRCEy+/ybcsYF8JwX8rnLHiPh3 Wr9tkQisgOAJn1o8h530ECf+fSn2LrrTxeR5uYS6MDnQ+N4ifC+YaTzMIb4GyI+bjFmJ7ONGgY+ wv70Gbc2UNdjnF7vooRjebIsSqownXFfgzdKz1+Mws5HlO/Y4Gtb6ZU0A+qLAYjTLwJC+4CgrhN ESnOV3tPegsjpVVViPH+TFZ5Cf28ceWhf1Se9b6wbVHJdYV9zQtKb25PTvFUJkGQVxHY4eqXwiY MF6XgyT7xC9V3VpusnuZ9ehr5fbeRClFcrtMblsCa/Rs6ob4Ho9KS1uYFwqLPgRO5gEehD8qCY5 xCVs7D2UdqZ/jDJVfc2ZHragqh0O/iDJZMntc8bJaO2ck7aicHq0I9ZlghTiDVsNIJuUOwn7ue8 6LrRL8V0vfqXVcE9LN2uCcBB107Q== X-Google-Smtp-Source: AGHT+IFpam2VF00mu2rmyIi1m2lRR+Kb7w2Y0p3kOg5DIMgR5i6hM310V7yybDkza8FyIBCJgjbVWA== X-Received: by 2002:a05:7022:4186:b0:119:e55a:9bf8 with SMTP id a92af1059eb24-11cb3ef2761mr13917973c88.20.1764406927773; Sat, 29 Nov 2025 01:02:07 -0800 (PST) Received: from localhost.localdomain ([104.128.72.44]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcae73bedsm28114394c88.0.2025.11.29.01.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 01:02:07 -0800 (PST) From: zhangshida X-Google-Original-From: zhangshida To: Johannes.Thumshirn@wdc.com, hch@infradead.org, agruenba@redhat.com, ming.lei@redhat.com, hsiangkao@linux.alibaba.com, csander@purestorage.com Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev, virtualization@lists.linux.dev, ntfs3@lists.linux.dev, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangshida@kylinos.cn, starzhangzsd@gmail.com Subject: [PATCH v3 7/9] fs/ntfs3: Replace the repetitive bio chaining code patterns Date: Sat, 29 Nov 2025 17:01:20 +0800 Message-Id: <20251129090122.2457896-8-zhangshida@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20251129090122.2457896-1-zhangshida@kylinos.cn> References: <20251129090122.2457896-1-zhangshida@kylinos.cn> 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 Content-Type: text/plain; charset="utf-8" From: Shida Zhang Replace duplicate bio chaining logic with the common bio_chain_and_submit helper function. Signed-off-by: Shida Zhang --- fs/ntfs3/fsntfs.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index c7a2f191254..35685ee4ed2 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -1514,11 +1514,7 @@ int ntfs_bio_pages(struct ntfs_sb_info *sbi, const s= truct runs_tree *run, len =3D ((u64)clen << cluster_bits) - off; new_bio: new =3D bio_alloc(bdev, nr_pages - page_idx, op, GFP_NOFS); - if (bio) { - bio_chain(bio, new); - submit_bio(bio); - } - bio =3D new; + bio =3D bio_chain_and_submit(bio, new); bio->bi_iter.bi_sector =3D lbo >> 9; =20 while (len) { @@ -1611,11 +1607,7 @@ int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const = struct runs_tree *run) len =3D (u64)clen << cluster_bits; new_bio: new =3D bio_alloc(bdev, BIO_MAX_VECS, REQ_OP_WRITE, GFP_NOFS); - if (bio) { - bio_chain(bio, new); - submit_bio(bio); - } - bio =3D new; + bio =3D bio_chain_and_submit(bio, new); bio->bi_iter.bi_sector =3D lbo >> 9; =20 for (;;) { --=20 2.34.1 From nobody Mon Dec 1 22:36:27 2025 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77DA728727F for ; Sat, 29 Nov 2025 09:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406935; cv=none; b=WCb/cgDDxVyJJxBTzXa3tG7KNOFWLqNq8MrI+uxoAUCiyQc+OCAHmN/6rLc6CNyLeRtMgxjjo3rc5dVPZFlAO+tKNUFSt1M+6RZTBMta8mXCacA8zBLLDoTnfd51nGcWqf4YK49FWxqDSof5+axKLbOg1q+GeExKl2jy0M4nVrE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406935; c=relaxed/simple; bh=TbxNohFMmSKnHTWH+mnyMfPFRdWdcWW/LS3/VsufZdc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ER1tGsVbbMoSxa/nzLxdPQBW5rzdbVsH2knnpmURwjbfPuoXSR1flbQxDBW/3yl86mW9ApXg4rxvK3Mrfca9kDCRiCERBcAYgR4MgMA58Js9ul+7MVzXZ8VxDP07SmJLRTPcE6mcK2BUKT7xR6ruXnYaAjmEPdN9CKikS3+J2Mc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=abasbWaq; arc=none smtp.client-ip=209.85.215.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="abasbWaq" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-bd1b0e2c1eeso2035432a12.0 for ; Sat, 29 Nov 2025 01:02:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764406933; x=1765011733; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jJti1W24hnwF4OFg7cS4jWnw0eZv9xglyyGrmFluATQ=; b=abasbWaqd2EQERmVlO4+ix+ajwq4zsnMGSqN0AiBTP/gJ07Tfm06jAFcO97v9VmLvq 2zub/alv8m+QU99JxygnzsSvlBqLcnvPzmaEEVtofoaQFB3jwxu6Ll3W2IXlWVopXnQc Pn3EV3vbwgxxtRqMiQpaDA3dR6TwFtmjPdyui0q2WWwkiLg6cP3j6K7nlQzGzgaejRoI aNvzNqaO3kk3ZUIOnUE0htZAq3vokOzxgl6U7LuI9oSKoXvAC78ng7k6uIANfEekogbq W4DIW8SXZWtA6HvnzHQiJS7GejvH99MZ9VGNpqiKqAadXcnQN6NXFuhC3Tgz0BKKCS9b 2x0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764406933; x=1765011733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jJti1W24hnwF4OFg7cS4jWnw0eZv9xglyyGrmFluATQ=; b=Vn2fM1JnqKe/h5gvsjJiKUBQ5zk7+BuPliWw1iSR4IVAMxCvNjfhyT2VM9gZqggU9E eUQgmdOeaHEQWUTKssf9lhQHJY/pckpSkvPqidtf4Gr9gbCoQiQU7SWEAmAtu1jsNNCt EnTyz+KO0XrsYauWWsJRY2xCutnEpRnbL/FljmA0u7Y21FE4sq4I/Rp/Cse6M9m1/B4n gRC2wRe7CiDlCHzctahNbIvaq0DwggbiQFJ6J1HiBcYrhk9GTgVPRg5zVkwizjCE1dRd DHikpA0gzoxloKIKGWQIJN7f91ZCIFMQ9NDr2VSa+MYS63QvcPYs3cZ4rh/SlophykII tmMw== X-Forwarded-Encrypted: i=1; AJvYcCWC4A/Q/TRYGZvsEVSVawUA8XgdtS42Z0ot8JLX9tew6XU9D/Yo1QDIpstO9ENg4Yonv+BiaZ9VMex+DIU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6z1NtSa0A6RzckecZj94jVeKR7jvRyOvgw+1YU9zi52fLc30h F5pzkeGIAv2klwA09bVIYFD7i5jQN5yKZ5uK3D09EgQ3ZtA1XJLNRF9z X-Gm-Gg: ASbGncvDU5KHPU3DK7pA82xDokjdjK54D2d63kOhLuI39cqddsBoQzPWJ9aGVfVpA31 8DXIMS6cGdYTFLHyCm7YS12n4LzIF9WBLH2OUSBYu2m+KzJKtcN4RhfB29qhkRQFSthGh5k1bTE KBrN8l7FIsPbIKSvK392QE2gRD/wqwnZqzDbqXeIYoJiURYNR7d36TaJmIn7I8PnH+bkOClO/ED iYegv0BjXnZvv55W/aPlPnpxJuTicKoET/iRUXrYsoRfNNQbkrsFhH8IM0q1AWUxAQ6r3q1lKJW HaPrmNGgD+pkfvjzUTb56T2G5qkKcmenG/SrWnaLwtLlOvtwM7Ozn/Erpz4Nz6VSIv9iyoG2u8t HbIPsfBV6Gj5Nm1811NY7ptIwc3Ri9jaEDDQIvrkfk2SNzfF2n9tbDdqZ57aOq+TFSMQ7TmbzYm UawOjrPg+3sa4T1IODXruO0Qd47A== X-Google-Smtp-Source: AGHT+IFlPlVYDb7yoZVR+mp1/g2QkqJgugDSidMl3HlYfTA53/2piBoQC1SYt0i5BZxdW5Dqskhrig== X-Received: by 2002:a05:7022:3c84:b0:11b:9bbe:2aac with SMTP id a92af1059eb24-11c9d863a7dmr14635218c88.40.1764406932641; Sat, 29 Nov 2025 01:02:12 -0800 (PST) Received: from localhost.localdomain ([104.128.72.44]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcae73bedsm28114394c88.0.2025.11.29.01.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 01:02:12 -0800 (PST) From: zhangshida X-Google-Original-From: zhangshida To: Johannes.Thumshirn@wdc.com, hch@infradead.org, agruenba@redhat.com, ming.lei@redhat.com, hsiangkao@linux.alibaba.com, csander@purestorage.com Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev, virtualization@lists.linux.dev, ntfs3@lists.linux.dev, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangshida@kylinos.cn, starzhangzsd@gmail.com Subject: [PATCH v3 8/9] zram: Replace the repetitive bio chaining code patterns Date: Sat, 29 Nov 2025 17:01:21 +0800 Message-Id: <20251129090122.2457896-9-zhangshida@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20251129090122.2457896-1-zhangshida@kylinos.cn> References: <20251129090122.2457896-1-zhangshida@kylinos.cn> 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 Content-Type: text/plain; charset="utf-8" From: Shida Zhang Replace duplicate bio chaining logic with the common bio_chain_and_submit helper function. Signed-off-by: Shida Zhang --- drivers/block/zram/zram_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index a4307465753..084de60ebaf 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -730,8 +730,7 @@ static void read_from_bdev_async(struct zram *zram, str= uct page *page, bio =3D bio_alloc(zram->bdev, 1, parent->bi_opf, GFP_NOIO); bio->bi_iter.bi_sector =3D entry * (PAGE_SIZE >> 9); __bio_add_page(bio, page, PAGE_SIZE, 0); - bio_chain(bio, parent); - submit_bio(bio); + bio_chain_and_submit(bio, parent); } =20 static int zram_writeback_slots(struct zram *zram, struct zram_pp_ctl *ctl) --=20 2.34.1 From nobody Mon Dec 1 22:36:27 2025 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CACCB289811 for ; Sat, 29 Nov 2025 09:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406939; cv=none; b=Utq0RpjU6Bu8x4pQlK0FHDfwD0gB0aM5aFsuJXB/2lO6okG0fhxDJh1B11vVLwfwJtV/6xFDhPqcLUG0zxkjryzKCcT2a419xui0jCt913UlYNVryuFjqUTtQxCAoHkoJs+g21hqmT4rvhAu2aH4/teEuXlSDAQ0lRCsd2TWcMY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764406939; c=relaxed/simple; bh=MIUxfeIlXsLJb7D1x07khmxiQaV6FMQZLzsNI6cDMOY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OAMQ3GNa06ux0FPT6GOR8IVvpgWUvkLiZWT5zi4axdk4TOliTP/5dcNoUXTFvN66DFUwecvBkWigf0Tb+NM9XMdhQJRfs9ei4jYwYitVKYDLvc5gT8n/qJnQPwZhmv9aa70lopjRN4BkhbU8AKIhrXjbbUwy4MXG0purqsfxpyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LWAD7FOh; arc=none smtp.client-ip=209.85.215.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LWAD7FOh" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-bc274b8ab7dso1872713a12.3 for ; Sat, 29 Nov 2025 01:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764406937; x=1765011737; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rZsPDOjyUTRUehf6LhbOb026Dy93eapwVzPzgOc2prg=; b=LWAD7FOhwxa9hK+N/TjbMpaozNTbYaOFlFfBFIkFx3IRXMvFPQxK0dBvqeuprMX8hQ WtWIKhyhJdL7tgKbRz4kjA9XtQ0xCyuZ7Us8cRZuTSRdyYizUVED7L6DNAzm15FBB5+X G5asqaq3DDVlM/G0dBAPwI0DSmb1ll6qtEwsg2iCDXZi+WJJDMh8w+iMQwrmlH1fUp0M ZU8ghg2rx/1HT1LpWHFAMP66d0PvkRhjwjyR9UzTcYnZTtVjAi+zUY+A8WK5JSkbXJwd i6e5F7qsIkGgfsqQ4oj8zEgP7PtrSoMRVbyWUr+snjj7SZqW95SR+gLU9WacDEe61W7m +8+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764406937; x=1765011737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rZsPDOjyUTRUehf6LhbOb026Dy93eapwVzPzgOc2prg=; b=QE8fJam4PXnuZAH8aDbL1r4xXdm4xbpCK6oc5QFNJhbrp04CYQ7zl9EhZj3VrcUf/N L1sB8LpVMyVPzDDDVAygQRo1qHTfZmYEb3f3qVRTHqat5IYY9dPq0k7uQUslK+ioQDfV otqscFf/0GOXmwTqnVH7GyOHwu6hmUrnYly9JTgZL3rqco40mDurvrqUf5qhNsgWsPiT 9QuVPr7VJOWYK9IGNQaCYFsGFPJzl0mxJcz66Mm6SwCG/Hk7V+e+lEH6Bi1Pnepo5Hb/ +ziGjNQUvG58eFL2+m4aGOSMccdaD9+Mf7dvvwwh1uV7RNbtSx2MDKyErJg14sSvKirI hFXw== X-Forwarded-Encrypted: i=1; AJvYcCX/LdpO8dsfZkcBKA8SyowmISLyCHcpR4JCZVH2+mAjtfGlILhLQw3wc9TDSc2HC00mQOqyhwOorsllU4g=@vger.kernel.org X-Gm-Message-State: AOJu0Yym4Ld+FnKsJblFDPFCYOqd3UO4Bev4jHk5VClSKgkCUM7VZGGJ CZSS4RRSaqWXgvK5TyNyl53TO3JCGeFFCRYeh1A983cyDvhLY8Tulqnn X-Gm-Gg: ASbGncsArCvgsj9OEK47m6yZffKRgYeZgFZ2XjBKp+IFkT9Wr8OQGlGZAAvTFGV1Cx+ of+atJSyfQfDJh3geT+g2TN4+iYqPvEmL91A47DEl5cikjXqi3e0t2qRVZBdVdzMtiiPzN6s6Bc O2yAjX1Rq/RysHOX9uMjPrAv2E0l6y+z8aaeOqpQdE6WxEX3sTY7XK+LXcL0aXqSl5tyMrAEOFX CUcpx5U6sk0iWye4chanh53HbzfZpNUrGChCNnPL0SC1z9MSMCLcveSNQDMmUk6vpWW7dB9WP+q lUWKck7Igj2J050cI+r9ujUn4MZu3JrFY6XF5jv10LEGffWtl6lfKCWuhmzvHShXNcnne5glvue wHrNg3z45PsJ43trlOvCXWFBPRDS3OUWB4erLUuzOIvi5dTa4qDvahFcBLkrGDhbtXbnTM5oTaU 5ftHkuWIIESUbiNLZLGQ1yQcqdW0oR5mDIdY65 X-Google-Smtp-Source: AGHT+IHpE1uuYkahAmmHKZA5JS6JfSHwBl8orO/VCsXf8iMEXJ8J7PutjW87+hKd6ib1GUoYGhEBPQ== X-Received: by 2002:a05:7022:41:b0:11b:b1ce:277a with SMTP id a92af1059eb24-11c9d8482b1mr17984181c88.28.1764406937164; Sat, 29 Nov 2025 01:02:17 -0800 (PST) Received: from localhost.localdomain ([104.128.72.44]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcae73bedsm28114394c88.0.2025.11.29.01.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 01:02:16 -0800 (PST) From: zhangshida X-Google-Original-From: zhangshida To: Johannes.Thumshirn@wdc.com, hch@infradead.org, agruenba@redhat.com, ming.lei@redhat.com, hsiangkao@linux.alibaba.com, csander@purestorage.com Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, nvdimm@lists.linux.dev, virtualization@lists.linux.dev, ntfs3@lists.linux.dev, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangshida@kylinos.cn, starzhangzsd@gmail.com Subject: [PATCH v3 9/9] nvdimm: Replace the repetitive bio chaining code patterns Date: Sat, 29 Nov 2025 17:01:22 +0800 Message-Id: <20251129090122.2457896-10-zhangshida@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20251129090122.2457896-1-zhangshida@kylinos.cn> References: <20251129090122.2457896-1-zhangshida@kylinos.cn> 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 Content-Type: text/plain; charset="utf-8" From: Shida Zhang Replace duplicate bio chaining logic with the common bio_chain_and_submit helper function. Signed-off-by: Shida Zhang --- drivers/nvdimm/nd_virtio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvdimm/nd_virtio.c b/drivers/nvdimm/nd_virtio.c index c3f07be4aa2..e6ec7ceee9b 100644 --- a/drivers/nvdimm/nd_virtio.c +++ b/drivers/nvdimm/nd_virtio.c @@ -122,8 +122,7 @@ int async_pmem_flush(struct nd_region *nd_region, struc= t bio *bio) return -ENOMEM; bio_clone_blkg_association(child, bio); child->bi_iter.bi_sector =3D -1; - bio_chain(child, bio); - submit_bio(child); + bio_chain_and_submit(child, bio); return 0; } if (virtio_pmem_flush(nd_region)) --=20 2.34.1