Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9464672rwd; Wed, 21 Jun 2023 07:48:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6FpK4zYegylwPm6j0BgNjkpvIlLFvhtVmfyHap/eYKnZTNj4hD6bZIGMx2wEDvSYE97+nz X-Received: by 2002:a17:902:c1c6:b0:1b5:113e:2ea6 with SMTP id c6-20020a170902c1c600b001b5113e2ea6mr10911851plc.56.1687358881508; Wed, 21 Jun 2023 07:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687358881; cv=none; d=google.com; s=arc-20160816; b=tRg5ybS2KTLwFShk8PFpTkqpVRs/nIUBFxzQ3hp5R9MJqpF4z3JNLCtaUcPVoj2qWX oV/u3zsXXgkMGhtekq247NyXgOfW+9Zh6gXEK8rg2EvPnId1MORDbvIDGS6E90Hlte7T HfRQ+b0npZHFxL9fL8gjIzZ6rWzFy5OwJH6LgZ6h/XAyHmBABY/KIxwsulU1OQ1G26Xs OqJoCXKN0eVbvsSnKGllsGkwNrG6VZxxsbRYVtgU2pP9vRtcO9lCznH2is6DRaN8d+ax PZ1m23J3a6SXTCgTTSb8mHlgxg9hir1uUJuOYqxpqsxk/VnMvg4UJYI5374N5LJg4ii6 ME5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nu9W97MYlXazA6rUY7O8UN2bTemXBX5HJY5Cz3DQrwo=; b=AzMOK9t19yf06EnGw4pnItXf2nl/7sT6h0MJEZB3wB4fLfYqcbKTSVSP/J3E2ZWEmB dh84YhZpXUrtluP8mI+EqFrGwtAmDV5OpG5bvOuVDTC4VimtRVs/QUs9vH8QYLvwZHn0 vX+q+W7JxFSQWI9Sn51EETPoKZrXkNPYaXAraqR8JOQhzfJn1me3QmkCy02fwD533FWi FFidVS/hDU5bGGFoWEukmkImhbpRtX+EKSdSbWD2LGwdwn9lOiopXyQeHu/7hn3neXiV cqDQgTLqQD6kZ5EVs/cRp0zzf3RWSH4RJo+T/1ug+CLWZiuxCGkYzSphSVx2FPjXqveT QZsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zc6yjTwb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jn22-20020a170903051600b001b5497b0030si4196688plb.97.2023.06.21.07.47.47; Wed, 21 Jun 2023 07:48:01 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=Zc6yjTwb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232560AbjFUOR2 (ORCPT + 99 others); Wed, 21 Jun 2023 10:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232694AbjFUOR0 (ORCPT ); Wed, 21 Jun 2023 10:17:26 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA19294; Wed, 21 Jun 2023 07:17:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687357045; x=1718893045; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=rqIpWeE4xesI6qrEd6LN7Ec+WOzNpkbsOTd3PZCftzA=; b=Zc6yjTwbWtt9aXwEbSGrCbvL0ZtZ7Isjnu+B9IzUwFaX6Th9Hoqix9xW QHiZhS0zbILmSes9MZ7viH6BFf747mVU4ljQY4n6WwGXeFhpKxzbs5OH7 wUKVqjN/R8X9lonODiL45IGWqwlaMvA/vp+/vN7Mcq2+UU17wISCMrZcG SkXzXgU2snq0LqMZ0jo4EyO6cubHyBvvR4Zbg0Ytk5AtF9sFv+uP01g2j aeX8sSUUZZ2q2ZVeRt6hrt5eyEfQMXU3gToBxNi8rqPvN0uq51cZKeBWJ BcfMNx0/eCGX6ES4VbTR263t6q+0pMsG24o8OXEsoBvEPkO/tgUxp/dMM Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="363606395" X-IronPort-AV: E=Sophos;i="6.00,260,1681196400"; d="scan'208";a="363606395" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2023 07:17:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="744186433" X-IronPort-AV: E=Sophos;i="6.00,260,1681196400"; d="scan'208";a="744186433" Received: from araj-dh-work.jf.intel.com (HELO araj-dh-work) ([10.165.157.158]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2023 07:17:18 -0700 Date: Wed, 21 Jun 2023 07:15:40 -0700 From: Ashok Raj To: linan666@huaweicloud.com Cc: axboe@kernel.dk, linan122@huawei.com, dan.j.williams@intel.com, vishal.l.verma@intel.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com, Ashok Raj Subject: Re: [PATCH v3 4/4] block/badblocks: fix the bug of reverse order Message-ID: References: <20230621172052.1499919-1-linan666@huaweicloud.com> <20230621172052.1499919-5-linan666@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230621172052.1499919-5-linan666@huaweicloud.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Thu, Jun 22, 2023 at 01:20:52AM +0800, linan666@huaweicloud.com wrote: > From: Li Nan > > 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 > --- > 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 >