Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1407767

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

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Use the correct size to set block max sectors
Date 2016-05-27 03:40 +0200
Message-ID <rDeUN-5lZ-3@gated-at.bofh.it> (permalink)
References <rDbWV-3C0-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] Use the correct size to set block max sectors Long Li <longli@microsoft.com> - 2016-05-27 00:30 +0200
  Re: [PATCH] Use the correct size to set block max sectors Fam Zheng <famz@redhat.com> - 2016-05-27 02:50 +0200
  Re: [PATCH] Use the correct size to set block max sectors Joe Perches <joe@perches.com> - 2016-05-27 03:40 +0200
  RE: [PATCH] Use the correct size to set block max sectors Long Li <longli@microsoft.com> - 2016-05-27 06:30 +0200

csiph-web