Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3748308pxb; Mon, 27 Sep 2021 01:26:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWgrQi6VHJFomiqLgn+mKmJnaCvu1SWcM9RN45hr9ZrRNrabb62LJbtTA6nyDaXgqCDt54 X-Received: by 2002:aa7:dbca:: with SMTP id v10mr7693729edt.280.1632731185027; Mon, 27 Sep 2021 01:26:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632731185; cv=none; d=google.com; s=arc-20160816; b=MDcslM3Hvfc4mUfJs3QGHINbPaoHqATwEe7elit9Hh7MKAJFNhsFGgS0b2FVYwG+Ud WUG1EaAh/gw73Q/jFvSYUAIOG3zC0ihBjKDzHK/OGIGHyHJCZe/ZPG7l3hIWNgNu63eY HIGZoaoQBjc+deIYaHo1OS7ts9EybOG34BUx8XMLqgAD95gJycpuKAicQqn6sG1UdmxD ykHnoAc9tTFTnFfG2a9l/Vlg6E799l0X8SwnnYhnEJ1lbkGhCh96d7ZELD5Ws0cn03QI AQEv33eOmTRD/QPsBBhGd2IWRRGHpEICMzFphiZlnXDfltg7N93UIlNlgYfBJyWTQ+B6 VR+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature; bh=37o9ue6D55euseY87j2eVtMIU2ZEOiSWr0h3uppibpo=; b=B2FE2GMUcU+UmKjJ4o1kN9Qt8YdU2p/6WVdLWcd5B8hcEpd+P6JHSvPB5+UEf4/SCt oGE2g6cFOdkQ080/Z4lGdiESJZAkG7fzRUealUwqpQsTJqCxdK3/NTKjUashoI64sHnI wAPrCFlIdD/JIH05hpUWIjlR06vR7G/NqdK72zZIacRIqonoYkVOdGT+Hl9asC0oI7Ft Eot7aHQltYp/zcKasE5vk+9+HtOipvDbHwcLxGQovNBH5fF1imnhDndKHARr7AW27rpC dAFo0n+rIVu5QW7Z/ruiw4C2QR0LeBzAuLXToeVnCuv94MguLcuVd3zzY/aWTly9ljG1 e/NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mEmCCoa0; dkim=neutral (no key) header.i=@suse.de; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h17si2500586ede.473.2021.09.27.01.26.02; Mon, 27 Sep 2021 01:26:25 -0700 (PDT) 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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mEmCCoa0; dkim=neutral (no key) header.i=@suse.de; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233442AbhI0IZ3 (ORCPT + 99 others); Mon, 27 Sep 2021 04:25:29 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:53284 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233337AbhI0IZ2 (ORCPT ); Mon, 27 Sep 2021 04:25:28 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0979D22098; Mon, 27 Sep 2021 08:23:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1632731030; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=37o9ue6D55euseY87j2eVtMIU2ZEOiSWr0h3uppibpo=; b=mEmCCoa0naAO9rk9L+BWrTdgk5YyRGEv2i7pHHtnBn/1JVcWsTME3v//EfgkuFmg2tK6WX eKJyywKRLghT3BAj+3YGyt5iCDsMWiO3tNq2tAXkOOjsVvxhevMfx0A7DSckyzruz4f5O5 6N2WE65afKo51F8kjRzsO5i/SZG0LnA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1632731030; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=37o9ue6D55euseY87j2eVtMIU2ZEOiSWr0h3uppibpo=; b=NsvW0sX2DUOMXz8fou8QufETZ23R0NJX0guAOpKhK3DsWM5cfAUmxlsrXsNpfOa9mUDfS2 KvhBVZsWiRKF2uDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2218913A42; Mon, 27 Sep 2021 08:23:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 9/86OJJ/UWEzSwAAMHmgww (envelope-from ); Mon, 27 Sep 2021 08:23:46 +0000 Subject: Re: [PATCH v3 1/6] badblocks: add more helper structure and routines in badblocks.h To: Geliang Tang Cc: antlists@youngman.org.uk, Dan Williams , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hannes Reinecke , Jens Axboe , NeilBrown , nvdimm@lists.linux.dev, linux-raid@vger.kernel.org, Richard Fan , Vishal L Verma References: <20210913163643.10233-1-colyli@suse.de> <20210913163643.10233-2-colyli@suse.de> From: Coly Li Message-ID: Date: Mon, 27 Sep 2021 16:23:45 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/27/21 3:23 PM, Geliang Tang wrote: > Hi Coly, > > On 9/14/21 00:36, Coly Li wrote: >> This patch adds the following helper structure and routines into >> badblocks.h, >> - struct badblocks_context >>    This structure is used in improved badblocks code for bad table >>    iteration. >> - BB_END() >>    The macro to culculate end LBA of a bad range record from bad >>    table. >> - badblocks_full() and badblocks_empty() >>    The inline routines to check whether bad table is full or empty. >> - set_changed() and clear_changed() >>    The inline routines to set and clear 'changed' tag from struct >>    badblocks. >> >> These new helper structure and routines can help to make the code more >> clear, they will be used in the improved badblocks code in following >> patches. >> >> Signed-off-by: Coly Li >> Cc: Dan Williams >> Cc: Hannes Reinecke >> Cc: Jens Axboe >> Cc: NeilBrown >> Cc: Richard Fan >> Cc: Vishal L Verma >> --- >>   include/linux/badblocks.h | 32 ++++++++++++++++++++++++++++++++ >>   1 file changed, 32 insertions(+) >> >> diff --git a/include/linux/badblocks.h b/include/linux/badblocks.h >> index 2426276b9bd3..166161842d1f 100644 >> --- a/include/linux/badblocks.h >> +++ b/include/linux/badblocks.h >> @@ -15,6 +15,7 @@ >>   #define BB_OFFSET(x)    (((x) & BB_OFFSET_MASK) >> 9) >>   #define BB_LEN(x)    (((x) & BB_LEN_MASK) + 1) >>   #define BB_ACK(x)    (!!((x) & BB_ACK_MASK)) >> +#define BB_END(x)    (BB_OFFSET(x) + BB_LEN(x)) >>   #define BB_MAKE(a, l, ack) (((a)<<9) | ((l)-1) | ((u64)(!!(ack)) << >> 63)) >>     /* Bad block numbers are stored sorted in a single page. >> @@ -41,6 +42,14 @@ struct badblocks { >>       sector_t size;        /* in sectors */ >>   }; >>   +struct badblocks_context { >> +    sector_t    start; >> +    sector_t    len; > > I think the type of 'len' should be 'int' instead of 'sector_t', since > we used 'int sectors' as one of the arguments of _badblocks_set(). OK, I will change it. > >> +    int        ack; >> +    sector_t    orig_start; >> +    sector_t    orig_len; > > I think 'orig_start' and 'orig_len' can be dropped, see comments in > patch 3. Yes, I will change it in next version. Please review the new version latter. Thanks for your review. Coly Li