From: tom.ty89@gmail.com
To: linux-scsi@vger.kernel.org
Cc: Tom Yan <tom.ty89@gmail.com>
Subject: [PATCH v2 1/1] sd: add missing scenario for sd_config_write_same
Date: Sat, 27 Feb 2016 05:16:06 +0800 [thread overview]
Message-ID: <56d0c09d.5a46620a.e4c6.0855@mx.google.com> (raw)
From: Tom Yan <tom.ty89@gmail.com>
Example:
[root@localhost ~]# sg_opcodes /dev/sdb > /dev/null
Report supported operation codes: Illegal request, invalid opcode
[root@localhost ~]# sg_vpd -p bl /dev/sdb | grep 'write same'
Maximum write same length: 0x0 blocks
[root@localhost ~]# cat /sys/block/sdb/queue/write_same_max_bytes
33553920
Signed-off-by: Tom Yan <tom.ty89@gmail.com>
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index d749da7..1179ec1 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -807,6 +807,8 @@ static void sd_config_write_same(struct scsi_disk *sdkp)
if (sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS)
sdkp->max_ws_blocks = min_not_zero(sdkp->max_ws_blocks,
(u32)SD_MAX_WS16_BLOCKS);
+ else if (sdkp->max_ws_blocks == 0 && sdkp->device->no_report_opcodes)
+ sdkp->device->no_write_same = 1;
else if (sdkp->ws16 || sdkp->ws10 || sdkp->device->no_report_opcodes)
sdkp->max_ws_blocks = min_not_zero(sdkp->max_ws_blocks,
(u32)SD_MAX_WS10_BLOCKS);
--
2.7.1
next reply other threads:[~2016-02-26 21:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 21:16 tom.ty89 [this message]
2016-02-26 22:12 ` [PATCH v2 1/1] sd: add missing scenario for sd_config_write_same Martin K. Petersen
2016-02-27 1:46 ` Tom Yan
2016-03-01 1:34 ` Martin K. Petersen
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=56d0c09d.5a46620a.e4c6.0855@mx.google.com \
--to=tom.ty89@gmail.com \
--cc=linux-scsi@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).