From patchwork Tue Mar 2 04:02:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coly Li X-Patchwork-Id: 12110963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_40, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E272C433DB for ; Tue, 2 Mar 2021 04:03:05 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF8BA61490 for ; Tue, 2 Mar 2021 04:03:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF8BA61490 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7E9B4100EBB97; Mon, 1 Mar 2021 20:03:04 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=195.135.220.15; helo=mx2.suse.de; envelope-from=colyli@suse.de; receiver= Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0204A100EBB8F for ; Mon, 1 Mar 2021 20:03:01 -0800 (PST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 59F06AD74; Tue, 2 Mar 2021 04:03:00 +0000 (UTC) From: Coly Li To: linux-block@vger.kernel.org, axboe@kernel.dk, dan.j.williams@intel.com, vishal.l.verma@intel.com, neilb@suse.de Subject: [RFC PATCH v1 0/6] badblocks improvement for multiple bad block ranges Date: Tue, 2 Mar 2021 12:02:46 +0800 Message-Id: <20210302040252.103720-1-colyli@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Message-ID-Hash: YRG2PLQSTINYL7Y3A4WNDE2CUITUA3O4 X-Message-ID-Hash: YRG2PLQSTINYL7Y3A4WNDE2CUITUA3O4 X-MailFrom: colyli@suse.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: antlists@youngman.org.uk, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, linux-nvdimm@lists.01.org, Coly Li X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: This is the first completed effort to improve badblocks code to handle multiple ranges in bad block table. There is neither in-memory nor on-disk format change in this series, all existing API and data structures are consistent. This series just only improve the code algorithm to handle more corner cases, the interfaces are same and consistency to all existing callers (md raid and nvdimm drivers). The original motivation of the change is from the requirement from our customer, that current badblocks routines don't handle multiple ranges. For example if the bad block setting range covers multiple ranges from bad block table, only the first two bad block ranges merged and rested ranges are intact. The expected behavior should be all the covered ranges to be handled. All the patches are tested by modified user space code and the code logic works as expected. Kernel space testing and debugging is on the way while I am asking help for code review at the same time. The whole change is divided into 6 patches to make the code review more clear and easier. If people prefer, I'd like to post a single large patch finally after the code review accomplished. Thank you in advance for any review comment and suggestion. Coly Li (6): badblocks: add more helper structure and routines in badblocks.h badblocks: add helper routines for badblock ranges handling badblocks: improvement badblocks_set() for multiple ranges handling badblocks: improve badblocks_clear() for multiple ranges handling badblocks: improve badblocks_check() for multiple ranges handling badblocks: switch to the improved badblock handling code block/badblocks.c | 1591 ++++++++++++++++++++++++++++++------- include/linux/badblocks.h | 32 + 2 files changed, 1332 insertions(+), 291 deletions(-)