Re: [PATCH 1/2] libata-scsi: use dev->max_sectors from libata-core appropriately
From: Tom Yan <hidden>
Date: 2016-08-12 14:36:23
Also in:
linux-ide, linux-scsi
On 12 August 2016 at 21:42, Sergei Shtylyov [off-list ref] wrote:
On 08/12/2016 02:56 PM, tom.ty89@gmail.com wrote:quoted
From: Tom Yan <redacted> Currently we use dev->max_sectors to set max_hw_sectors, which is actually supposed to be a host controller limit (that get setGets.
Thanks, but I read too late. I'll try to bare in mind to correct that if I'll need to send a v3 or so.
quoted
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index be9c76c..4e2d8e7 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c@@ -1204,14 +1204,26 @@ static int ata_scsi_dev_config(struct scsi_device*sdev, if (!ata_id_has_unload(dev->id)) dev->flags |= ATA_DFLAG_NO_UNLOAD; - /* configure max sectors */ - blk_queue_max_hw_sectors(q, dev->max_sectors); - if (dev->class == ATA_DEV_ATAPI) { void *buf; sdev->sector_size = ATA_SECT_SIZE; + /* + * We are setting the limit here merely because CD/DVD device does not + * have Block Limits VPD. + * + * Supposedly dev->max_sectors should be left shifted by + * (ilog2(sdev->sector_size) - 9). But since ATAPI class device has a + * static logical sector size of 512 (ATA_SECT_SIZE), the shift became + * unnecessary. + */ + q->limits.max_dev_sectors = dev->max_sectors; + /* Make max_dev_sectors effective by adjusting max_sectors accordingly, + while leave max_hw_sectors, which is supposed to be host controller + limit, untouched. */Why 2 different comment styles? The previous comment's style is actually preferred in the kernel.
I just tried to follow the styles of the existing comments. Apparently the first style is used for multi-paragraph comments, while the other one is used for single-paragraph one.