linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use the correct size to set block max sectors
@ 2016-05-27  0:08 Long Li
  2016-05-27  0:40 ` Fam Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Long Li @ 2016-05-27  0:08 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: Long Li, KY Srinivasan, linux-scsi, linux-kernel

The block sector size should be in unit of 512 bytes, not in bytes.

Signed-off-by: Long Li <longli@microsoft.com>

---
 drivers/scsi/sd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 428c03e..4bce17e 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2862,9 +2862,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
 	if (sdkp->opt_xfer_blocks &&
 	    sdkp->opt_xfer_blocks <= dev_max &&
 	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
-	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE)
-		rw_max = q->limits.io_opt =
+	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE) {
+		q->limits.io_opt =
 			sdkp->opt_xfer_blocks * sdp->sector_size;
+		rw_max = (q->limits.io_opt >> 9);
+	}
 	else
 		rw_max = BLK_DEF_MAX_SECTORS;
 
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use the correct size to set block max sectors
  2016-05-27  0:08 [PATCH] Use the correct size to set block max sectors Long Li
@ 2016-05-27  0:40 ` Fam Zheng
  2016-05-27  1:35 ` Joe Perches
  2016-05-27  2:18 ` Bart Van Assche
  2 siblings, 0 replies; 7+ messages in thread
From: Fam Zheng @ 2016-05-27  0:40 UTC (permalink / raw)
  To: Long Li
  Cc: James E.J. Bottomley, Martin K. Petersen, KY Srinivasan,
	linux-scsi, linux-kernel

On Thu, 05/26 17:08, Long Li wrote:
> The block sector size should be in unit of 512 bytes, not in bytes.
> 
> Signed-off-by: Long Li <longli@microsoft.com>
> 
> ---
>  drivers/scsi/sd.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 428c03e..4bce17e 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2862,9 +2862,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
>  	if (sdkp->opt_xfer_blocks &&
>  	    sdkp->opt_xfer_blocks <= dev_max &&
>  	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
> -	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE)
> -		rw_max = q->limits.io_opt =
> +	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE) {
> +		q->limits.io_opt =
>  			sdkp->opt_xfer_blocks * sdp->sector_size;
> +		rw_max = (q->limits.io_opt >> 9);

Other than the superfluous parenthesis, looks good to me.

Fam

> +	}
>  	else
>  		rw_max = BLK_DEF_MAX_SECTORS;
>  
> -- 
> 1.8.5.6
> 
> --
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use the correct size to set block max sectors
  2016-05-27  0:08 [PATCH] Use the correct size to set block max sectors Long Li
  2016-05-27  0:40 ` Fam Zheng
@ 2016-05-27  1:35 ` Joe Perches
  2016-05-27  2:18 ` Bart Van Assche
  2 siblings, 0 replies; 7+ messages in thread
From: Joe Perches @ 2016-05-27  1:35 UTC (permalink / raw)
  To: Long Li, James E.J. Bottomley, Martin K. Petersen
  Cc: KY Srinivasan, linux-scsi, linux-kernel

dOn Thu, 2016-05-26 at 17:08 -0700, Long Li wrote:
> The block sector size should be in unit of 512 bytes, not in bytes.

Thanks.  The patch subject should use something like:

[PATCH] sd: Use the correct size to set block max sectors

to show what subsystem is being modified.

> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
[]
> @@ -2862,9 +2862,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
>  	if (sdkp->opt_xfer_blocks &&
>  	    sdkp->opt_xfer_blocks <= dev_max &&
>  	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
> -	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE)
> -		rw_max = q->limits.io_opt =
> +	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE) {
> +		q->limits.io_opt =
>  			sdkp->opt_xfer_blocks * sdp->sector_size;
> +		rw_max = (q->limits.io_opt >> 9);
> +	}
>  	else
>  		rw_max = BLK_DEF_MAX_SECTORS;

And style trivia:  it'd be more kernel style consistent as:

	if (...
	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE) {
		q->limits.io_opt = sdkp->opt_xfer_blocks * sdp->sector_size;
		rw_max = q->limits.io_opt >> 9;
	} else {
		rw_max = BLK_DEF_MAX_SECTORS;
	}

ie: no parentheses necessary around the shifted value and
    braces around both arms.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use the correct size to set block max sectors
  2016-05-27  0:08 [PATCH] Use the correct size to set block max sectors Long Li
  2016-05-27  0:40 ` Fam Zheng
  2016-05-27  1:35 ` Joe Perches
@ 2016-05-27  2:18 ` Bart Van Assche
  2016-05-27  4:06   ` Long Li
  2 siblings, 1 reply; 7+ messages in thread
From: Bart Van Assche @ 2016-05-27  2:18 UTC (permalink / raw)
  To: Long Li, James E.J. Bottomley, Martin K. Petersen
  Cc: KY Srinivasan, linux-scsi, linux-kernel

On 05/26/16 17:08, Long Li wrote:
> The block sector size should be in unit of 512 bytes, not in bytes.
>
> Signed-off-by: Long Li <longli@microsoft.com>
>
> ---
>  drivers/scsi/sd.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 428c03e..4bce17e 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2862,9 +2862,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
>  	if (sdkp->opt_xfer_blocks &&
>  	    sdkp->opt_xfer_blocks <= dev_max &&
>  	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
> -	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE)
> -		rw_max = q->limits.io_opt =
> +	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE) {
> +		q->limits.io_opt =
>  			sdkp->opt_xfer_blocks * sdp->sector_size;
> +		rw_max = (q->limits.io_opt >> 9);
> +	}
>  	else
>  		rw_max = BLK_DEF_MAX_SECTORS;

Isn't this a duplicate of a patch Martin Petersen posted three weeks 
ago? See also http://thread.gmane.org/gmane.linux.scsi/113746.

Bart.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] Use the correct size to set block max sectors
  2016-05-27  2:18 ` Bart Van Assche
