Commit 9e0fc764eaec082cd2ffcf82568dfdd086935934

Authored by Stephen M. Cameron
Committed by James Bottomley
1 parent 5767a1c498

[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>

Showing 3 changed files with 14 additions and 15 deletions Side-by-side Diff

... ... @@ -314,9 +314,9 @@
314 314 }
315 315  
316 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 322 static inline u32 next_command(struct ctlr_info *h)
323 323  
... ... @@ -366,9 +366,9 @@
366 366  
367 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 370 return;
371   - hlist_del_init(&c->list);
  371 + list_del_init(&c->list);
372 372 }
373 373  
374 374 static inline int is_hba_lunid(unsigned char scsi3addr[])
... ... @@ -2228,7 +2228,7 @@
2228 2228  
2229 2229 c->cmdindex = i;
2230 2230  
2231   - INIT_HLIST_NODE(&c->list);
  2231 + INIT_LIST_HEAD(&c->list);
2232 2232 c->busaddr = (u32) cmd_dma_handle;
2233 2233 temp64.val = (u64) err_dma_handle;
2234 2234 c->ErrDesc.Addr.lower = temp64.val32.lower;
... ... @@ -2266,7 +2266,7 @@
2266 2266 }
2267 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 2270 c->busaddr = (u32) cmd_dma_handle;
2271 2271 temp64.val = (u64) err_dma_handle;
2272 2272 c->ErrDesc.Addr.lower = temp64.val32.lower;
... ... @@ -2837,8 +2837,8 @@
2837 2837 {
2838 2838 struct CommandList *c;
2839 2839  
2840   - while (!hlist_empty(&h->reqQ)) {
2841   - c = hlist_entry(h->reqQ.first, struct CommandList, list);
  2840 + while (!list_empty(&h->reqQ)) {
  2841 + c = list_entry(h->reqQ.next, struct CommandList, list);
2842 2842 /* can't do anything if fifo is full */
2843 2843 if ((h->access.fifo_full(h))) {
2844 2844 dev_warn(&h->pdev->dev, "fifo full\n");
2845 2845  
... ... @@ -2929,10 +2929,9 @@
2929 2929 {
2930 2930 u32 tag;
2931 2931 struct CommandList *c = NULL;
2932   - struct hlist_node *tmp;
2933 2932  
2934 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 2935 if ((c->busaddr & 0xFFFFFFE0) == (tag & 0xFFFFFFE0)) {
2937 2936 finish_cmd(c, raw_tag);
2938 2937 return next_command(h);
... ... @@ -3761,8 +3760,8 @@
3761 3760  
3762 3761 h->pdev = pdev;
3763 3762 h->busy_initializing = 1;
3764   - INIT_HLIST_HEAD(&h->cmpQ);
3765   - INIT_HLIST_HEAD(&h->reqQ);
  3763 + INIT_LIST_HEAD(&h->cmpQ);
  3764 + INIT_LIST_HEAD(&h->reqQ);
3766 3765 spin_lock_init(&h->lock);
3767 3766 spin_lock_init(&h->scan_lock);
3768 3767 rc = hpsa_pci_init(h);
... ... @@ -75,8 +75,8 @@
75 75 struct access_method access;
76 76  
77 77 /* queue and queue Info */
78   - struct hlist_head reqQ;
79   - struct hlist_head cmpQ;
  78 + struct list_head reqQ;
  79 + struct list_head cmpQ;
80 80 unsigned int Qdepth;
81 81 unsigned int maxQsinceinit;
82 82 unsigned int maxSG;
drivers/scsi/hpsa_cmd.h
... ... @@ -292,7 +292,7 @@
292 292 struct ctlr_info *h;
293 293 int cmd_type;
294 294 long cmdindex;
295   - struct hlist_node list;
  295 + struct list_head list;
296 296 struct request *rq;
297 297 struct completion *waiting;
298 298 void *scsi_cmd;