diff mbox

sd: Fix discard granularity when LBPRZ=1

Message ID 1457219421-836-1-git-send-email-martin.petersen@oracle.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Martin K. Petersen March 5, 2016, 11:10 p.m. UTC
Commit 397737223c59 ("sd: Make discard granularity match logical block
size when LBPRZ=1") accidentally set the granularity to one byte instead
of one logical block on devices that provide determistic zeroes after
UNMAP.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Reported-by: Mike Snitzer <snitzer@redhat.com>
Fixes: 397737223c59e89dca7305feb6528caef8fbef84
Cc: <stable@vger.kernel.org> # 4.4+
---
 drivers/scsi/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ewan Milne March 7, 2016, 3:42 p.m. UTC | #1
On Sat, 2016-03-05 at 18:10 -0500, Martin K. Petersen wrote:
> Commit 397737223c59 ("sd: Make discard granularity match logical block
> size when LBPRZ=1") accidentally set the granularity to one byte instead
> of one logical block on devices that provide determistic zeroes after
> UNMAP.
> 
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> Reported-by: Mike Snitzer <snitzer@redhat.com>
> Fixes: 397737223c59e89dca7305feb6528caef8fbef84
> Cc: <stable@vger.kernel.org> # 4.4+
> ---
>  drivers/scsi/sd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index d749da765df1..5a5457ac9cdb 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -648,7 +648,7 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
>  	 */
>  	if (sdkp->lbprz) {
>  		q->limits.discard_alignment = 0;
> -		q->limits.discard_granularity = 1;
> +		q->limits.discard_granularity = logical_block_size;
>  	} else {
>  		q->limits.discard_alignment = sdkp->unmap_alignment *
>  			logical_block_size;

Reviewed-by: Ewan D. Milne <emilne@redhat.com>


--
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
Martin K. Petersen March 8, 2016, 2:21 a.m. UTC | #2
>>>>> "Ewan" == Ewan Milne <emilne@redhat.com> writes:
>> Commit 397737223c59 ("sd: Make discard granularity match logical
>> block size when LBPRZ=1") accidentally set the granularity to one
>> byte instead of one logical block on devices that provide determistic
>> zeroes after UNMAP.

Ewan> Reviewed-by: Ewan D. Milne <emilne@redhat.com>

I'll need another reviewer for this.

Thanks!
Bart Van Assche March 8, 2016, 5:02 p.m. UTC | #3
On 03/05/2016 03:10 PM, Martin K. Petersen wrote:
> Commit 397737223c59 ("sd: Make discard granularity match logical block
> size when LBPRZ=1") accidentally set the granularity to one byte instead
> of one logical block on devices that provide determistic zeroes after
> UNMAP.
>
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> Reported-by: Mike Snitzer <snitzer@redhat.com>
> Fixes: 397737223c59e89dca7305feb6528caef8fbef84
> Cc: <stable@vger.kernel.org> # 4.4+
> ---
>   drivers/scsi/sd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index d749da765df1..5a5457ac9cdb 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -648,7 +648,7 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
>   	 */
>   	if (sdkp->lbprz) {
>   		q->limits.discard_alignment = 0;
> -		q->limits.discard_granularity = 1;
> +		q->limits.discard_granularity = logical_block_size;
>   	} else {
>   		q->limits.discard_alignment = sdkp->unmap_alignment *
>   			logical_block_size;

Please fix the spelling of "deterministic" in the patch description. 
With or without that change:

Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
--
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
Martin K. Petersen March 9, 2016, 1:51 a.m. UTC | #4
>>>>> "Bart" == Bart Van Assche <bart.vanassche@sandisk.com> writes:

Bart> Please fix the spelling of "deterministic" in the patch
Bart> description. With or without that change:

Bart> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>

Fixed, thanks!
diff mbox

Patch

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index d749da765df1..5a5457ac9cdb 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -648,7 +648,7 @@  static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
 	 */
 	if (sdkp->lbprz) {
 		q->limits.discard_alignment = 0;
-		q->limits.discard_granularity = 1;
+		q->limits.discard_granularity = logical_block_size;
 	} else {
 		q->limits.discard_alignment = sdkp->unmap_alignment *
 			logical_block_size;