aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-core.c48
-rw-r--r--drivers/block/sx8.c12
-rw-r--r--include/linux/blkdev.h1
3 files changed, 8 insertions, 53 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index ea70e6c80cd3..435af2378614 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1010,54 +1010,6 @@ static void add_acct_request(struct request_queue *q, struct request *rq,
1010 __elv_add_request(q, rq, where); 1010 __elv_add_request(q, rq, where);
1011} 1011}
1012 1012
1013/**
1014 * blk_insert_request - insert a special request into a request queue
1015 * @q: request queue where request should be inserted
1016 * @rq: request to be inserted
1017 * @at_head: insert request at head or tail of queue
1018 * @data: private data
1019 *
1020 * Description:
1021 * Many block devices need to execute commands asynchronously, so they don't
1022 * block the whole kernel from preemption during request execution. This is
1023 * accomplished normally by inserting aritficial requests tagged as
1024 * REQ_TYPE_SPECIAL in to the corresponding request queue, and letting them
1025 * be scheduled for actual execution by the request queue.
1026 *
1027 * We have the option of inserting the head or the tail of the queue.
1028 * Typically we use the tail for new ioctls and so forth. We use the head
1029 * of the queue for things like a QUEUE_FULL message from a device, or a
1030 * host that is unable to accept a particular command.
1031 */
1032void blk_insert_request(struct request_queue *q, struct request *rq,
1033 int at_head, void *data)
1034{
1035 int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK;
1036 unsigned long flags;
1037
1038 /*
1039 * tell I/O scheduler that this isn't a regular read/write (ie it
1040 * must not attempt merges on this) and that it acts as a soft
1041 * barrier
1042 */
1043 rq->cmd_type = REQ_TYPE_SPECIAL;
1044
1045 rq->special = data;
1046
1047 spin_lock_irqsave(q->queue_lock, flags);
1048
1049 /*
1050 * If command is tagged, release the tag
1051 */
1052 if (blk_rq_tagged(rq))
1053 blk_queue_end_tag(q, rq);
1054
1055 add_acct_request(q, rq, where);
1056 __blk_run_queue(q);
1057 spin_unlock_irqrestore(q->queue_lock, flags);
1058}
1059EXPORT_SYMBOL(blk_insert_request);
1060
1061static void part_round_stats_single(int cpu, struct hd_struct *part, 1013static void part_round_stats_single(int cpu, struct hd_struct *part,
1062 unsigned long now) 1014 unsigned long now)
1063{ 1015{
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index b70f0fca9a42..e7472f567c9d 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -619,8 +619,10 @@ static int carm_array_info (struct carm_host *host, unsigned int array_idx)
619 host->state == HST_DEV_SCAN); 619 host->state == HST_DEV_SCAN);
620 spin_unlock_irq(&host->lock); 620 spin_unlock_irq(&host->lock);
621 621
622 DPRINTK("blk_insert_request, tag == %u\n", idx); 622 DPRINTK("blk_execute_rq_nowait, tag == %u\n", idx);
623 blk_insert_request(host->oob_q, crq->rq, 1, crq); 623 crq->rq->cmd_type = REQ_TYPE_SPECIAL;
624 crq->rq->special = crq;
625 blk_execute_rq_nowait(host->oob_q, NULL, crq->rq, true, NULL);
624 626
625 return 0; 627 return 0;
626 628
@@ -658,8 +660,10 @@ static int carm_send_special (struct carm_host *host, carm_sspc_t func)
658 BUG_ON(rc < 0); 660 BUG_ON(rc < 0);
659 crq->msg_bucket = (u32) rc; 661 crq->msg_bucket = (u32) rc;
660 662
661 DPRINTK("blk_insert_request, tag == %u\n", idx); 663 DPRINTK("blk_execute_rq_nowait, tag == %u\n", idx);
662 blk_insert_request(host->oob_q, crq->rq, 1, crq); 664 crq->rq->cmd_type = REQ_TYPE_SPECIAL;
665 crq->rq->special = crq;
666 blk_execute_rq_nowait(host->oob_q, NULL, crq->rq, true, NULL);
663 667
664 return 0; 668 return 0;
665} 669}
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c7a6d3b5bc7b..8a6b51b13a1c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -660,7 +660,6 @@ extern void __blk_put_request(struct request_queue *, struct request *);
660extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 660extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
661extern struct request *blk_make_request(struct request_queue *, struct bio *, 661extern struct request *blk_make_request(struct request_queue *, struct bio *,
662 gfp_t); 662 gfp_t);
663extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
664extern void blk_requeue_request(struct request_queue *, struct request *); 663extern void blk_requeue_request(struct request_queue *, struct request *);
665extern void blk_add_request_payload(struct request *rq, struct page *page, 664extern void blk_add_request_payload(struct request *rq, struct page *page,
666 unsigned int len); 665 unsigned int len);