All of lore.kernel.org
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Geliang Tang <geliangtang@gmail.com>
Cc: antlists@youngman.org.uk, Dan Williams <dan.j.williams@intel.com>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hannes Reinecke <hare@suse.de>, Jens Axboe <axboe@kernel.dk>,
	NeilBrown <neilb@suse.de>,
	nvdimm@lists.linux.dev, linux-raid@vger.kernel.org,
	Richard Fan <richard.fan@suse.com>,
	Vishal L Verma <vishal.l.verma@intel.com>
Subject: Re: [PATCH v3 1/6] badblocks: add more helper structure and routines in badblocks.h
Date: Mon, 27 Sep 2021 16:23:45 +0800	[thread overview]
Message-ID: <b0960871-1fc6-ed76-965c-7b0adff6641c@suse.de> (raw)
In-Reply-To: <e0fc4902-e8db-b507-651b-d930a74702ef@gmail.com>

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 <colyli@suse.de>
>> Cc: Dan Williams <dan.j.williams@intel.com>
>> Cc: Hannes Reinecke <hare@suse.de>
>> Cc: Jens Axboe <axboe@kernel.dk>
>> Cc: NeilBrown <neilb@suse.de>
>> Cc: Richard Fan <richard.fan@suse.com>
>> Cc: Vishal L Verma <vishal.l.verma@intel.com>
>> ---
>>   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

  reply	other threads:[~2021-09-27  8:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 16:36 [PATCH v3 0/7] badblocks improvement for multiple bad block ranges Coly Li
2021-09-13 16:36 ` [PATCH v3 1/6] badblocks: add more helper structure and routines in badblocks.h Coly Li
2021-09-27  7:23   ` Geliang Tang
2021-09-27  8:23     ` Coly Li [this message]
2021-09-13 16:36 ` [PATCH v3 2/6] badblocks: add helper routines for badblock ranges handling Coly Li
2021-09-27  7:25   ` Geliang Tang
2021-09-27  8:17     ` Coly Li
2021-09-13 16:36 ` [PATCH v3 3/6] badblocks: improvement badblocks_set() for multiple " Coly Li
2021-09-27  7:30   ` Geliang Tang
2021-09-27  8:16     ` Coly Li
2021-09-13 16:36 ` [PATCH v3 4/6] badblocks: improve badblocks_clear() " Coly Li
2021-09-13 16:36 ` [PATCH v3 5/6] badblocks: improve badblocks_check() " Coly Li
2021-09-13 16:36 ` [PATCH v3 6/6] badblocks: switch to the improved badblock handling code Coly Li
2021-09-13 16:36 ` [PATCH] test: user space code to test badblocks APIs Coly Li
2021-09-23  5:59 ` Too large badblocks sysfs file (was: [PATCH v3 0/7] badblocks improvement for multiple bad block ranges) Coly Li
2021-09-23  6:08   ` Greg Kroah-Hartman
2021-09-23  6:14     ` Coly Li
2021-09-23  6:47       ` Greg Kroah-Hartman
2021-09-23  7:13         ` Coly Li
2021-09-23  9:40   ` Hannes Reinecke
2021-09-23  9:57     ` Greg Kroah-Hartman
2021-09-23 10:09   ` NeilBrown
2021-09-23 10:39     ` Greg Kroah-Hartman
2021-09-23 12:55     ` Coly Li
2021-12-02 12:52 [PATCH v4 0/6] badblocks improvement for multiple bad block ranges Coly Li
2021-12-02 12:52 ` [PATCH v3 1/6] badblocks: add more helper structure and routines in badblocks.h Coly Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b0960871-1fc6-ed76-965c-7b0adff6641c@suse.de \
    --to=colyli@suse.de \
    --cc=antlists@youngman.org.uk \
    --cc=axboe@kernel.dk \
    --cc=dan.j.williams@intel.com \
    --cc=geliangtang@gmail.com \
    --cc=hare@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=nvdimm@lists.linux.dev \
    --cc=richard.fan@suse.com \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.