mirror of https://gitee.com/openkylin/linux.git
cciss: enqueue and submit io
Clean up some code where we subit our io. The same 5 lines appeared several times. Also helps for a following patch. Signed-off-by: Mike Miller <mike.miller@hp.com> Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
This commit is contained in:
parent
9fe6206f40
commit
664a717d3a
|
@ -257,6 +257,17 @@ static inline void removeQ(CommandList_struct *c)
|
||||||
hlist_del_init(&c->list);
|
hlist_del_init(&c->list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void enqueue_cmd_and_start_io(ctlr_info_t *h,
|
||||||
|
CommandList_struct *c)
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
spin_lock_irqsave(&h->lock, flags);
|
||||||
|
addQ(&h->reqQ, c);
|
||||||
|
h->Qdepth++;
|
||||||
|
start_io(h);
|
||||||
|
spin_unlock_irqrestore(&h->lock, flags);
|
||||||
|
}
|
||||||
|
|
||||||
static void cciss_free_sg_chain_blocks(SGDescriptor_struct **cmd_sg_list,
|
static void cciss_free_sg_chain_blocks(SGDescriptor_struct **cmd_sg_list,
|
||||||
int nr_cmds)
|
int nr_cmds)
|
||||||
{
|
{
|
||||||
|
@ -1377,7 +1388,6 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
|
||||||
CommandList_struct *c;
|
CommandList_struct *c;
|
||||||
char *buff = NULL;
|
char *buff = NULL;
|
||||||
u64bit temp64;
|
u64bit temp64;
|
||||||
unsigned long flags;
|
|
||||||
DECLARE_COMPLETION_ONSTACK(wait);
|
DECLARE_COMPLETION_ONSTACK(wait);
|
||||||
|
|
||||||
if (!arg)
|
if (!arg)
|
||||||
|
@ -1449,13 +1459,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
|
||||||
}
|
}
|
||||||
c->waiting = &wait;
|
c->waiting = &wait;
|
||||||
|
|
||||||
/* Put the request on the tail of the request queue */
|
enqueue_cmd_and_start_io(host, c);
|
||||||
spin_lock_irqsave(CCISS_LOCK(ctlr), flags);
|
|
||||||
addQ(&host->reqQ, c);
|
|
||||||
host->Qdepth++;
|
|
||||||
start_io(host);
|
|
||||||
spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
|
|
||||||
|
|
||||||
wait_for_completion(&wait);
|
wait_for_completion(&wait);
|
||||||
|
|
||||||
/* unlock the buffers from DMA */
|
/* unlock the buffers from DMA */
|
||||||
|
@ -1495,7 +1499,6 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
|
||||||
unsigned char **buff = NULL;
|
unsigned char **buff = NULL;
|
||||||
int *buff_size = NULL;
|
int *buff_size = NULL;
|
||||||
u64bit temp64;
|
u64bit temp64;
|
||||||
unsigned long flags;
|
|
||||||
BYTE sg_used = 0;
|
BYTE sg_used = 0;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1602,12 +1605,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c->waiting = &wait;
|
c->waiting = &wait;
|
||||||
/* Put the request on the tail of the request queue */
|
enqueue_cmd_and_start_io(host, c);
|
||||||
spin_lock_irqsave(CCISS_LOCK(ctlr), flags);
|
|
||||||
addQ(&host->reqQ, c);
|
|
||||||
host->Qdepth++;
|
|
||||||
start_io(host);
|
|
||||||
spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
|
|
||||||
wait_for_completion(&wait);
|
wait_for_completion(&wait);
|
||||||
/* unlock the buffers from DMA */
|
/* unlock the buffers from DMA */
|
||||||
for (i = 0; i < sg_used; i++) {
|
for (i = 0; i < sg_used; i++) {
|
||||||
|
@ -1729,8 +1727,8 @@ static void cciss_softirq_done(struct request *rq)
|
||||||
CommandList_struct *cmd = rq->completion_data;
|
CommandList_struct *cmd = rq->completion_data;
|
||||||
ctlr_info_t *h = hba[cmd->ctlr];
|
ctlr_info_t *h = hba[cmd->ctlr];
|
||||||
SGDescriptor_struct *curr_sg = cmd->SG;
|
SGDescriptor_struct *curr_sg = cmd->SG;
|
||||||
unsigned long flags;
|
|
||||||
u64bit temp64;
|
u64bit temp64;
|
||||||
|
unsigned long flags;
|
||||||
int i, ddir;
|
int i, ddir;
|
||||||
int sg_index = 0;
|
int sg_index = 0;
|
||||||
|
|
||||||
|
@ -2679,17 +2677,11 @@ static int sendcmd_withirq_core(ctlr_info_t *h, CommandList_struct *c,
|
||||||
{
|
{
|
||||||
DECLARE_COMPLETION_ONSTACK(wait);
|
DECLARE_COMPLETION_ONSTACK(wait);
|
||||||
u64bit buff_dma_handle;
|
u64bit buff_dma_handle;
|
||||||
unsigned long flags;
|
|
||||||
int return_status = IO_OK;
|
int return_status = IO_OK;
|
||||||
|
|
||||||
resend_cmd2:
|
resend_cmd2:
|
||||||
c->waiting = &wait;
|
c->waiting = &wait;
|
||||||
/* Put the request on the tail of the queue and send it */
|
enqueue_cmd_and_start_io(h, c);
|
||||||
spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
|
|
||||||
addQ(&h->reqQ, c);
|
|
||||||
h->Qdepth++;
|
|
||||||
start_io(h);
|
|
||||||
spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
|
|
||||||
|
|
||||||
wait_for_completion(&wait);
|
wait_for_completion(&wait);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue