nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Coly Li <colyli@suse.de>,
	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
Subject: Re: [RFC PATCH v1 1/6] badblocks: add more helper structure and routines in badblocks.h
Date: Wed, 3 Mar 2021 09:20:17 +0100	[thread overview]
Message-ID: <96a899a9-151e-ff8c-c61c-900df1122357@suse.de> (raw)
In-Reply-To: <20210302040252.103720-2-colyli@suse.de>

On 3/2/21 5:02 AM, Coly Li wrote:
> This patch adds the following helper structure and routines into
> badblocks.h,
> - struct bad_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>
> ---
>  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 bad_context {
> +	sector_t	start;
> +	sector_t	len;
> +	int		ack;
> +	sector_t	orig_start;
> +	sector_t	orig_len;
> +};
> +
Maybe rename it to 'badblocks_context'.
It's not the context which is bad ...

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

  reply	other threads:[~2021-03-03  8:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02  4:02 [RFC PATCH v1 0/6] badblocks improvement for multiple bad block ranges Coly Li
2021-03-02  4:02 ` [RFC PATCH v1 1/6] badblocks: add more helper structure and routines in badblocks.h Coly Li
2021-03-03  8:20   ` Hannes Reinecke [this message]
2021-03-03 11:45     ` Coly Li
2021-03-02  4:02 ` [RFC PATCH v1 2/6] badblocks: add helper routines for badblock ranges handling Coly Li
2021-03-02  4:02 ` [RFC PATCH v1 3/6] badblocks: improvement badblocks_set() for multiple " Coly Li
2021-03-02  4:02 ` [RFC PATCH v1 4/6] badblocks: improve badblocks_clear() " Coly Li
2021-03-02  4:02 ` [RFC PATCH v1 5/6] badblocks: improve badblocks_check() " Coly Li
2021-03-02  4:02 ` [RFC PATCH v1 6/6] badblocks: switch to the improved badblock handling code 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=96a899a9-151e-ff8c-c61c-900df1122357@suse.de \
    --to=hare@suse.de \
    --cc=antlists@youngman.org.uk \
    --cc=axboe@kernel.dk \
    --cc=colyli@suse.de \
    --cc=dan.j.williams@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).