Skip to content

Commit f80de88

Browse files
Christoph Hellwigaxboe
Christoph Hellwig
authored andcommitted
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 <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent b131c61 commit f80de88

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

drivers/scsi/sd.c

+1-16
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,6 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
836836
struct bio *bio = rq->bio;
837837
sector_t sector = blk_rq_pos(rq);
838838
unsigned int nr_sectors = blk_rq_sectors(rq);
839-
unsigned int nr_bytes = blk_rq_bytes(rq);
840839
int ret;
841840

842841
if (sdkp->device->no_write_same)
@@ -869,21 +868,7 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
869868

870869
cmd->transfersize = sdp->sector_size;
871870
cmd->allowed = SD_MAX_RETRIES;
872-
873-
/*
874-
* For WRITE_SAME the data transferred in the DATA IN buffer is
875-
* different from the amount of data actually written to the target.
876-
*
877-
* We set up __data_len to the amount of data transferred from the
878-
* DATA IN buffer so that blk_rq_map_sg set up the proper S/G list
879-
* to transfer a single sector of data first, but then reset it to
880-
* the amount of data to be written right after so that the I/O path
881-
* knows how much to actually write.
882-
*/
883-
rq->__data_len = sdp->sector_size;
884-
ret = scsi_init_io(cmd);
885-
rq->__data_len = nr_bytes;
886-
return ret;
871+
return scsi_init_io(cmd);
887872
}
888873

889874
static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd)

0 commit comments

Comments
 (0)