diff mbox

[2/2] libata: do not set max_sectors for LBA48 device

Message ID e821f2b2223669535ae68e377c89c17c5c0237cf.1470738284.git.tom.ty89@gmail.com
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Tom Yan Aug. 9, 2016, 10:31 a.m. UTC
From: Tom Yan <tom.ty89@gmail.com>

Along with commit 1dc8fff24187 ("libata-scsi: do not call
blk_queue_max_hw_sectors()"), devices with LBA48 support will have
max_sectors set to SCSI_DEFAULT_MAX_SECTORS (currently 1024), by
the scsi driver.

Note that the "max_sectors" here is actually the block layer limit
"max_hw_sectors", while the block layer limit "max_sectors" (which
is upper-bounded by "max_hw_sectors") will be set to
BLK_DEF_MAX_SECTORS (currently 2560) by the scsi disk driver, since
our SATL does not report an Optimal Transfer Length.

Therefore, it should make more sense to have the "max_sectors" here
set to SCSI_DEFAULT_MAX_SECTORS, so that both of the block layer
limits will be set to 1024, than to have "max_hw_sectors" set to
65535 and have "max_sectors" set to 2560. Not to mention that
neither of them seems to be a "safe" value (see
ATA_HORKAGE_MAX_SEC_1024).

Besides, it is in doubt that whether having max_sectors (for a
single drive, which is our case) set to a value higher than 1024
would actually improve performance anyway.
diff mbox

Patch

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 0749f71..2a08458 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2408,7 +2408,6 @@  int ata_dev_configure(struct ata_device *dev)
 
 	/* initialize to-be-configured parameters */
 	dev->flags &= ~ATA_DFLAG_CFG_MASK;
-	dev->max_sectors = 0;
 	dev->cdb_len = 0;
 	dev->n_sectors = 0;
 	dev->cylinders = 0;
@@ -2610,10 +2609,8 @@  int ata_dev_configure(struct ata_device *dev)
 				     dma_dir_string);
 	}
 
-	/* determine max_sectors */
-	dev->max_sectors = ATA_MAX_SECTORS;
-	if (dev->flags & ATA_DFLAG_LBA48)
-		dev->max_sectors = ATA_MAX_SECTORS_LBA48;
+	if (!(dev->flags & ATA_DFLAG_LBA48))
+		dev->max_sectors = ATA_MAX_SECTORS;
 
 	/* Limit PATA drive on SATA cable bridge transfers to udma5,
 	   200 sectors */