mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-28 07:04:00 +08:00
scsi: sd: Write lock zone for REQ_OP_WRITE_ZEROES
For a zoned block device, sd_zbc_complete() handles zone write unlock on completion of a REQ_OP_WRITE_ZEROES command but the zone write locking is missing from sd_setup_write_zeroes_cmnd(). This patch fixes this problem by locking the target zone of a REQ_OP_WRITE_ZEROES request. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
29f6ca6916
commit
ed44fd7fd8
@ -827,21 +827,32 @@ 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:
|
||||
return sd_setup_write_same16_cmnd(cmd, true);
|
||||
ret = sd_setup_write_same16_cmnd(cmd, true);
|
||||
goto out;
|
||||
case SD_ZERO_WS10_UNMAP:
|
||||
return sd_setup_write_same10_cmnd(cmd, true);
|
||||
ret = sd_setup_write_same10_cmnd(cmd, true);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (sdp->no_write_same)
|
||||
return BLKPREP_INVALID;
|
||||
|
||||
if (sdkp->ws16 || sector > 0xffffffff || nr_sectors > 0xffff)
|
||||
return sd_setup_write_same16_cmnd(cmd, false);
|
||||
return sd_setup_write_same10_cmnd(cmd, false);
|
||||
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 ret;
|
||||
}
|
||||
|
||||
static void sd_config_write_same(struct scsi_disk *sdkp)
|
||||
|
Loading…
Reference in New Issue
Block a user