On 06/05/2013 09:14 PM, Martin K. Petersen wrote:>>>>>> "Bernd" == Bernd 
Schubert <[email protected]> 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



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to