summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c41
1 files changed, 5 insertions, 36 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a028ab3322a9..f1157b4fe32e 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -851,16 +851,13 @@ static int sd_setup_write_zeroes_cmnd(struct scsi_cmnd *cmd)
struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
u64 sector = blk_rq_pos(rq) >> (ilog2(sdp->sector_size) - 9);
u32 nr_sectors = blk_rq_sectors(rq) >> (ilog2(sdp->sector_size) - 9);
- int ret;
if (!(rq->cmd_flags & REQ_NOUNMAP)) {
switch (sdkp->zeroing_mode) {
case SD_ZERO_WS16_UNMAP:
- ret = sd_setup_write_same16_cmnd(cmd, true);
- goto out;
+ return sd_setup_write_same16_cmnd(cmd, true);
case SD_ZERO_WS10_UNMAP:
- ret = sd_setup_write_same10_cmnd(cmd, true);
- goto out;
+ return sd_setup_write_same10_cmnd(cmd, true);
}
}
@@ -868,15 +865,9 @@ static int sd_setup_write_zeroes_cmnd(struct scsi_cmnd *cmd)
return BLKPREP_INVALID;
if (sdkp->ws16 || sector > 0xffffffff || nr_sectors > 0xffff)
- ret = sd_setup_write_same16_cmnd(cmd, false);
- else
- ret = sd_setup_write_same10_cmnd(cmd, false);
-
-out:
- if (sd_is_zoned(sdkp) && ret == BLKPREP_OK)
- return sd_zbc_write_lock_zone(cmd);
+ return sd_setup_write_same16_cmnd(cmd, false);
- return ret;
+ return sd_setup_write_same10_cmnd(cmd, false);
}
static void sd_config_write_same(struct scsi_disk *sdkp)
@@ -964,12 +955,6 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
BUG_ON(bio_offset(bio) || bio_iovec(bio).bv_len != sdp->sector_size);
- if (sd_is_zoned(sdkp)) {
- ret = sd_zbc_write_lock_zone(cmd);
- if (ret != BLKPREP_OK)
- return ret;
- }
-
sector >>= ilog2(sdp->sector_size) - 9;
nr_sectors >>= ilog2(sdp->sector_size) - 9;
@@ -1004,9 +989,6 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
ret = scsi_init_io(cmd);
rq->__data_len = nr_bytes;
- if (sd_is_zoned(sdkp) && ret != BLKPREP_OK)
- sd_zbc_write_unlock_zone(cmd);
-
return ret;
}
@@ -1036,19 +1018,12 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt)
sector_t threshold;
unsigned int this_count = blk_rq_sectors(rq);
unsigned int dif, dix;
- bool zoned_write = sd_is_zoned(sdkp) && rq_data_dir(rq) == WRITE;
int ret;
unsigned char protect;
- if (zoned_write) {
- ret = sd_zbc_write_lock_zone(SCpnt);
- if (ret != BLKPREP_OK)
- return ret;
- }
-
ret = scsi_init_io(SCpnt);
if (ret != BLKPREP_OK)
- goto out;
+ return ret;
WARN_ON_ONCE(SCpnt != rq->special);
/* from here on until we're complete, any goto out
@@ -1267,9 +1242,6 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt)
*/
ret = BLKPREP_OK;
out:
- if (zoned_write && ret != BLKPREP_OK)
- sd_zbc_write_unlock_zone(SCpnt);
-
return ret;
}
@@ -1314,9 +1286,6 @@ static void sd_uninit_command(struct scsi_cmnd *SCpnt)
struct request *rq = SCpnt->request;
u8 *cmnd;
- if (SCpnt->flags & SCMD_ZONE_WRITE_LOCK)
- sd_zbc_write_unlock_zone(SCpnt);
-
if (rq->rq_flags & RQF_SPECIAL_PAYLOAD)
__free_page(rq->special_vec.bv_page);
OpenPOWER on IntegriCloud