diff mbox series

scsi: scsi_debug: Remove superfluous close zone in resp_open_zone()

Message ID 20200821130007.39938-1-niklas.cassel@wdc.com (mailing list archive)
State Mainlined
Commit 75d46c6d15efabc5176a5e2694ee236f02ee72ef
Headers show
Series scsi: scsi_debug: Remove superfluous close zone in resp_open_zone() | expand

Commit Message

Niklas Cassel Aug. 21, 2020, 1 p.m. UTC
resp_open_zone() always calls zbc_open_zone() with parameter explicit
set to true.

If zbc_open_zone() is called with parameter explicit set to true, and
the current zone state is implicit open, it will call zbc_close_zone()
on the zone before proceeding.

Therefore, there is no need for resp_open_zone() to call zbc_close_zone()
on an implicitly open zone before calling zbc_open_zone().

Remove superfluous close zone in resp_open_zone().

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
 drivers/scsi/scsi_debug.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Damien Le Moal Aug. 23, 2020, 11:44 p.m. UTC | #1
On 2020/08/21 22:00, Niklas Cassel wrote:
> resp_open_zone() always calls zbc_open_zone() with parameter explicit
> set to true.
> 
> If zbc_open_zone() is called with parameter explicit set to true, and
> the current zone state is implicit open, it will call zbc_close_zone()
> on the zone before proceeding.
> 
> Therefore, there is no need for resp_open_zone() to call zbc_close_zone()
> on an implicitly open zone before calling zbc_open_zone().
> 
> Remove superfluous close zone in resp_open_zone().
> 
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> ---
>  drivers/scsi/scsi_debug.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 064ed680c0530..912d6f4878bae 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -4482,8 +4482,6 @@ static int resp_open_zone(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
>  		goto fini;
>  	}
>  
> -	if (zc == ZC2_IMPLICIT_OPEN)
> -		zbc_close_zone(devip, zsp);
>  	zbc_open_zone(devip, zsp, true);
>  fini:
>  	write_unlock(macc_lckp);
> 

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 064ed680c0530..912d6f4878bae 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -4482,8 +4482,6 @@  static int resp_open_zone(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
 		goto fini;
 	}
 
-	if (zc == ZC2_IMPLICIT_OPEN)
-		zbc_close_zone(devip, zsp);
 	zbc_open_zone(devip, zsp, true);
 fini:
 	write_unlock(macc_lckp);