All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saurabh Sengar <ssengar@linux.microsoft.com>
To: kys@microsoft.com, haiyangz@microsoft.com,
	sthemmin@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
	martin.petersen@oracle.com, jejb@linux.ibm.com,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	ssengar@microsoft.com, mikelley@microsoft.com
Subject: [PATCH] scsi: storvsc: Enabling WRITE_SAME
Date: Mon, 30 May 2022 01:39:33 -0700	[thread overview]
Message-ID: <1653899973-21039-1-git-send-email-ssengar@linux.microsoft.com> (raw)

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@linux.microsoft.com>
---
 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


             reply	other threads:[~2022-05-30  8:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-30  8:39 Saurabh Sengar [this message]
2022-05-31 13:18 ` [PATCH] scsi: storvsc: Enabling WRITE_SAME Michael Kelley (LINUX)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1653899973-21039-1-git-send-email-ssengar@linux.microsoft.com \
    --to=ssengar@linux.microsoft.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=jejb@linux.ibm.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mikelley@microsoft.com \
    --cc=ssengar@microsoft.com \
    --cc=sthemmin@microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.