Skip to content

Commit

Permalink
scsi: sd: Quiesce warning if device does not report optimal I/O size
Browse files Browse the repository at this point in the history
Commit a83da8a ("scsi: sd: Optimal I/O size should be a multiple
of physical block size") split one conditional into several separate
statements in an effort to provide more accurate warning messages when
a device reports a nonsensical value. However, this reorganization
accidentally dropped the precondition of the reported value being
larger than zero. This lead to a warning getting emitted on devices
that do not report an optimal I/O size at all.

Remain silent if a device does not report an optimal I/O size.

Fixes: a83da8a ("scsi: sd: Optimal I/O size should be a multiple of physical block size")
Cc: Randy Dunlap <[email protected]>
Cc: <[email protected]>
Reported-by: Hussam Al-Tayeb <[email protected]>
Tested-by: Hussam Al-Tayeb <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
martinkpetersen committed Mar 28, 2019
1 parent c14a572 commit 1d5de5b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3071,6 +3071,9 @@ static bool sd_validate_opt_xfer_size(struct scsi_disk *sdkp,
unsigned int opt_xfer_bytes =
logical_to_bytes(sdp, sdkp->opt_xfer_blocks);

if (sdkp->opt_xfer_blocks == 0)
return false;

if (sdkp->opt_xfer_blocks > dev_max) {
sd_first_printk(KERN_WARNING, sdkp,
"Optimal transfer size %u logical blocks " \
Expand Down

0 comments on commit 1d5de5b

Please sign in to comment.