diff mbox series

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

Message ID 20200513070729.71461-2-hare@suse.de (mailing list archive)
State Changes Requested, archived
Delegated to: Mike Snitzer
Headers show
Series dm-zoned: improve cache performance | expand

Commit Message

Hannes Reinecke May 13, 2020, 7:07 a.m. UTC
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@suse.de>
---
 drivers/md/dm-zoned-metadata.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Damien Le Moal May 13, 2020, 12:16 p.m. UTC | #1
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@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@wdc.com>
diff mbox series

Patch

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.
+	 */
+	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)) {