>>>>> "Tom" == tom ty89 <tom.t...@gmail.com> writes:

Tom,

Tom> The SCSI disk driver sets max_sectors to BLK_DEF_MAX_SECTORS when
Tom> the device does not report Optimal Transfer Length. However, it
Tom> checks only whether it is smaller than max_hw_sectors, but not
Tom> max_dev_sectors.

It would be pretty unusual for a device that is smart enough to report a
transfer length limit to be constrained to 1 MB and change.

@@ -2875,8 +2875,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
            logical_to_bytes(sdp, sdkp->opt_xfer_blocks) >= PAGE_SIZE) {
                q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
                rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
-       } else
+       } else {
                rw_max = BLK_DEF_MAX_SECTORS;
+               /* Combine with device limits */
+               rw_max = min(rw_max, q->limits.max_dev_sectors);
+       }
 
        /* Combine with controller limits */
        q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q));

If you want to fix this please drop the braces and do:

                rw_max = min(BLK_DEF_MAX_SECTORS, q->limits.max_dev_sectors);

-- 
Martin K. Petersen      Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to