From: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
Cc: Joe Lawrence <joe.lawrence@stratus.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Dan Williams <dan.j.williams@gmail.com>,
linux-raid <linux-raid@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH] scsi: Check if the device support WRITE_SAME_10
Date: Wed, 05 Jun 2013 14:53:52 +0200 [thread overview]
Message-ID: <51AF34E0.3030609@itwm.fraunhofer.de> (raw)
In-Reply-To: <51AF232C.8060209@itwm.fraunhofer.de>
Here's a rather simply patch for scsi-midlayer
checkpatch.pl complains about style issue, but
I just did it as the other lines there.
> schubert@squeeze@fsdevel3 linux-stable>scripts/checkpatch.pl patches-linux-3.9.y/ws10
> ERROR: spaces prohibited around that ':' (ctx:WxW)
> #48: FILE: drivers/scsi/sd.h:87:
> + unsigned ws10 : 1;
> ^
If someone wants me, I can send another patch to fix the other
lines first.
scsi: Check if the device support WRITE_SAME_10
From: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
The md layer currently cannot handle failed WRITE_SAME commands
and the initial easiest fix is to check if the device supports
WRITE_SAME at all. It already tested for WRITE_SAME_16 and
this commit adds a test for WRITE_SAME_10.
Signed-off-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
---
drivers/scsi/sd.c | 6 +++++-
drivers/scsi/sd.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 82910cc..368f0a4 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -742,7 +742,7 @@ static void sd_config_write_same(struct scsi_disk *sdkp)
unsigned int logical_block_size = sdkp->device->sector_size;
unsigned int blocks = 0;
- if (sdkp->device->no_write_same) {
+ if (sdkp->device->no_write_same || !(sdkp->ws10 || sdkp->ws16)) {
sdkp->max_ws_blocks = 0;
goto out;
}
@@ -2648,6 +2648,10 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp)
static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer)
{
if (scsi_report_opcode(sdkp->device, buffer, SD_BUF_SIZE,
+ WRITE_SAME))
+ sdkp->ws10 = 1;
+
+ if (scsi_report_opcode(sdkp->device, buffer, SD_BUF_SIZE,
WRITE_SAME_16))
sdkp->ws16 = 1;
}
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 2386aeb..7a049de 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -84,6 +84,7 @@ struct scsi_disk {
unsigned lbpws : 1;
unsigned lbpws10 : 1;
unsigned lbpvpd : 1;
+ unsigned ws10 : 1;
unsigned ws16 : 1;
};
#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
next prev parent reply other threads:[~2013-06-05 12:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <51AC1440.7020505@zytor.com>
[not found] ` <CAA9_cmddLfReYeAhgwh5=j6ELMBNx5Oq7Gg8K+fo0PneaEfrVA@mail.gmail.com>
[not found] ` <51AC3283.4000403@zytor.com>
[not found] ` <CAA9_cme6tYpYnrZDbrDduwPCjVn+PFbx_rZNPFazBEU9EF0upw@mail.gmail.com>
[not found] ` <51ACBAA0.40604@zytor.com>
[not found] ` <CAA9_cmc3Gs91C4aV6okUw-=q+fACm1+dooyafOZi+Lnj+Ne_ig@mail.gmail.com>
[not found] ` <51ACD511.4030604@zytor.com>
[not found] ` <yq1y5art543.fsf@sermon.lab.mkp.net>
[not found] ` <51AD2485.9000601@zytor.com>
[not found] ` <alpine.DEB.2.02.1306041132260.19072@jlaw-desktop.mno.stratus.com>
[not found] ` <51AF0CCF.8000909@itwm.fraunhofer.de>
2013-06-05 11:38 ` RAID-10 keeps aborting Bernd Schubert
2013-06-05 12:53 ` Bernd Schubert [this message]
2013-06-05 19:14 ` [PATCH] scsi: Check if the device support WRITE_SAME_10 Martin K. Petersen
2013-06-05 20:09 ` Bernd Schubert
2013-06-07 2:15 ` Martin K. Petersen
2013-06-12 19:34 ` Bernd Schubert
2013-06-05 19:11 ` RAID-10 keeps aborting 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=51AF34E0.3030609@itwm.fraunhofer.de \
--to=bernd.schubert@itwm.fraunhofer.de \
--cc=dan.j.williams@gmail.com \
--cc=hpa@zytor.com \
--cc=joe.lawrence@stratus.com \
--cc=linux-raid@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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