lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 3 Mar 2021 09:20:17 +0100
From:   Hannes Reinecke <hare@...e.de>
To:     Coly Li <colyli@...e.de>, linux-block@...r.kernel.org,
        axboe@...nel.dk, dan.j.williams@...el.com,
        vishal.l.verma@...el.com, neilb@...e.de
Cc:     antlists@...ngman.org.uk, linux-kernel@...r.kernel.org,
        linux-raid@...r.kernel.org, linux-nvdimm@...ts.01.org
Subject: Re: [RFC PATCH v1 1/6] badblocks: add more helper structure and
 routines in badblocks.h

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@...e.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@...e.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