Ejemplo n.º 1
0
/**
 * blk_release_queue: - release a &struct request_queue when it is no longer needed
 * @kobj:    the kobj belonging to the request queue to be released
 *
 * Description:
 *     blk_release_queue is the pair to blk_init_queue() or
 *     blk_queue_make_request().  It should be called when a request queue is
 *     being released; typically when a block device is being de-registered.
 *     Currently, its primary task it to free all the &struct request
 *     structures that were allocated to the queue and the queue itself.
 *
 * Note:
 *     The low level driver must have finished any outstanding requests first
 *     via blk_cleanup_queue().
 **/
static void blk_release_queue(struct kobject *kobj)
{
    struct request_queue *q =
        container_of(kobj, struct request_queue, kobj);

    bdi_exit(&q->backing_dev_info);
    blkcg_exit_queue(q);

    if (q->elevator) {
        spin_lock_irq(q->queue_lock);
        ioc_clear_queue(q);
        spin_unlock_irq(q->queue_lock);
        elevator_exit(q->elevator);
    }

    blk_exit_rl(&q->root_rl);

    if (q->queue_tags)
        __blk_queue_free_tags(q);

    if (!q->mq_ops)
        blk_free_flush_queue(q->fq);
    else
        blk_mq_release(q);

    blk_trace_shutdown(q);

    if (q->bio_split)
        bioset_free(q->bio_split);

    ida_simple_remove(&blk_queue_ida, q->id);
    call_rcu(&q->rcu_head, blk_free_queue_rcu);
}
Ejemplo n.º 2
0
void bdi_destroy(struct backing_dev_info *bdi)
{
	bdi_unregister(bdi);
	bdi_exit(bdi);
}