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

hpsa: Rearrange start_io to avoid one unlock/lock sequence in main io path

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Joe Handzik <joseph.t.handzik@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>

authored by

Stephen M. Cameron and committed by
Christoph Hellwig
0b57075d b3a52e79

+16 -8
+16 -8
drivers/scsi/hpsa.c
··· 194 194 static irqreturn_t do_hpsa_intr_intx(int irq, void *dev_id); 195 195 static irqreturn_t do_hpsa_intr_msi(int irq, void *dev_id); 196 196 static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg); 197 - static void start_io(struct ctlr_info *h); 197 + static void lock_and_start_io(struct ctlr_info *h); 198 + static void start_io(struct ctlr_info *h, unsigned long *flags); 198 199 199 200 #ifdef CONFIG_COMPAT 200 201 static int hpsa_compat_ioctl(struct scsi_device *dev, int cmd, void *arg); ··· 846 845 spin_lock_irqsave(&h->lock, flags); 847 846 addQ(&h->reqQ, c); 848 847 h->Qdepth++; 848 + start_io(h, &flags); 849 849 spin_unlock_irqrestore(&h->lock, flags); 850 - start_io(h); 851 850 } 852 851 853 852 static inline void removeQ(struct CommandList *c) ··· 5460 5459 5461 5460 /* Takes cmds off the submission queue and sends them to the hardware, 5462 5461 * then puts them on the queue of cmds waiting for completion. 5462 + * Assumes h->lock is held 5463 5463 */ 5464 - static void start_io(struct ctlr_info *h) 5464 + static void start_io(struct ctlr_info *h, unsigned long *flags) 5465 5465 { 5466 5466 struct CommandList *c; 5467 - unsigned long flags; 5468 5467 5469 - spin_lock_irqsave(&h->lock, flags); 5470 5468 while (!list_empty(&h->reqQ)) { 5471 5469 c = list_entry(h->reqQ.next, struct CommandList, list); 5472 5470 /* can't do anything if fifo is full */ ··· 5490 5490 h->commands_outstanding++; 5491 5491 5492 5492 /* Tell the controller execute command */ 5493 - spin_unlock_irqrestore(&h->lock, flags); 5493 + spin_unlock_irqrestore(&h->lock, *flags); 5494 5494 h->access.submit_command(h, c); 5495 - spin_lock_irqsave(&h->lock, flags); 5495 + spin_lock_irqsave(&h->lock, *flags); 5496 5496 } 5497 + } 5498 + 5499 + static void lock_and_start_io(struct ctlr_info *h) 5500 + { 5501 + unsigned long flags; 5502 + 5503 + spin_lock_irqsave(&h->lock, flags); 5504 + start_io(h, &flags); 5497 5505 spin_unlock_irqrestore(&h->lock, flags); 5498 5506 } 5499 5507 ··· 5569 5561 else if (c->cmd_type == CMD_IOCTL_PEND) 5570 5562 complete(c->waiting); 5571 5563 if (unlikely(io_may_be_stalled)) 5572 - start_io(h); 5564 + lock_and_start_io(h); 5573 5565 } 5574 5566 5575 5567 static inline u32 hpsa_tag_contains_index(u32 tag)