All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Niklas Cassel <Niklas.Cassel@wdc.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH v2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp
Date: Tue, 30 Nov 2021 07:36:36 +0900	[thread overview]
Message-ID: <f262862a-ba14-eeba-8202-6ec20390eb50@opensource.wdc.com> (raw)
In-Reply-To: <20211129131508.350058-1-Niklas.Cassel@wdc.com>

On 2021/11/29 22:15, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
> 
> Make sd_zbc_parse_report() use if/else when setting the write pointer,
> instead of setting it unconditionally and then conditionally updating it.
> 
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> Changes since V2:
> -Picked up Johannes' tag.
> -Dropped patch 1/2 from the series. The actual +/- lines of this patch is
>  unchanged.
> 
>  drivers/scsi/sd_zbc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
> index ed06798983f8..20e849437687 100644
> --- a/drivers/scsi/sd_zbc.c
> +++ b/drivers/scsi/sd_zbc.c
> @@ -61,10 +61,11 @@ static int sd_zbc_parse_report(struct scsi_disk *sdkp, u8 *buf,
>  	zone.len = logical_to_sectors(sdp, get_unaligned_be64(&buf[8]));
>  	zone.capacity = zone.len;
>  	zone.start = logical_to_sectors(sdp, get_unaligned_be64(&buf[16]));
> -	zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24]));
>  	if (zone.type != ZBC_ZONE_TYPE_CONV &&
>  	    zone.cond == ZBC_ZONE_COND_FULL)

Actually, thinking about this test again, I think we should simplify it to:

	if (zone.cond == ZBC_ZONE_COND_FULL)

since conventional zones always have the condition ZBC_ZONE_COND_NO_WP, checking
the zone type is useless.

With that changed, feel free to add:

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

>  		zone.wp = zone.start + zone.len;
> +	else
> +		zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24]));
>  
>  	ret = cb(&zone, idx, data);
>  	if (ret)
> 



-- 
Damien Le Moal
Western Digital Research

      reply	other threads:[~2021-11-29 22:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 13:15 [PATCH v2] scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp Niklas Cassel
2021-11-29 22:36 ` Damien Le Moal [this message]

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=f262862a-ba14-eeba-8202-6ec20390eb50@opensource.wdc.com \
    --to=damien.lemoal@opensource.wdc.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=Niklas.Cassel@wdc.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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.