/** * blk_execute_rq_nowait - insert a request into queue for execution * @q: queue to insert the request in * @bd_disk: matching gendisk * @rq: request to insert * @at_head: insert request at head or tail of queue * @done: I/O completion handler * * Description: * Insert a fully prepared request at the back of the I/O scheduler queue * for execution. Don't wait for completion. */ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, struct request *rq, int at_head, rq_end_io_fn *done) { int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; WARN_ON(irqs_disabled()); spin_lock_irq(q->queue_lock); if (unlikely(blk_queue_dead(q))) { spin_unlock_irq(q->queue_lock); rq->errors = -ENXIO; if (rq->end_io) rq->end_io(rq, rq->errors); return; } rq->rq_disk = bd_disk; rq->end_io = done; __elv_add_request(q, rq, where); __blk_run_queue(q); /* the queue is stopped so it won't be run */ if (rq->cmd_type == REQ_TYPE_PM_RESUME) q->request_fn(q); spin_unlock_irq(q->queue_lock); }
void blk_start_queue(struct request_queue *q) { WARN_ON(!irqs_disabled()); queue_flag_clear(QUEUE_FLAG_STOPPED, q); __blk_run_queue(q); }
/** * blk_execute_rq_nowait - insert a request into queue for execution * @q: queue to insert the request in * @bd_disk: matching gendisk * @rq: request to insert * @at_head: insert request at head or tail of queue * @done: I/O completion handler * * Description: * Insert a fully prepared request at the back of the I/O scheduler queue * for execution. Don't wait for completion. * * Note: * This function will invoke @done directly if the queue is dead. */ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, struct request *rq, int at_head, rq_end_io_fn *done) { int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; bool is_pm_resume; WARN_ON(irqs_disabled()); rq->rq_disk = bd_disk; rq->end_io = done; /* * need to check this before __blk_run_queue(), because rq can * be freed before that returns. */ is_pm_resume = rq->cmd_type == REQ_TYPE_PM_RESUME; spin_lock_irq(q->queue_lock); if (unlikely(blk_queue_dying(q))) { rq->errors = -ENXIO; if (rq->end_io) rq->end_io(rq, rq->errors); spin_unlock_irq(q->queue_lock); return; } __elv_add_request(q, rq, where); __blk_run_queue(q); /* the queue is stopped so it won't be run */ if (is_pm_resume) __blk_run_queue_uncond(q); spin_unlock_irq(q->queue_lock); }
void blk_run_queue(struct request_queue *q) { unsigned long flags; spin_lock_irqsave(q->queue_lock, flags); __blk_run_queue(q); spin_unlock_irqrestore(q->queue_lock, flags); }
static void blk_delay_work(struct work_struct *work) { struct request_queue *q; q = container_of(work, struct request_queue, delay_work.work); spin_lock_irq(q->queue_lock); __blk_run_queue(q); spin_unlock_irq(q->queue_lock); }
static void fiops_kick_queue(struct work_struct *work) { struct fiops_data *fiopsd = container_of(work, struct fiops_data, unplug_work); struct request_queue *q = fiopsd->queue; spin_lock_irq(q->queue_lock); __blk_run_queue(q); spin_unlock_irq(q->queue_lock); }
static void blk_flush_complete_seq_end_io(struct request_queue *q, unsigned seq, int error) { bool was_empty = elv_queue_empty(q); struct request *next_rq; next_rq = blk_flush_complete_seq(q, seq, error); /* * Moving a request silently to empty queue_head may stall the * queue. Kick the queue in those cases. */ if (was_empty && next_rq) __blk_run_queue(q); }
/** * blk_execute_rq_nowait - insert a request into queue for execution * @q: queue to insert the request in * @bd_disk: matching gendisk * @rq: request to insert * @at_head: insert request at head or tail of queue * @done: I/O completion handler * * Description: * Insert a fully prepared request at the back of the I/O scheduler queue * for execution. Don't wait for completion. */ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, struct request *rq, int at_head, rq_end_io_fn *done) { int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; rq->rq_disk = bd_disk; rq->end_io = done; WARN_ON(irqs_disabled()); spin_lock_irq(q->queue_lock); __elv_add_request(q, rq, where); __blk_run_queue(q); /* the queue is stopped so it won't be plugged+unplugged */ if (rq->cmd_type == REQ_TYPE_PM_RESUME) q->request_fn(q); spin_unlock_irq(q->queue_lock); }
/* * kick_queue() - Wake up device driver queue thread * @work: pointer to struct work_struct * * This is a idling delayed work function. It's purpose is to wake up the * device driver in order for it to start fetching requests. * */ static void kick_queue(struct work_struct *work) { struct delayed_work *idle_work = to_delayed_work(work); struct idling_data *read_data = container_of(idle_work, struct idling_data, idle_work); struct row_data *rd = container_of(read_data, struct row_data, read_idle); /* Mark idling process as done */ rd->row_queues[rd->curr_queue].rqueue.idle_data.begin_idling = false; if ((rd->nr_reqs[0] + rd->nr_reqs[1])) { spin_lock_irq(rd->dispatch_queue->queue_lock); __blk_run_queue(rd->dispatch_queue); spin_unlock_irq(rd->dispatch_queue->queue_lock); } }
/* * kick_queue() - Wake up device driver queue thread * @work: pointer to struct work_struct * * This is a idling delayed work function. It's purpose is to wake up the * device driver in order for it to start fetching requests. * */ static void kick_queue(struct work_struct *work) { struct delayed_work *idle_work = to_delayed_work(work); struct idling_data *read_data = container_of(idle_work, struct idling_data, idle_work); struct row_data *rd = container_of(read_data, struct row_data, read_idle); row_log_rowq(rd, rd->curr_queue, "Performing delayed work"); /* Mark idling process as done */ rd->row_queues[rd->curr_queue].rqueue.idle_data.begin_idling = false; if (!(rd->nr_reqs[0] + rd->nr_reqs[1])) row_log(rd->dispatch_queue, "No requests in scheduler"); else { spin_lock_irq(rd->dispatch_queue->queue_lock); __blk_run_queue(rd->dispatch_queue); spin_unlock_irq(rd->dispatch_queue->queue_lock); } }