All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] libata-scsi: set max_hw_sectors again only when dev->max_sectors is set
@ 2016-08-09 14:45 tom.ty89
  2016-08-09 14:45 ` [PATCH v2 2/2] libata-core: do not set dev->max_sectors for LBA48 devices tom.ty89
  0 siblings, 1 reply; 14+ messages in thread
From: tom.ty89 @ 2016-08-09 14:45 UTC (permalink / raw)
  To: tj; +Cc: linux-ide, linux-scsi, linux-block, Tom Yan

From: Tom Yan <tom.ty89@gmail.com>

When the request queue is initialized (see __scsi_init_queue() in
scsi_lib.c), the block layer limit max_hw_sectors is set to
shost->max_sectors, which will be set to the "machine infinity"
SCSI_DEFAULT_MAX_SECTORS (currently 1024) if sht->max_sectors is
not set (see scsi_host_alloc() in hosts.c).

Therefore, if dev->max_sectors is not set (or, initialized to 0),
we do not call blk_queue_max_hw_sectors() again with that.

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 2bdb5da..6fee950 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1205,7 +1205,8 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
 		dev->flags |= ATA_DFLAG_NO_UNLOAD;
 
 	/* configure max sectors */
-	blk_queue_max_hw_sectors(q, dev->max_sectors);
+	if (dev->max_sectors)
+		blk_queue_max_hw_sectors(q, dev->max_sectors);
 
 	if (dev->class == ATA_DEV_ATAPI) {
 		void *buf;
-- 
2.9.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-08-12 21:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-09 14:45 [PATCH v2 1/2] libata-scsi: set max_hw_sectors again only when dev->max_sectors is set tom.ty89
2016-08-09 14:45 ` [PATCH v2 2/2] libata-core: do not set dev->max_sectors for LBA48 devices tom.ty89
2016-08-09 16:50   ` Sergei Shtylyov
2016-08-10  4:10   ` Tejun Heo
2016-08-10  8:32     ` Tom Yan
2016-08-10 15:22       ` Tejun Heo
2016-08-11  3:37       ` Martin K. Petersen
2016-08-11  9:30         ` Tom Yan
2016-08-12  2:01           ` Martin K. Petersen
2016-08-12  5:18             ` Tom Yan
2016-08-12  8:17               ` Tom Yan
2016-08-12 21:06               ` Martin K. Petersen
2016-08-12  9:16             ` One Thousand Gnomes
2016-08-12 21:17               ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.