remove blk_queue_max_phys_segments in libata
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 35 lines · Linux Kernel Mailing List
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8889e3c129780cdbe15fed3c366ba3aa3026684d Commit: 8889e3c129780cdbe15fed3c366ba3aa3026684d Parent: fd820f405574a30aacf9a859886e173d641f080b Author: FUJITA Tomonori <[email protected]> AuthorDate: Tue Sep 18 12:16:45 2007 +0200 Committer: Jens Axboe <[email protected]> CommitDate: Tue Oct 16 11:24:44 2007 +0200remove
blk_queue_max_phys_segmentsin libata
LIBATA_MAX_PRDis the maximum number of DMA scatter/gather elements permitted by the HBA's DMA engine. It's properly set toq->max_hw_segmentsvia thesg_tablesizeparameter.libata shouldn't call
blk_queue_max_phys_segments. NowLIBATA_MAX_PRDis equal toSCSI_MAX_PHYS_SEGMENTSby default (both is 128), so everything is fine. But if they are changed, some code (like the scsi mid layer, sg chaining, etc) might not work properly.(Addition from Jens) The basic issue is that the physical segment setting is purely a driver issue. And since SCSI is managing the sglist, libata has no business changing the setting. All libata should care about is the hw segment setting.
Signed-off-by FUJITA Tomonori <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- drivers/ata/libata-scsi.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)drivers/ata/libata-scsi.c +0
-0
drivers/ata/libata-scsi.c int ata_scsi_slave_config(struct scsi_device *sdev) · line 804
Quoted 6 lines
drivers/ata/libata-scsi.c +0
-2@@ -801,8 +801,6 @@ int ata_scsi_slave_config(struct scsi_device *sdev)ata_scsi_sdev_config (sdev); -blk_queue_max_phys_segments (sdev->request_queue,LIBATA_MAX_PRD ); - sdev->manage_start_stop =1 ;
As I noted when this first patch was posted... this line of code existed because the difference between hw-segments and phys-segments was incredibly difficult to discern. The names say basically the same thing to me, and I could find no documentation explaining the difference?
Does such documentation exist? If not, can you please explain the difference?
Finally, some notification and coordination would have been helpful. Commit 6c08772e49622e90d39903e7ff0be1a0f463ac86 appears to have been missed, at the very least... or is it actually correct?
Inquiring minds want to know, since I wasn't CC'd or kept in the loop :)
Jeff
Quoted 41 lines · Jeff Garzik
Quoted 40 lines · Linux Kernel Mailing List
Commit: 8889e3c129780cdbe15fed3c366ba3aa3026684d Parent: fd820f405574a30aacf9a859886e173d641f080b Author: FUJITA Tomonori <[email protected]> AuthorDate: Tue Sep 18 12:16:45 2007 +0200 Committer: Jens Axboe <[email protected]> CommitDate: Tue Oct 16 11:24:44 2007 +0200remove
blk_queue_max_phys_segmentsin libata
LIBATA_MAX_PRDis the maximum number of DMA scatter/gather elements permitted by the HBA's DMA engine. It's properly set toq->max_hw_segmentsvia thesg_tablesizeparameter.libata shouldn't call
blk_queue_max_phys_segments. NowLIBATA_MAX_PRDis equal toSCSI_MAX_PHYS_SEGMENTSby default (both is 128), so everything is fine. But if they are changed, some code (like the scsi mid layer, sg chaining, etc) might not work properly.(Addition from Jens) The basic issue is that the physical segment setting is purely a driver issue. And since SCSI is managing the sglist,
libata has no business changing the setting. All libata should care about is the hw segment setting.Signed-off-by FUJITA Tomonori <[email protected]>Signed-off-by Jens Axboe <[email protected]>---
drivers/ata/libata-scsi.c| 2 --1 files changed, 0 insertions(+), 2 deletions(-)drivers/ata/libata-scsi.c +0
-0@@ -801,8 +801,6 @@ int ata_scsi_slave_config(struct scsi_device *sdev)ata_scsi_sdev_config (sdev);
Quoted 8 lines
drivers/ata/libata-scsi.c int ata_scsi_slave_config(struct scsi_device *sdev) · line 804
Quoted 3 lines
drivers/ata/libata-scsi.c +0
-2-blk_queue_max_phys_segments (sdev->request_queue,LIBATA_MAX_PRD ); - sdev->manage_start_stop =1 ;As I noted when this first patch was posted... this line of code
existed because the difference between hw-segments and phys-segments was incredibly difficult to discern. The names say basically the same thing to me, and I could find no documentation explaining the difference?
We discussed this change to death afair, so I'm a little surprised you say that. The commit message itself has good reasoning as well.
Quoted 2 lines
Does such documentation exist? If not, can you please explain the difference?
OK, I can give a brief summary. The driver can set two restrictions - hardware and physical. I'm not sure who originally came up with the naming (I think it's prety terrible), but essentially the 'hardware' restriction is what the hardware can support (OK that name works) and the 'physical' restriction is imposed by the driver. Typically that last restriction has to do with structure limitations, like allocating stuff on the stack or limiting the size of the sgtable you have to allocate.
Quoted 1 line
Finally, some notification and coordination would have been helpful.
Confused, as I mentioned, we discussed this at quite some length a few months ago.
Quoted 2 lines
Commit
6c08772e49622e90d39903e7ff0be1a0f463ac86appears to have been missed, at the very least... or is it actually correct?
Depends on what you think it does. The number of hardware segments will never be larger than the physical segments. But it looks like you want to set the hw seg value there. As mentioned in the commit above, since libata doesn't allocate its own sg tables, letting it fiddle with the physical segment limit is dodgy at best.
Signature · 1 line
Jens Axboe