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>
This commit is contained in:
parent
16b3de6652
commit
548bc8e1b3
@ -497,6 +497,13 @@ queue_attr_store(struct kobject *kobj, struct attribute *attr,
|
|||||||
return res;
|
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
|
* 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
|
* @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);
|
bdi_destroy(&q->backing_dev_info);
|
||||||
|
|
||||||
ida_simple_remove(&blk_queue_ida, q->id);
|
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 = {
|
static const struct sysfs_ops queue_sysfs_ops = {
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <linux/gfp.h>
|
#include <linux/gfp.h>
|
||||||
#include <linux/bsg.h>
|
#include <linux/bsg.h>
|
||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
|
#include <linux/rcupdate.h>
|
||||||
|
|
||||||
#include <asm/scatterlist.h>
|
#include <asm/scatterlist.h>
|
||||||
|
|
||||||
@ -437,6 +438,7 @@ struct request_queue {
|
|||||||
/* Throttle data */
|
/* Throttle data */
|
||||||
struct throtl_data *td;
|
struct throtl_data *td;
|
||||||
#endif
|
#endif
|
||||||
|
struct rcu_head rcu_head;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
|
#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user