mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 06:01:23 +00:00
block, cfq: move io_cq exit/release to blk-ioc.c
With kmem_cache managed by blk-ioc, io_cq exit/release can be moved to blk-ioc too. The odd ->io_cq->exit/release() callbacks are replaced with elevator_ops->elevator_exit_icq_fn() with unlinking from both ioc and q, and freeing automatically handled by blk-ioc. The elevator operation only need to perform exit operation specific to the elevator - in cfq's case, exiting the cfqq's. Also, clearing of io_cq's on q detach is moved to block core and automatically performed on elevator switch and q release. Because the q io_cq points to might be freed before RCU callback for the io_cq runs, blk-ioc code should remember to which cache the io_cq needs to be freed when the io_cq is released. New field io_cq->__rcu_icq_cache is added for this purpose. As both the new field and rcu_head are used only after io_cq is released and the q/ioc_node fields aren't, they are put into unions. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
3d3c2379fe
commit
7e5a879449
7 changed files with 97 additions and 61 deletions
|
@ -14,14 +14,22 @@ struct io_cq {
|
|||
struct request_queue *q;
|
||||
struct io_context *ioc;
|
||||
|
||||
struct list_head q_node;
|
||||
struct hlist_node ioc_node;
|
||||
/*
|
||||
* q_node and ioc_node link io_cq through icq_list of q and ioc
|
||||
* respectively. Both fields are unused once ioc_exit_icq() is
|
||||
* called and shared with __rcu_icq_cache and __rcu_head which are
|
||||
* used for RCU free of io_cq.
|
||||
*/
|
||||
union {
|
||||
struct list_head q_node;
|
||||
struct kmem_cache *__rcu_icq_cache;
|
||||
};
|
||||
union {
|
||||
struct hlist_node ioc_node;
|
||||
struct rcu_head __rcu_head;
|
||||
};
|
||||
|
||||
unsigned long changed;
|
||||
struct rcu_head rcu_head;
|
||||
|
||||
void (*exit)(struct io_cq *);
|
||||
void (*release)(struct io_cq *);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue