This driver already has code logic for WRITE_SAME, but was never working because of a bug where WRITE_SAME is disabled at scsi controller level. Apparently if WRITE_SAME is disabled at scsi controller level it takes precedence over disk level setting. This patch fixes this bug, and enables this feature only for VMSTOR protocol version 10.0 and above. Signed-off-by: Saurabh Sengar <ssengar@xxxxxxxxxxxxxxxxxxx> --- drivers/scsi/storvsc_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index ca35309..3e55687 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -50,6 +50,7 @@ * Win8: 5.1 * Win8.1: 6.0 * Win10: 6.2 + * Win10.1: 10.0 */ #define VMSTOR_PROTO_VERSION(MAJOR_, MINOR_) ((((MAJOR_) & 0xff) << 8) | \ @@ -59,6 +60,7 @@ #define VMSTOR_PROTO_VERSION_WIN8 VMSTOR_PROTO_VERSION(5, 1) #define VMSTOR_PROTO_VERSION_WIN8_1 VMSTOR_PROTO_VERSION(6, 0) #define VMSTOR_PROTO_VERSION_WIN10 VMSTOR_PROTO_VERSION(6, 2) +#define VMSTOR_PROTO_VERSION_WIN10_1 VMSTOR_PROTO_VERSION(10, 0) /* Packet structure describing virtual storage requests. */ enum vstor_packet_operation { @@ -205,6 +207,7 @@ struct vmscsi_request { */ static const int protocol_version[] = { + VMSTOR_PROTO_VERSION_WIN10_1, VMSTOR_PROTO_VERSION_WIN10, VMSTOR_PROTO_VERSION_WIN8_1, VMSTOR_PROTO_VERSION_WIN8, @@ -1558,7 +1561,7 @@ static int storvsc_device_configure(struct scsi_device *sdevice) break; } - if (vmstor_proto_version >= VMSTOR_PROTO_VERSION_WIN10) + if (vmstor_proto_version >= VMSTOR_PROTO_VERSION_WIN10_1) sdevice->no_write_same = 0; } @@ -1845,7 +1848,6 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) .this_id = -1, /* Ensure there are no gaps in presented sgls */ .virt_boundary_mask = PAGE_SIZE-1, - .no_write_same = 1, .track_queue_depth = 1, .change_queue_depth = storvsc_change_queue_depth, }; -- 1.8.3.1