Message ID | 20230621172052.1499919-5-linan666@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4231261vqr; Wed, 21 Jun 2023 02:26:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4X710+1hYtatKz0mLsYyxLcC0eO3rBIYhxoacciCuBxhEDX6WPPGnDzStWPhCihERrWtWG X-Received: by 2002:a05:6808:210a:b0:39e:db27:ed90 with SMTP id r10-20020a056808210a00b0039edb27ed90mr9848543oiw.42.1687339589761; Wed, 21 Jun 2023 02:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687339589; cv=none; d=google.com; s=arc-20160816; b=0PfW1HuGc4f5YMB8BonW8BAc3+hJ5ZQd6snhY91y8d8VWAb2YlkUqmeItf2Rli8Zrc g7xqZ/wkyK/bRvww47ytDegEi5qxpei3PSKh6HJQF/qz2N8ppu8YX5/xUNs1N351uiwt p7vtCa/73LxDTVBlTgOXoYRt+KJRnU0Iq48MVg7Obz8uvmtM0m6tNA8KCA8E+KZ1m+Op psYG5eSKNrj2jA05c67CSc61YKI7bpu7JiBTLjneiuU1Q7UI3apgEbPZIBHk5CrRrgY8 YVqthQur5t6+PdGznqtHtZ62VAu2oarhYEKps4YQMxyPLVHWERCZJ5qY5KLIUbPOWseE 3spg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=4HLLx2Ci1bAFvnEL0yqzYMsCH/mD87xt8jeDw81tUMM=; fh=zHCeR/KsP2aMeS3HJk6XuouCoRr2YKVXFMwwJxtsg9s=; b=z1LR/fwHIPgBAnzx8qmJXGkV4drZWYmZkW8ujP4Xwdkj/gqiqicArRj74ToiKfSXOD ghTEWfC897ADoava9JcKZuYtm28I2cl+lRjlURc0v6an9JA9zE6pU2KIzmVCSdaGilkW iS3QBiyTIVWnsoYi7iYpCBiyrJPVq3fTycRmWufGf9bwOtRfh5dPylC6G5Skf06RfqlJ YCIj3GwQmkBapRt5NIos39adnPibMfj3XiGST4kkrQh07xTjvhzsoiKjlOLjuKKp3Dgh 3ZHjxoqJeFS+JBY+3hGkkW6qFhrPx2s4DJ1ql9flbUF7apGFXkt7jNMq53g6mD+r8GYe VxXg== 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 h5-20020a17090adb8500b0024b9e5aa258si1281478pjv.0.2023.06.21.02.26.15; Wed, 21 Jun 2023 02:26:29 -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 S231298AbjFUJWe (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Wed, 21 Jun 2023 05:22:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbjFUJW1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 21 Jun 2023 05:22:27 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB85D10F9; Wed, 21 Jun 2023 02:22:26 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QmJ1W2gmNz4f3yYb; Wed, 21 Jun 2023 17:22:23 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCHLaFMwZJk+OrGMA--.39130S8; Wed, 21 Jun 2023 17:22:24 +0800 (CST) From: linan666@huaweicloud.com To: axboe@kernel.dk, linan122@huawei.com, dan.j.williams@intel.com, vishal.l.verma@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 v3 4/4] block/badblocks: fix the bug of reverse order Date: Thu, 22 Jun 2023 01:20:52 +0800 Message-Id: <20230621172052.1499919-5-linan666@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621172052.1499919-1-linan666@huaweicloud.com> References: <20230621172052.1499919-1-linan666@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgCHLaFMwZJk+OrGMA--.39130S8 X-Coremail-Antispam: 1UD129KBjvdXoWrKFyruF1kuw1xKr4DWr1UGFg_yoWfAFX_J3 4vyFW8Xrn5JFnIkw1SyFy0yF4FvFW5Cr18Kry7Arn7Za1Utan5AwsxKr98Xrn8GFy7G3sI yr93Xryavr4IqjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbQ8YFVCjjxCrM7AC8VAFwI0_Wr0E3s1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l87I20VAvwVAaII0Ic2I_JFv_Gryl82 xGYIkIc2x26280x7IE14v26r126s0DM28IrcIa0xkI8VCY1x0267AKxVW5JVCq3wA2ocxC 64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM2 8EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq 3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s1lnxkEFVAIw20F6cxK64vIFxWle2I262 IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAF wI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0x vY0x0EwIxGrwACI402YVCY1x02628vn2kIc2xKxwAKzVCY07xG64k0F24l42xK82IYc2Ij 64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x 8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE 2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42 xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF 7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUsVWlDUUUU X-CM-SenderInfo: polqt0awwwqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, KHOP_HELO_FCRDNS,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769303797987412234?= X-GMAIL-MSGID: =?utf-8?q?1769303797987412234?= |
Series |
block/badblocks: fix badblocks setting error
|
|
Commit Message
Li Nan
June 21, 2023, 5:20 p.m. UTC
From: Li Nan <linan122@huawei.com> Order of badblocks will be reversed if we set a large area at once. 'hi' remains unchanged while adding continuous badblocks is wrong, the next setting is greater than 'hi', it should be added to the next position. Let 'hi' +1 each cycle. # echo 0 2048 > bad_blocks # cat bad_blocks 1536 512 1024 512 512 512 0 512 Fixes: 9e0e252a048b ("badblocks: Add core badblock management code") Signed-off-by: Li Nan <linan122@huawei.com> --- block/badblocks.c | 1 + 1 file changed, 1 insertion(+)
Comments
On Thu, Jun 22, 2023 at 01:20:52AM +0800, linan666@huaweicloud.com wrote: > From: Li Nan <linan122@huawei.com> > > Order of badblocks will be reversed if we set a large area at once. 'hi' > remains unchanged while adding continuous badblocks is wrong, the next > setting is greater than 'hi', it should be added to the next position. > Let 'hi' +1 each cycle. The commitlog needs more work. > > # echo 0 2048 > bad_blocks > # cat bad_blocks > 1536 512 > 1024 512 > 512 512 > 0 512 Is the above before or after this patch is applied? > > Fixes: 9e0e252a048b ("badblocks: Add core badblock management code") > Signed-off-by: Li Nan <linan122@huawei.com> > --- > block/badblocks.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/block/badblocks.c b/block/badblocks.c > index 2c2ef8284a3f..3b816690b940 100644 > --- a/block/badblocks.c > +++ b/block/badblocks.c > @@ -301,6 +301,7 @@ int badblocks_set(struct badblocks *bb, sector_t s, int sectors, > p[hi] = BB_MAKE(s, this_sectors, acknowledged); > sectors -= this_sectors; > s += this_sectors; > + hi++; > changed = true; > } > } > -- > 2.39.2 >
在 2023/6/21 22:15, Ashok Raj 写道: > On Thu, Jun 22, 2023 at 01:20:52AM +0800, linan666@huaweicloud.com wrote: >> From: Li Nan <linan122@huawei.com> >> >> Order of badblocks will be reversed if we set a large area at once. 'hi' >> remains unchanged while adding continuous badblocks is wrong, the next >> setting is greater than 'hi', it should be added to the next position. >> Let 'hi' +1 each cycle. > > The commitlog needs more work. OK, I will improve this. >> >> # echo 0 2048 > bad_blocks >> # cat bad_blocks >> 1536 512 >> 1024 512 >> 512 512 >> 0 512 > > Is the above before or after this patch is applied? All badblocks are arranged from small to large. after patch: # cat bad_blocks 0 512 512 512 1024 512 1536 512 I will show it in next version. Thanks for your suggestion. > >> >> Fixes: 9e0e252a048b ("badblocks: Add core badblock management code") >> Signed-off-by: Li Nan <linan122@huawei.com> >> --- >> block/badblocks.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/block/badblocks.c b/block/badblocks.c >> index 2c2ef8284a3f..3b816690b940 100644 >> --- a/block/badblocks.c >> +++ b/block/badblocks.c >> @@ -301,6 +301,7 @@ int badblocks_set(struct badblocks *bb, sector_t s, int sectors, >> p[hi] = BB_MAKE(s, this_sectors, acknowledged); >> sectors -= this_sectors; >> s += this_sectors; >> + hi++; >> changed = true; >> } >> } >> -- >> 2.39.2 >> > > .
diff --git a/block/badblocks.c b/block/badblocks.c index 2c2ef8284a3f..3b816690b940 100644 --- a/block/badblocks.c +++ b/block/badblocks.c @@ -301,6 +301,7 @@ int badblocks_set(struct badblocks *bb, sector_t s, int sectors, p[hi] = BB_MAKE(s, this_sectors, acknowledged); sectors -= this_sectors; s += this_sectors; + hi++; changed = true; } }