diff mbox

[1/2] sd: add missing scenario for sd_config_write_same

Message ID 56d0b088.e99c420a.dbca1.0411@mx.google.com (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Tom Yan Feb. 26, 2016, 8:07 p.m. UTC
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>

Comments

Tom Yan Feb. 26, 2016, 8:26 p.m. UTC | #1
I wonder if we want to disable write same too, instead of falling back
to SD_MAX_WS10_BLOCKS for either of the WRITE SAME (10) and (16)
opcodes, when they are reported to be supported. If not, should we go
for SD_MAX_WS16_BLOCKS instead when WRITE SAME (16) is supported?

P.S. Please be noted I have been talking about cases when the Maximum
Write Same Length reported in the Block Limit VPD is 0.

On 27 February 2016 at 04:07,  <tom.ty89@gmail.com> wrote:
> 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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);