diff options
author | James Bottomley <James.Bottomley@steeleye.com> | 2006-08-30 09:45:51 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-08-31 11:18:03 -0400 |
commit | 86e33a296c2c9ed6eece0bfff4ac776f42040504 (patch) | |
tree | 7c4a11084b233e1899aec6c247435f3478bbd3b5 | |
parent | 492dfb489658dfe4a755fa29dd0e34e9c8bd8fb8 (diff) |
[SCSI] add shared tag map helpers
This patch adds support for sharing tag maps at the host level
(i.e. either every queue [LUN] has its own tag map or there's a single
one for the entire host). This formulation is primarily intended to
help single issue queue hardware, like the aic7xxx
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/hosts.c | 3 | ||||
-rw-r--r-- | include/scsi/scsi_host.h | 7 | ||||
-rw-r--r-- | include/scsi/scsi_tcq.h | 14 |
3 files changed, 23 insertions, 1 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index f244d4f6597a..68ef1636678d 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -265,6 +265,9 @@ static void scsi_host_dev_release(struct device *dev) | |||
265 | destroy_workqueue(shost->work_q); | 265 | destroy_workqueue(shost->work_q); |
266 | 266 | ||
267 | scsi_destroy_command_freelist(shost); | 267 | scsi_destroy_command_freelist(shost); |
268 | if (shost->bqt) | ||
269 | blk_free_tags(shost->bqt); | ||
270 | |||
268 | kfree(shost->shost_data); | 271 | kfree(shost->shost_data); |
269 | 272 | ||
270 | if (parent) | 273 | if (parent) |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index b3dd90f3e858..39c6f8cc20c3 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -16,6 +16,7 @@ struct scsi_target; | |||
16 | struct Scsi_Host; | 16 | struct Scsi_Host; |
17 | struct scsi_host_cmd_pool; | 17 | struct scsi_host_cmd_pool; |
18 | struct scsi_transport_template; | 18 | struct scsi_transport_template; |
19 | struct blk_queue_tags; | ||
19 | 20 | ||
20 | 21 | ||
21 | /* | 22 | /* |
@@ -466,6 +467,12 @@ struct Scsi_Host { | |||
466 | struct scsi_transport_template *transportt; | 467 | struct scsi_transport_template *transportt; |
467 | 468 | ||
468 | /* | 469 | /* |
470 | * area to keep a shared tag map (if needed, will be | ||
471 | * NULL if not) | ||
472 | */ | ||
473 | struct blk_queue_tag *bqt; | ||
474 | |||
475 | /* | ||
469 | * The following two fields are protected with host_lock; | 476 | * The following two fields are protected with host_lock; |
470 | * however, eh routines can safely access during eh processing | 477 | * however, eh routines can safely access during eh processing |
471 | * without acquiring the lock. | 478 | * without acquiring the lock. |
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index e47e36a4ef49..4eea254b1ce9 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/blkdev.h> | 4 | #include <linux/blkdev.h> |
5 | #include <scsi/scsi_cmnd.h> | 5 | #include <scsi/scsi_cmnd.h> |
6 | #include <scsi/scsi_device.h> | 6 | #include <scsi/scsi_device.h> |
7 | #include <scsi/scsi_host.h> | ||
7 | 8 | ||
8 | 9 | ||
9 | #define MSG_SIMPLE_TAG 0x20 | 10 | #define MSG_SIMPLE_TAG 0x20 |
@@ -66,7 +67,8 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth) | |||
66 | return; | 67 | return; |
67 | 68 | ||
68 | if (!blk_queue_tagged(sdev->request_queue)) | 69 | if (!blk_queue_tagged(sdev->request_queue)) |
69 | blk_queue_init_tags(sdev->request_queue, depth, NULL); | 70 | blk_queue_init_tags(sdev->request_queue, depth, |
71 | sdev->host->bqt); | ||
70 | 72 | ||
71 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); | 73 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); |
72 | } | 74 | } |
@@ -131,4 +133,14 @@ static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag) | |||
131 | return sdev->current_cmnd; | 133 | return sdev->current_cmnd; |
132 | } | 134 | } |
133 | 135 | ||
136 | /** | ||
137 | * scsi_init_shared_tag_map - create a shared tag map | ||
138 | * @shost: the host to share the tag map among all devices | ||
139 | * @depth: the total depth of the map | ||
140 | */ | ||
141 | static inline void scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth) | ||
142 | { | ||
143 | shost->bqt = blk_init_tags(depth); | ||
144 | } | ||
145 | |||
134 | #endif /* _SCSI_SCSI_TCQ_H */ | 146 | #endif /* _SCSI_SCSI_TCQ_H */ |