From: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Joe Lawrence <joe.lawrence@stratus.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Dan Williams <dan.j.williams@gmail.com>,
linux-raid <linux-raid@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] scsi: Check if the device support WRITE_SAME_10
Date: Wed, 05 Jun 2013 22:09:22 +0200 [thread overview]
Message-ID: <51AF9AF2.5000907@itwm.fraunhofer.de> (raw)
In-Reply-To: <yq1r4ggpdy7.fsf@sermon.lab.mkp.net>
On 06/05/2013 09:14 PM, Martin K. Petersen wrote:>>>>>> "Bernd" == Bernd Schubert <bernd.schubert@itwm.fraunhofer.de> writes:
>
> Bernd> The md layer currently cannot handle failed WRITE_SAME commands
> Bernd> and the initial easiest fix is to check if the device supports
> Bernd> WRITE_SAME at all. It already tested for WRITE_SAME_16 and this
> Bernd> commit adds a test for WRITE_SAME_10.
>
> No go. That'll disable WRITE SAME for drives which don't support
> RSOC. Which means almost all of them.
Ah, sorry, I didn't check the specs.
>
> I propose the following...
>
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -442,8 +442,15 @@ sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr,
>
> if (max == 0)
> sdp->no_write_same = 1;
> - else if (max <= SD_MAX_WS16_BLOCKS)
> - sdkp->max_ws_blocks = max;
> + else
> + sdp->no_write_same = 0;
> +
> + if (sdkp->ws16)
> + sdkp->max_ws_blocks =
> + max_t(unsigned long, max, SD_MAX_WS16_BLOCKS);
> + else
> + sdkp->max_ws_blocks =
> + max_t(unsigned long, max, SD_MAX_WS10_BLOCKS);
>
> sd_config_write_same(sdkp);
Max? Not min_t()?
> @@ -762,16 +769,16 @@ static void sd_config_write_same(struct scsi_disk *sdkp)
> * blocks per I/O unless the device explicitly advertises a
> * bigger limit.
> */
> - if (sdkp->max_ws_blocks == 0)
> - sdkp->max_ws_blocks = SD_MAX_WS10_BLOCKS;
> -
> - if (sdkp->ws16 || sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS)
> + if (sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS)
> blocks = min_not_zero(sdkp->max_ws_blocks,
> (u32)SD_MAX_WS16_BLOCKS);
> else
> blocks = min_not_zero(sdkp->max_ws_blocks,
> (u32)SD_MAX_WS10_BLOCKS);
>
> + if (sdkp->ws16 || sdkp->ws10 || sdkp->device->no_report_opcodes)
> + sdkp->max_ws_blocks = blocks;
> +
> out:
> blk_queue_max_write_same_sectors(q, blocks * (logical_block_size >> 9));
> }
blk_queue_max_write_same_sectors(q, sdkp->max_ws_blocks * (logical_block_size >> 9)) ?
Otherwise sdkp->max_ws_blocks and the queue might have different values, wouldn't they?
I cant't provide a comment about scsi_get_vpd_page, I simply don't know. You certainly
know the scsi specs ways better than I do!
Thanks,
Bernd
next prev parent reply other threads:[~2013-06-05 20:09 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 ` [PATCH] scsi: Check if the device support WRITE_SAME_10 Bernd Schubert
2013-06-05 19:14 ` Martin K. Petersen
2013-06-05 20:09 ` Bernd Schubert [this message]
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=51AF9AF2.5000907@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