[dm-devel] [PATCH 1/2] dm-zoned: invert zone check in dmz_reset_zone()

Damien Le Moal Damien.LeMoal at wdc.com
Wed May 13 12:16:12 UTC 2020


On 2020/05/13 16:07, Hannes Reinecke wrote:
> Instead of excluding invalid zones we should check if the zone
> is sequential and exclude invalid states. That way we don't need
> to touch the selection when new zone states or flags are added.
> 
> Signed-off-by: Hannes Reinecke <hare at suse.de>
> ---
>  drivers/md/dm-zoned-metadata.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c
> index d9e256762eff..9b93d7ff1dfc 100644
> --- a/drivers/md/dm-zoned-metadata.c
> +++ b/drivers/md/dm-zoned-metadata.c
> @@ -1570,12 +1570,16 @@ static int dmz_reset_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
>  	int ret;
>  
>  	/*
> -	 * Ignore offline zones, read only zones,
> -	 * and conventional zones.
> +	 * Only check sequential zones.

Nit: the comment would be better as:

/* Only sequential zones need reset */

> +	 */
> +	if (!dmz_is_seq(zone))
> +		return 0;
> +
> +	/*
> +	 * But ignore offline and read only zones.
>  	 */
>  	if (dmz_is_offline(zone) ||
> -	    dmz_is_readonly(zone) ||
> -	    dmz_is_rnd(zone))
> +	    dmz_is_readonly(zone))
>  		return 0;
>  
>  	if (!dmz_is_empty(zone) || dmz_seq_write_err(zone)) {
> 

Otherwise, looks good.

Reviewed-by: Damien Le Moal <damien.lemoal at wdc.com>

-- 
Damien Le Moal
Western Digital Research






More information about the dm-devel mailing list