diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2011-02-15 16:32:48 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-02-18 13:31:19 -0500 |
commit | 9e0fc764eaec082cd2ffcf82568dfdd086935934 (patch) | |
tree | 85a9a3829b8e0ed285e989beb074a9c466574091 | |
parent | 5767a1c498931417e69e663ddd5e110cbaabec32 (diff) |
[SCSI] hpsa: do not re-order commands in internal queues
Driver's internal queues should be FIFO, not LIFO.
This is a port of an almost identical patch from cciss by Jens Axboe.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/scsi/hpsa.c | 23 | ||||
-rw-r--r-- | drivers/scsi/hpsa.h | 4 | ||||
-rw-r--r-- | drivers/scsi/hpsa_cmd.h | 2 |
3 files changed, 14 insertions, 15 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 959eeb202d92..0f40de2a33de 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -314,9 +314,9 @@ static ssize_t host_show_commands_outstanding(struct device *dev, | |||
314 | } | 314 | } |
315 | 315 | ||
316 | /* Enqueuing and dequeuing functions for cmdlists. */ | 316 | /* Enqueuing and dequeuing functions for cmdlists. */ |
317 | static inline void addQ(struct hlist_head *list, struct CommandList *c) | 317 | static inline void addQ(struct list_head *list, struct CommandList *c) |
318 | { | 318 | { |
319 | hlist_add_head(&c->list, list); | 319 | list_add_tail(&c->list, list); |
320 | } | 320 | } |
321 | 321 | ||
322 | static inline u32 next_command(struct ctlr_info *h) | 322 | static inline u32 next_command(struct ctlr_info *h) |
@@ -366,9 +366,9 @@ static void enqueue_cmd_and_start_io(struct ctlr_info *h, | |||
366 | 366 | ||
367 | static inline void removeQ(struct CommandList *c) | 367 | static inline void removeQ(struct CommandList *c) |
368 | { | 368 | { |
369 | if (WARN_ON(hlist_unhashed(&c->list))) | 369 | if (WARN_ON(list_empty(&c->list))) |
370 | return; | 370 | return; |
371 | hlist_del_init(&c->list); | 371 | list_del_init(&c->list); |
372 | } | 372 | } |
373 | 373 | ||
374 | static inline int is_hba_lunid(unsigned char scsi3addr[]) | 374 | static inline int is_hba_lunid(unsigned char scsi3addr[]) |
@@ -2228,7 +2228,7 @@ static struct CommandList *cmd_alloc(struct ctlr_info *h) | |||
2228 | 2228 | ||
2229 | c->cmdindex = i; | 2229 | c->cmdindex = i; |
2230 | 2230 | ||
2231 | INIT_HLIST_NODE(&c->list); | 2231 | INIT_LIST_HEAD(&c->list); |
2232 | c->busaddr = (u32) cmd_dma_handle; | 2232 | c->busaddr = (u32) cmd_dma_handle; |
2233 | temp64.val = (u64) err_dma_handle; | 2233 | temp64.val = (u64) err_dma_handle; |
2234 | c->ErrDesc.Addr.lower = temp64.val32.lower; | 2234 | c->ErrDesc.Addr.lower = temp64.val32.lower; |
@@ -2266,7 +2266,7 @@ static struct CommandList *cmd_special_alloc(struct ctlr_info *h) | |||
2266 | } | 2266 | } |
2267 | memset(c->err_info, 0, sizeof(*c->err_info)); | 2267 | memset(c->err_info, 0, sizeof(*c->err_info)); |
2268 | 2268 | ||
2269 | INIT_HLIST_NODE(&c->list); | 2269 | INIT_LIST_HEAD(&c->list); |
2270 | c->busaddr = (u32) cmd_dma_handle; | 2270 | c->busaddr = (u32) cmd_dma_handle; |
2271 | temp64.val = (u64) err_dma_handle; | 2271 | temp64.val = (u64) err_dma_handle; |
2272 | c->ErrDesc.Addr.lower = temp64.val32.lower; | 2272 | c->ErrDesc.Addr.lower = temp64.val32.lower; |
@@ -2837,8 +2837,8 @@ static void start_io(struct ctlr_info *h) | |||
2837 | { | 2837 | { |
2838 | struct CommandList *c; | 2838 | struct CommandList *c; |
2839 | 2839 | ||
2840 | while (!hlist_empty(&h->reqQ)) { | 2840 | while (!list_empty(&h->reqQ)) { |
2841 | c = hlist_entry(h->reqQ.first, struct CommandList, list); | 2841 | c = list_entry(h->reqQ.next, struct CommandList, list); |
2842 | /* can't do anything if fifo is full */ | 2842 | /* can't do anything if fifo is full */ |
2843 | if ((h->access.fifo_full(h))) { | 2843 | if ((h->access.fifo_full(h))) { |
2844 | dev_warn(&h->pdev->dev, "fifo full\n"); | 2844 | dev_warn(&h->pdev->dev, "fifo full\n"); |
@@ -2929,10 +2929,9 @@ static inline u32 process_nonindexed_cmd(struct ctlr_info *h, | |||
2929 | { | 2929 | { |
2930 | u32 tag; | 2930 | u32 tag; |
2931 | struct CommandList *c = NULL; | 2931 | struct CommandList *c = NULL; |
2932 | struct hlist_node *tmp; | ||
2933 | 2932 | ||
2934 | tag = hpsa_tag_discard_error_bits(raw_tag); | 2933 | tag = hpsa_tag_discard_error_bits(raw_tag); |
2935 | hlist_for_each_entry(c, tmp, &h->cmpQ, list) { | 2934 | list_for_each_entry(c, &h->cmpQ, list) { |
2936 | if ((c->busaddr & 0xFFFFFFE0) == (tag & 0xFFFFFFE0)) { | 2935 | if ((c->busaddr & 0xFFFFFFE0) == (tag & 0xFFFFFFE0)) { |
2937 | finish_cmd(c, raw_tag); | 2936 | finish_cmd(c, raw_tag); |
2938 | return next_command(h); | 2937 | return next_command(h); |
@@ -3761,8 +3760,8 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev, | |||
3761 | 3760 | ||
3762 | h->pdev = pdev; | 3761 | h->pdev = pdev; |
3763 | h->busy_initializing = 1; | 3762 | h->busy_initializing = 1; |
3764 | INIT_HLIST_HEAD(&h->cmpQ); | 3763 | INIT_LIST_HEAD(&h->cmpQ); |
3765 | INIT_HLIST_HEAD(&h->reqQ); | 3764 | INIT_LIST_HEAD(&h->reqQ); |
3766 | spin_lock_init(&h->lock); | 3765 | spin_lock_init(&h->lock); |
3767 | spin_lock_init(&h->scan_lock); | 3766 | spin_lock_init(&h->scan_lock); |
3768 | rc = hpsa_pci_init(h); | 3767 | rc = hpsa_pci_init(h); |
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h index 074d237f4497..e89819342364 100644 --- a/drivers/scsi/hpsa.h +++ b/drivers/scsi/hpsa.h | |||
@@ -75,8 +75,8 @@ struct ctlr_info { | |||
75 | struct access_method access; | 75 | struct access_method access; |
76 | 76 | ||
77 | /* queue and queue Info */ | 77 | /* queue and queue Info */ |
78 | struct hlist_head reqQ; | 78 | struct list_head reqQ; |
79 | struct hlist_head cmpQ; | 79 | struct list_head cmpQ; |
80 | unsigned int Qdepth; | 80 | unsigned int Qdepth; |
81 | unsigned int maxQsinceinit; | 81 | unsigned int maxQsinceinit; |
82 | unsigned int maxSG; | 82 | unsigned int maxSG; |
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h index 7910c1411156..785abdd0333c 100644 --- a/drivers/scsi/hpsa_cmd.h +++ b/drivers/scsi/hpsa_cmd.h | |||
@@ -292,7 +292,7 @@ struct CommandList { | |||
292 | struct ctlr_info *h; | 292 | struct ctlr_info *h; |
293 | int cmd_type; | 293 | int cmd_type; |
294 | long cmdindex; | 294 | long cmdindex; |
295 | struct hlist_node list; | 295 | struct list_head list; |
296 | struct request *rq; | 296 | struct request *rq; |
297 | struct completion *waiting; | 297 | struct completion *waiting; |
298 | void *scsi_cmd; | 298 | void *scsi_cmd; |