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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tom Yan <tom.ty89@xxxxxxxxx>

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 --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 */
-- 
2.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux