From patchwork Thu May 4 12:48:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Nan X-Patchwork-Id: 8923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp288782vqo; Thu, 4 May 2023 05:51:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ht+aWFo7/8cqhYxzYb7KrBC2udpDismzk3dYancQKnCXT+AASdyaMPVrm73lprHNOo7iR X-Received: by 2002:a05:6a00:2393:b0:63a:fae3:9890 with SMTP id f19-20020a056a00239300b0063afae39890mr2732020pfc.24.1683204671435; Thu, 04 May 2023 05:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683204671; cv=none; d=google.com; s=arc-20160816; b=l8R7YHt+QJQ21fqoemkFtz/b0fTKlwcS5JhTIgcfE7P3UoNL5HcfMuyeFtXule6n/k 68tZZVRqDODrfGMGaNjaNBzfExVqC2wF2JvugSgJRWIFkFswAYus+HaFSzpS5W6tPdbX uFJ901s5uqYjA3gK+lVcWNfEx0ZjsssxXAYsuqqUnU6nY68a/los1QKORnntP5eQy4+I D9l262YfhvrWDDuK7dP22FhVkDzzdGfSVB47M0mO40xUDyMgWXerZgeZh1U1T5YiO5U1 wnZG3AUIReumKb6vOCgyptQGGiZGNXA9SYpwrwnkr3a9PNRhAe5ehv8PrDRwLPbJ1w3P xM8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=HN5nJIswHBBQm6SkmYc7ByRiRQq3k97FqQKMqliUIcM=; b=UKc1uV/0dSXbfLABgxYFJJMrbqjN2gku5oQRAdOFdBelc+M6aDk5PBhKf3DV9ZCHlA EJX1hY37jTb7V7AYTi76s3Zpz/ufWaf0HkqLfQH0uxKZcDR2PY8l74cDmUzhgAcxJL6U iulbjL+EkMZaAr8QemHhlRxEnltw8GRPwVRaUK/8oJQL/GnVUrUI1HsbodnMNVN2wF3r x1odMAoOKb/NU/IYQ74UCsxc0ZHpmtHUI6so1GcaIPHYeuZ7djBQsQJ6rke6ZYEU5JXH L8ZJ/F5gxE9ziiyJOAc/lpOytCIb8G+wL1Zc2+BS91h6WJ3g7wv+xW5IKL9+1vUEWp3D 4ntg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a626205000000b00624ac1abef6si37001463pfb.218.2023.05.04.05.50.59; Thu, 04 May 2023 05:51:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230421AbjEDMtw (ORCPT + 99 others); Thu, 4 May 2023 08:49:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230392AbjEDMtt (ORCPT ); Thu, 4 May 2023 08:49:49 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 140646A5E; Thu, 4 May 2023 05:49:38 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QBttk3dS1z4f3tPG; Thu, 4 May 2023 20:49:34 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgBnHbHdqVNkzuf5Ig--.27873S4; Thu, 04 May 2023 20:49:35 +0800 (CST) From: linan666@huaweicloud.com To: axboe@kernel.dk, linan122@huawei.com, vishal.l.verma@intel.com, dan.j.williams@intel.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com Subject: [PATCH v2 00/11] block/badblocks: fix badblocks setting error Date: Thu, 4 May 2023 20:48:17 +0800 Message-Id: <20230504124828.679770-1-linan666@huaweicloud.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBnHbHdqVNkzuf5Ig--.27873S4 X-Coremail-Antispam: 1UD129KBjvdXoW7Gr4DJFWfJF4xKr1kXw48Crg_yoWkXrb_J3 4vyF95GFsYq3W5Aa1ayF1UJrZ3tF4UCr1qka4UArn7Xr17ta1DXw45Jr48Xrn8GFyUJwsx Zr95Xr1rXw1xtjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUba8YFVCjjxCrM7AC8VAFwI0_Gr0_Xr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwV A0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x02 67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I 0E14v26rxl6s0DM2vYz4IE04k24VAvwVAKI4IrM2AIxVAIcxkEcVAq07x20xvEncxIr21l 5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67 AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lFIxGxcIEc7Cj xVA2Y2ka0xkIwI1lw4CEc2x0rVAKj4xxMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4 AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE 17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMI IF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_WFyUJVCq 3wCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcS sGvfC2KfnxnUUI43ZEXa7IU1kpnJUUUUU== X-CM-SenderInfo: polqt0awwwqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764968021251411484?= X-GMAIL-MSGID: =?utf-8?q?1764968021251411484?= From: Li Nan The patch series fix the bug of setting badblocks, which may not match expectations in complex scenarios. Optimize the code to make it more readable at the same time. Changes in v2: - add missing patch "block/badblocks: change some members of badblocks to bool" Li Nan (11): block/badblocks: change some members of badblocks to bool block/badblocks: only set bb->changed when badblocks changes block/badblocks: fix badblocks loss when badblocks combine block/badblocks: fix badblocks overlap block/badblocks: fix the bug of reverse order block/badblocks: fix ack set fail in badblocks_set block/badblocks: check bb->count instead of 'hi > lo' block/badblocks: factor out a helper to merge badblocks block/badblocks: factor out a helper to combine badblocks block/badblocks: factor out a helper to create badblocks block/badblocks: try to merge badblocks as much as possible block/badblocks.c | 310 +++++++++++++++++++++++--------------- include/linux/badblocks.h | 10 +- 2 files changed, 197 insertions(+), 123 deletions(-)