mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-18 17:57:36 +07:00
sd: remove __data_len hack for WRITE SAME
Now that we have the blk_rq_payload_bytes helper available to determine the actual I/O size we don't need to mess around with __data_len for WRITE SAME. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
b131c61d62
commit
f80de881d8
@ -836,7 +836,6 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
|
|||||||
struct bio *bio = rq->bio;
|
struct bio *bio = rq->bio;
|
||||||
sector_t sector = blk_rq_pos(rq);
|
sector_t sector = blk_rq_pos(rq);
|
||||||
unsigned int nr_sectors = blk_rq_sectors(rq);
|
unsigned int nr_sectors = blk_rq_sectors(rq);
|
||||||
unsigned int nr_bytes = blk_rq_bytes(rq);
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sdkp->device->no_write_same)
|
if (sdkp->device->no_write_same)
|
||||||
@ -869,21 +868,7 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
|
|||||||
|
|
||||||
cmd->transfersize = sdp->sector_size;
|
cmd->transfersize = sdp->sector_size;
|
||||||
cmd->allowed = SD_MAX_RETRIES;
|
cmd->allowed = SD_MAX_RETRIES;
|
||||||
|
return scsi_init_io(cmd);
|
||||||
/*
|
|
||||||
* For WRITE_SAME the data transferred in the DATA IN buffer is
|
|
||||||
* different from the amount of data actually written to the target.
|
|
||||||
*
|
|
||||||
* We set up __data_len to the amount of data transferred from the
|
|
||||||
* DATA IN buffer so that blk_rq_map_sg set up the proper S/G list
|
|
||||||
* to transfer a single sector of data first, but then reset it to
|
|
||||||
* the amount of data to be written right after so that the I/O path
|
|
||||||
* knows how much to actually write.
|
|
||||||
*/
|
|
||||||
rq->__data_len = sdp->sector_size;
|
|
||||||
ret = scsi_init_io(cmd);
|
|
||||||
rq->__data_len = nr_bytes;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd)
|
static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd)
|
||||||
|
Loading…
Reference in New Issue
Block a user