Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cciss: Remove no longer needed sendcmd reject processing code

Now that the cciss SCSI error handling routines operate with interrupts
enabled, we no longer need to maintain the list of command completions that
sendcmd() might inadvertantly scoop up, since now it only runs at driver init
time, and there won't be any other commands for it to scoop up. So we
can remove that list and the code that adds to it and processes it.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

authored by

scameron@beardog.cca.cpqcorp.net and committed by
Jens Axboe
72f9f132 85cc61ae

+3 -104
+3 -95
drivers/block/cciss.c
··· 2612 2612 return 1; 2613 2613 } 2614 2614 2615 - static int add_sendcmd_reject(__u8 cmd, int ctlr, unsigned long complete) 2616 - { 2617 - /* We get in here if sendcmd() is polling for completions 2618 - and gets some command back that it wasn't expecting -- 2619 - something other than that which it just sent down. 2620 - Ordinarily, that shouldn't happen, but it can happen when 2621 - the scsi tape stuff gets into error handling mode, and 2622 - starts using sendcmd() to try to abort commands and 2623 - reset tape drives. In that case, sendcmd may pick up 2624 - completions of commands that were sent to logical drives 2625 - through the block i/o system, or cciss ioctls completing, etc. 2626 - In that case, we need to save those completions for later 2627 - processing by the interrupt handler. 2628 - */ 2629 - 2630 - #ifdef CONFIG_CISS_SCSI_TAPE 2631 - struct sendcmd_reject_list *srl = &hba[ctlr]->scsi_rejects; 2632 - 2633 - /* If it's not the scsi tape stuff doing error handling, (abort */ 2634 - /* or reset) then we don't expect anything weird. */ 2635 - if (cmd != CCISS_RESET_MSG && cmd != CCISS_ABORT_MSG) { 2636 - #endif 2637 - printk(KERN_WARNING "cciss cciss%d: SendCmd " 2638 - "Invalid command list address returned! (%lx)\n", 2639 - ctlr, complete); 2640 - /* not much we can do. */ 2641 - #ifdef CONFIG_CISS_SCSI_TAPE 2642 - return 1; 2643 - } 2644 - 2645 - /* We've sent down an abort or reset, but something else 2646 - has completed */ 2647 - if (srl->ncompletions >= (hba[ctlr]->nr_cmds + 2)) { 2648 - /* Uh oh. No room to save it for later... */ 2649 - printk(KERN_WARNING "cciss%d: Sendcmd: Invalid command addr, " 2650 - "reject list overflow, command lost!\n", ctlr); 2651 - return 1; 2652 - } 2653 - /* Save it for later */ 2654 - srl->complete[srl->ncompletions] = complete; 2655 - srl->ncompletions++; 2656 - #endif 2657 - return 0; 2658 - } 2659 - 2660 2615 /* Send command c to controller h and poll for it to complete. 2661 2616 * Turns interrupts off on the board. Used at driver init time 2662 2617 * and during SCSI error recovery. ··· 2656 2701 break; 2657 2702 } 2658 2703 2659 - /* If it's not the cmd we're looking for, save it for later */ 2704 + /* Make sure it's the command we're expecting. */ 2660 2705 if ((complete & ~CISS_ERROR_BIT) != c->busaddr) { 2661 - if (add_sendcmd_reject(c->Request.CDB[0], 2662 - h->ctlr, complete) != 0) 2663 - BUG(); /* we are hosed if we get here. */ 2706 + printk(KERN_WARNING "cciss%d: Unexpected command " 2707 + "completion.\n", h->ctlr); 2664 2708 continue; 2665 2709 } 2666 2710 ··· 2724 2770 buff_dma_handle.val32.upper = c->SG[0].Addr.upper; 2725 2771 pci_unmap_single(h->pdev, (dma_addr_t) buff_dma_handle.val, 2726 2772 c->SG[0].Len, PCI_DMA_BIDIRECTIONAL); 2727 - #ifdef CONFIG_CISS_SCSI_TAPE 2728 - /* if we saved some commands for later, process them now. */ 2729 - if (h->scsi_rejects.ncompletions > 0) 2730 - do_cciss_intr(0, h); 2731 - #endif 2732 2773 return status; 2733 2774 } 2734 2775 ··· 3144 3195 3145 3196 static inline unsigned long get_next_completion(ctlr_info_t *h) 3146 3197 { 3147 - #ifdef CONFIG_CISS_SCSI_TAPE 3148 - /* Any rejects from sendcmd() lying around? Process them first */ 3149 - if (h->scsi_rejects.ncompletions == 0) 3150 - return h->access.command_completed(h); 3151 - else { 3152 - struct sendcmd_reject_list *srl; 3153 - int n; 3154 - srl = &h->scsi_rejects; 3155 - n = --srl->ncompletions; 3156 - /* printk("cciss%d: processing saved reject\n", h->ctlr); */ 3157 - printk("p"); 3158 - return srl->complete[n]; 3159 - } 3160 - #else 3161 3198 return h->access.command_completed(h); 3162 - #endif 3163 3199 } 3164 3200 3165 3201 static inline int interrupt_pending(ctlr_info_t *h) 3166 3202 { 3167 - #ifdef CONFIG_CISS_SCSI_TAPE 3168 - return (h->access.intr_pending(h) 3169 - || (h->scsi_rejects.ncompletions > 0)); 3170 - #else 3171 3203 return h->access.intr_pending(h); 3172 - #endif 3173 3204 } 3174 3205 3175 3206 static inline long interrupt_not_for_us(ctlr_info_t *h) 3176 3207 { 3177 - #ifdef CONFIG_CISS_SCSI_TAPE 3178 - return (((h->access.intr_pending(h) == 0) || 3179 - (h->interrupts_enabled == 0)) 3180 - && (h->scsi_rejects.ncompletions == 0)); 3181 - #else 3182 3208 return (((h->access.intr_pending(h) == 0) || 3183 3209 (h->interrupts_enabled == 0))); 3184 - #endif 3185 3210 } 3186 3211 3187 3212 static irqreturn_t do_cciss_intr(int irq, void *dev_id) ··· 3977 4054 printk(KERN_ERR "cciss: out of memory"); 3978 4055 goto clean4; 3979 4056 } 3980 - #ifdef CONFIG_CISS_SCSI_TAPE 3981 - hba[i]->scsi_rejects.complete = 3982 - kmalloc(sizeof(hba[i]->scsi_rejects.complete[0]) * 3983 - (hba[i]->nr_cmds + 5), GFP_KERNEL); 3984 - if (hba[i]->scsi_rejects.complete == NULL) { 3985 - printk(KERN_ERR "cciss: out of memory"); 3986 - goto clean4; 3987 - } 3988 - #endif 3989 4057 spin_lock_init(&hba[i]->lock); 3990 4058 3991 4059 /* Initialize the pdev driver private data. ··· 4036 4122 4037 4123 clean4: 4038 4124 kfree(inq_buff); 4039 - #ifdef CONFIG_CISS_SCSI_TAPE 4040 - kfree(hba[i]->scsi_rejects.complete); 4041 - #endif 4042 4125 kfree(hba[i]->cmd_pool_bits); 4043 4126 if (hba[i]->cmd_pool) 4044 4127 pci_free_consistent(hba[i]->pdev, ··· 4153 4242 pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(ErrorInfo_struct), 4154 4243 hba[i]->errinfo_pool, hba[i]->errinfo_pool_dhandle); 4155 4244 kfree(hba[i]->cmd_pool_bits); 4156 - #ifdef CONFIG_CISS_SCSI_TAPE 4157 - kfree(hba[i]->scsi_rejects.complete); 4158 - #endif 4159 4245 /* 4160 4246 * Deliberately omit pci_disable_device(): it does something nasty to 4161 4247 * Smart Array controllers that pci_enable_device does not undo
-9
drivers/block/cciss.h
··· 53 53 char rev[REV_LEN + 1]; /* SCSI revision string */ 54 54 } drive_info_struct; 55 55 56 - #ifdef CONFIG_CISS_SCSI_TAPE 57 - 58 - struct sendcmd_reject_list { 59 - int ncompletions; 60 - unsigned long *complete; /* array of NR_CMDS tags */ 61 - }; 62 - 63 - #endif 64 56 struct ctlr_info 65 57 { 66 58 int ctlr; ··· 120 128 void *scsi_ctlr; /* ptr to structure containing scsi related stuff */ 121 129 /* list of block side commands the scsi error handling sucked up */ 122 130 /* and saved for later processing */ 123 - struct sendcmd_reject_list scsi_rejects; 124 131 #endif 125 132 unsigned char alive; 126 133 struct completion *rescan_wait;