aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-cgroup.c15
-rw-r--r--block/blk-exec.c8
2 files changed, 14 insertions, 9 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 5dea4e8dbc5..b8858fb0caf 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -600,7 +600,7 @@ struct cftype blkcg_files[] = {
600}; 600};
601 601
602/** 602/**
603 * blkcg_pre_destroy - cgroup pre_destroy callback 603 * blkcg_css_offline - cgroup css_offline callback
604 * @cgroup: cgroup of interest 604 * @cgroup: cgroup of interest
605 * 605 *
606 * This function is called when @cgroup is about to go away and responsible 606 * This function is called when @cgroup is about to go away and responsible
@@ -610,7 +610,7 @@ struct cftype blkcg_files[] = {
610 * 610 *
611 * This is the blkcg counterpart of ioc_release_fn(). 611 * This is the blkcg counterpart of ioc_release_fn().
612 */ 612 */
613static int blkcg_pre_destroy(struct cgroup *cgroup) 613static void blkcg_css_offline(struct cgroup *cgroup)
614{ 614{
615 struct blkcg *blkcg = cgroup_to_blkcg(cgroup); 615 struct blkcg *blkcg = cgroup_to_blkcg(cgroup);
616 616
@@ -632,10 +632,9 @@ static int blkcg_pre_destroy(struct cgroup *cgroup)
632 } 632 }
633 633
634 spin_unlock_irq(&blkcg->lock); 634 spin_unlock_irq(&blkcg->lock);
635 return 0;
636} 635}
637 636
638static void blkcg_destroy(struct cgroup *cgroup) 637static void blkcg_css_free(struct cgroup *cgroup)
639{ 638{
640 struct blkcg *blkcg = cgroup_to_blkcg(cgroup); 639 struct blkcg *blkcg = cgroup_to_blkcg(cgroup);
641 640
@@ -643,7 +642,7 @@ static void blkcg_destroy(struct cgroup *cgroup)
643 kfree(blkcg); 642 kfree(blkcg);
644} 643}
645 644
646static struct cgroup_subsys_state *blkcg_create(struct cgroup *cgroup) 645static struct cgroup_subsys_state *blkcg_css_alloc(struct cgroup *cgroup)
647{ 646{
648 static atomic64_t id_seq = ATOMIC64_INIT(0); 647 static atomic64_t id_seq = ATOMIC64_INIT(0);
649 struct blkcg *blkcg; 648 struct blkcg *blkcg;
@@ -740,10 +739,10 @@ static int blkcg_can_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
740 739
741struct cgroup_subsys blkio_subsys = { 740struct cgroup_subsys blkio_subsys = {
742 .name = "blkio", 741 .name = "blkio",
743 .create = blkcg_create, 742 .css_alloc = blkcg_css_alloc,
743 .css_offline = blkcg_css_offline,
744 .css_free = blkcg_css_free,
744 .can_attach = blkcg_can_attach, 745 .can_attach = blkcg_can_attach,
745 .pre_destroy = blkcg_pre_destroy,
746 .destroy = blkcg_destroy,
747 .subsys_id = blkio_subsys_id, 746 .subsys_id = blkio_subsys_id,
748 .base_cftypes = blkcg_files, 747 .base_cftypes = blkcg_files,
749 .module = THIS_MODULE, 748 .module = THIS_MODULE,
diff --git a/block/blk-exec.c b/block/blk-exec.c
index 1320e74d79b..74638ec234c 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -52,11 +52,17 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
52 rq_end_io_fn *done) 52 rq_end_io_fn *done)
53{ 53{
54 int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; 54 int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK;
55 bool is_pm_resume;
55 56
56 WARN_ON(irqs_disabled()); 57 WARN_ON(irqs_disabled());
57 58
58 rq->rq_disk = bd_disk; 59 rq->rq_disk = bd_disk;
59 rq->end_io = done; 60 rq->end_io = done;
61 /*
62 * need to check this before __blk_run_queue(), because rq can
63 * be freed before that returns.
64 */
65 is_pm_resume = rq->cmd_type == REQ_TYPE_PM_RESUME;
60 66
61 spin_lock_irq(q->queue_lock); 67 spin_lock_irq(q->queue_lock);
62 68
@@ -71,7 +77,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
71 __elv_add_request(q, rq, where); 77 __elv_add_request(q, rq, where);
72 __blk_run_queue(q); 78 __blk_run_queue(q);
73 /* the queue is stopped so it won't be run */ 79 /* the queue is stopped so it won't be run */
74 if (rq->cmd_type == REQ_TYPE_PM_RESUME) 80 if (is_pm_resume)
75 __blk_run_queue_uncond(q); 81 __blk_run_queue_uncond(q);
76 spin_unlock_irq(q->queue_lock); 82 spin_unlock_irq(q->queue_lock);
77} 83}