From nobody Tue Feb 10 07:41:10 2026 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (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 5116E3382FD; Wed, 28 Jan 2026 08:06:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769587584; cv=none; b=b6tStkieRRNM4xmpdjV9AXUIWX6AVgja1gg2bEghfXcZKYdYoqtNBTq58+umcitiCmXYzFDraEajrJtSSaFlmVqv+PFZ3YWpUgh9AXerNJnzHnxrO5nY76JJTbK9NXvPY/xPh5Cih8jRTcrjv8MeN9yKfZj8NAFBA9FzrpqnJeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769587584; c=relaxed/simple; bh=P7q+SzrHydbwifHaFnCM6yPStt0p95CAPZ/FR56oykk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=a4RRepPogvCVzNcswO5tBD6MGValDDUzk7+Gj9+KMf9honBGIq2RhajMQTEXWxSFlO0cPM/iVUgz+09OORPz6hI+NP+nUAfvOVTOGbBG2itYFKqQTZIwy2kE1FrvQ/QXnyLXHDekpucS52ed4Go2JgQGLKwFR6H97AHm4GpQNRY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=none smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.170]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4f1FG23D32zKHMlK; Wed, 28 Jan 2026 16:06:02 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 9FB394056E; Wed, 28 Jan 2026 16:06:14 +0800 (CST) Received: from huaweicloud.com (unknown [10.50.87.129]) by APP4 (Coremail) with SMTP id gCh0CgBnFvd1w3lpPgyWFQ--.43207S12; Wed, 28 Jan 2026 16:06:14 +0800 (CST) From: linan666@huaweicloud.com To: song@kernel.org, yukuai@fnnas.com Cc: xni@redhat.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, linan666@huaweicloud.com, yangerkun@huawei.com, yi.zhang@huawei.com Subject: [PATCH v2 08/14] md/raid1: fix IO error at logical block size granularity Date: Wed, 28 Jan 2026 15:57:02 +0800 Message-Id: <20260128075708.2259525-9-linan666@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20260128075708.2259525-1-linan666@huaweicloud.com> References: <20260128075708.2259525-1-linan666@huaweicloud.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-CM-TRANSID: gCh0CgBnFvd1w3lpPgyWFQ--.43207S12 X-Coremail-Antispam: 1UD129KBjvJXoW7ur15uFW3ZFy5ArW8WF4fAFb_yoW8Zr1kpa 13GrZYvr4UGrWjyw4DAryqy3WFkaySyFWUGrs5W39F9FyDZ3sIgFyUKFWYgFy0kr9ayayU Wwnrtr48C3W7tF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUQ014x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAac4AC62xK8xCEY4vEwIxC4wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0V AKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Gr1j6F4U JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20V AGYxC7M4kE6xkIj40Ew7xC0wCY1x0262kKe7AKxVWUAVWUtwCF04k20xvY0x0EwIxGrwCF x2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14 v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY 67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI 8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v2 6r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUYVyIDUUUU X-CM-SenderInfo: polqt0awwwqx5xdzvxpfor3voofrz/ Content-Type: text/plain; charset="utf-8" From: Li Nan RAID1 currently fixes IO error at PAGE_SIZE granularity. Fix at smaller granularity can handle more errors, and RAID will support logical block sizes larger than PAGE_SIZE in the future, where PAGE_SIZE IO will fail. Switch IO error fix granularity to logical block size. Signed-off-by: Li Nan Reviewed-by: Yu Kuai --- drivers/md/raid1.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 2308e16b1280..27e3b2375b16 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2114,7 +2114,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio) { /* Try some synchronous reads of other devices to get * good data, much like with normal read errors. Only - * read into the pages we already have so we don't + * read into the block we already have so we don't * need to re-issue the read request. * We don't need to freeze the array, because being in an * active sync request, there is no normal IO, and @@ -2145,13 +2145,11 @@ static int fix_sync_read_error(struct r1bio *r1_bio) } =20 while(sectors) { - int s =3D sectors; + int s =3D min_t(int, sectors, mddev->logical_block_size >> 9); int d =3D r1_bio->read_disk; int success =3D 0; int start; =20 - if (s > (PAGE_SIZE>>9)) - s =3D PAGE_SIZE >> 9; do { if (r1_bio->bios[d]->bi_end_io =3D=3D end_sync_read) { /* No rcu protection needed here devices @@ -2190,7 +2188,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio) if (abort) return 0; =20 - /* Try next page */ + /* Try next block */ sectors -=3D s; sect +=3D s; off +=3D s << 9; @@ -2388,14 +2386,11 @@ static void fix_read_error(struct r1conf *conf, str= uct r1bio *r1_bio) } =20 while(sectors) { - int s =3D sectors; + int s =3D min_t(int, sectors, mddev->logical_block_size >> 9); int d =3D read_disk; int success =3D 0; int start; =20 - if (s > (PAGE_SIZE>>9)) - s =3D PAGE_SIZE >> 9; - do { rdev =3D conf->mirrors[d].rdev; if (rdev && --=20 2.39.2