Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4302401pxb; Tue, 2 Mar 2021 11:30:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrOXFA+ecQtLNO6mww95SmOJmxFQ1snTuP/AcM6Lf5EpID8aIuAOmP5iVYqoJrRxyH+RpM X-Received: by 2002:aa7:dd49:: with SMTP id o9mr21862464edw.14.1614713419912; Tue, 02 Mar 2021 11:30:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614713419; cv=none; d=google.com; s=arc-20160816; b=KbuanNjQ/vIg+9Bv537DKycIMv/n16THvoNuxhtWdgFgQZT+sOdBtvpqafZ+2nKfgg TGBWMXg6xtGk8LEIibqUSQths2+6NQ1y8rJM3sa/1fMSwDpfHlSllA/ZeAK6pP28AsXC eVgRJsEJeve4qpi2UKTdOypjaVp9nd/UjuEIQPp/HvO5o0kbgL1MeeVmsKKRTm490US0 atfFkr+ZSXF8MbjUGUbMzSLKVEYcOkXyBZTXXQvpVZTjSaBP+up2Hp0WhgMgldCZtIiq 5k7NpD1ZCXj67U/e1bASZOjP7VrmWJ3Lij3KnFDOFmCY9EuYX3vs1GnCXqvcErUYTAf2 Le2g== 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=VdP9esQaO1lq5oegFb5BLYf1fMPbYV5ZKLFTOJ1zCs4=; b=euPBBzi0/sRRGvX+6PRyooVsJrMUHN/Dj2nbe4sbicUugAK0uto7ISJnR/mLyzBegC +1yNNNLZlr1J4lcuFVIfDz1Q2ScS/etzBqJWTalp4vzPfPwBck8UGYLcOV2Pe90YcA00 PxO/oAst1bWEdsECxpJHaiP/HhKItCA+EUsJyBghBL4GAPqplROZ9Y5Etpi6RYGURr1d 1VxS53rGAhK9zj/HRee8pjsgk8CzRRtpjUO8aFlS9UXr3I+bryhTIwTiYaThkm4QlCf1 MahZTF074xM3AYD1wulnb8A+5rY7Q509ggY7ewIsSYrnNv1y/Hba/6+acYeeQ21T4qPj Ea+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w16si4622086edv.532.2021.03.02.11.29.55; Tue, 02 Mar 2021 11:30:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577381AbhCBGVf (ORCPT + 99 others); Tue, 2 Mar 2021 01:21:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:39242 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235811AbhCBEHs (ORCPT ); Mon, 1 Mar 2021 23:07:48 -0500 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 Cc: antlists@youngman.org.uk, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, linux-nvdimm@lists.01.org, Coly Li 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.26.2