scsi: storvsc: Enabling WRITE_SAME
Subsystems (3)
PATCH 1/1 scsi: storvsc: Enabling WRITE_SAME
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.
--- drivers/scsi/storvsc_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/storvsc_drv.c +4 -2
@@ -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, };
Signature · 1 line
1.8.3.1
From: Saurabh Sengar <[email protected]>
Quoted 25 lines
This driver already has code logic for
WRITE_SAME, but was never working because of a bug whereWRITE_SAMEis disabled at scsi controller level. Apparently ifWRITE_SAMEis 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 <[email protected]>--- drivers/scsi/storvsc_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/scsi/storvsc_drv.c +1
-0@@ -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) | \
drivers/scsi/storvsc_drv.c line 63
Quoted 4 lines
drivers/scsi/storvsc_drv.c +1
-0@@ -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)
As you and I discussed offline, it's a bit weird that Hyper-V is using version 10.0 here instead of the expected 6.3, or even 7.0. I'd like to hold off on this patch until we can clarify with the Hyper-V team whether this is as expected.
Michael
Quoted 30 lines
drivers/scsi/storvsc_drv.c +2
-3/* 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