@ 2016-05-27  4:06   ` Long Li
  2016-06-01  2:44     ` Martin K. Petersen
  0 siblings, 1 reply; 7+ messages in thread
From: Long Li @ 2016-05-27  4:06 UTC (permalink / raw)
  To: Bart Van Assche, James E.J. Bottomley, Martin K. Petersen
  Cc: KY Srinivasan, linux-scsi, linux-kernel

> -----Original Message-----
> From: Bart Van Assche [mailto:bart.vanassche@sandisk.com]
> Sent: Thursday, May 26, 2016 7:19 PM
> To: Long Li <longli@microsoft.com>; James E.J. Bottomley
> <jejb@linux.vnet.ibm.com>; Martin K. Petersen
> <martin.petersen@oracle.com>
> Cc: KY Srinivasan <kys@microsoft.com>; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH] Use the correct size to set block max sectors
> 
> On 05/26/16 17:08, Long Li wrote:
> > The block sector size should be in unit of 512 bytes, not in bytes.
> >
> > Signed-off-by: Long Li <longli@microsoft.com>
> >
> > ---
> >  drivers/scsi/sd.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index
> > 428c03e..4bce17e 100644
> > --- a/drivers/scsi/sd.c
> > +++ b/drivers/scsi/sd.c
> > @@ -2862,9 +2862,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
> >  	if (sdkp->opt_xfer_blocks &&
> >  	    sdkp->opt_xfer_blocks <= dev_max &&
> >  	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
> > -	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE)
> > -		rw_max = q->limits.io_opt =
> > +	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE) {
> > +		q->limits.io_opt =
> >  			sdkp->opt_xfer_blocks * sdp->sector_size;
> > +		rw_max = (q->limits.io_opt >> 9);
> > +	}
> >  	else
> >  		rw_max = BLK_DEF_MAX_SECTORS;
> 
> Isn't this a duplicate of a patch Martin Petersen posted three weeks ago? See
> also
> https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fthread.g
> mane.org%2fgmane.linux.scsi%2f113746&data=01%7c01%7clongli%40micros
> oft.com%7c4396718e6f9749d178bf08d385d53bba%7c72f988bf86f141af91ab2
> d7cd011db47%7c1&sdata=UpiYwEdYMtqcwuNS1llVuXcQ6riFT3b5%2b44Sn56
> Bl14%3d.
> 
> Bart.
> 
> 

Yes, this has been fixed in that patch.

Please drop this one.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Use the correct size to set block max sectors
  2016-05-27  4:06   ` Long Li
@ 2016-06-01  2:44     ` Martin K. Petersen
  2016-06-03 22:42       ` Long Li
  0 siblings, 1 reply; 7+ messages in thread
From: Martin K. Petersen @ 2016-06-01  2:44 UTC (permalink / raw)
  To: Long Li
  Cc: Bart Van Assche, James E.J. Bottomley, Martin K. Petersen,
	KY Srinivasan, linux-scsi, linux-kernel

>>>>> "Long" == Long Li <longli@microsoft.com> writes:

Long,

Long> Yes, this has been fixed in that patch.

I'd like to get my patch into scsi-fixes but it needs another set of
eyes. Would you mind either testing or reviewing it?

Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] Use the correct size to set block max sectors
  2016-06-01  2:44     ` Martin K. Petersen
@ 2016-06-03 22:42       ` Long Li
  0 siblings, 0 replies; 7+ messages in thread
From: Long Li @ 2016-06-03 22:42 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Bart Van Assche, James E.J. Bottomley, KY Srinivasan, linux-scsi,
	linux-kernel

Hi Martin,

Yes I would like to test it. Please let me know when they get in there.

Thanks

Long


> -----Original Message-----
> From: Martin K. Petersen [mailto:martin.petersen@oracle.com]
> Sent: Tuesday, May 31, 2016 7:44 PM
> To: Long Li <longli@microsoft.com>
> Cc: Bart Van Assche <bart.vanassche@sandisk.com>; James E.J. Bottomley
> <jejb@linux.vnet.ibm.com>; Martin K. Petersen
> <martin.petersen@oracle.com>; KY Srinivasan <kys@microsoft.com>; linux-
> scsi@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] Use the correct size to set block max sectors
> 
> >>>>> "Long" == Long Li <longli@microsoft.com> writes:
> 
> Long,
> 
> Long> Yes, this has been fixed in that patch.
> 
> I'd like to get my patch into scsi-fixes but it needs another set of eyes. Would
> you mind either testing or reviewing it?
> 
> Thanks!
> 
> --
> Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-03 23:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-27  0:08 [PATCH] Use the correct size to set block max sectors Long Li
2016-05-27  0:40 ` Fam Zheng
2016-05-27  1:35 ` Joe Perches
2016-05-27  2:18 ` Bart Van Assche
2016-05-27  4:06   ` Long Li
2016-06-01  2:44     ` Martin K. Petersen
2016-06-03 22:42       ` Long Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).