summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-01-09 08:05:13 -0800
committerTejun Heo <tj@kernel.org>2013-01-09 08:05:13 -0800
commit548bc8e1b38e48653a90f48f636f8d253504f8a2 (patch)
treedb4aca3e40185423e465ef5a67f44658ff292443 /block
parent16b3de6652c7aef151f38726faf90f0dbc9e9c71 (diff)
downloadlinux-3.10-548bc8e1b38e48653a90f48f636f8d253504f8a2.tar.gz
linux-3.10-548bc8e1b38e48653a90f48f636f8d253504f8a2.tar.bz2
linux-3.10-548bc8e1b38e48653a90f48f636f8d253504f8a2.zip
block: RCU free request_queue
RCU free request_queue so that blkcg_gq->q can be dereferenced under RCU lock. This will be used to implement hierarchical stats. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Vivek Goyal <vgoyal@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-sysfs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 788147797a7..6206a934eb8 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -497,6 +497,13 @@ queue_attr_store(struct kobject *kobj, struct attribute *attr,
return res;
}
+static void blk_free_queue_rcu(struct rcu_head *rcu_head)
+{
+ struct request_queue *q = container_of(rcu_head, struct request_queue,
+ rcu_head);
+ kmem_cache_free(blk_requestq_cachep, q);
+}
+
/**
* 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
@@ -538,7 +545,7 @@ static void blk_release_queue(struct kobject *kobj)
bdi_destroy(&q->backing_dev_info);
ida_simple_remove(&blk_queue_ida, q->id);
- kmem_cache_free(blk_requestq_cachep, q);
+ call_rcu(&q->rcu_head, blk_free_queue_rcu);
}
static const struct sysfs_ops queue_sysfs_ops = {