block: Dynamically allocate and refcount backing_dev_info
Instead of storing backing_dev_info inside struct request_queue, allocate it dynamically, reference count it, and free it when the last reference is dropped. Currently only request_queue holds the reference but in the following patch we add other users referencing backing_dev_info. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
@@ -18,7 +18,14 @@
|
||||
#include <linux/slab.h>
|
||||
|
||||
int __must_check bdi_init(struct backing_dev_info *bdi);
|
||||
void bdi_exit(struct backing_dev_info *bdi);
|
||||
|
||||
static inline struct backing_dev_info *bdi_get(struct backing_dev_info *bdi)
|
||||
{
|
||||
kref_get(&bdi->refcnt);
|
||||
return bdi;
|
||||
}
|
||||
|
||||
void bdi_put(struct backing_dev_info *bdi);
|
||||
|
||||
__printf(3, 4)
|
||||
int bdi_register(struct backing_dev_info *bdi, struct device *parent,
|
||||
@@ -29,6 +36,7 @@ void bdi_unregister(struct backing_dev_info *bdi);
|
||||
|
||||
int __must_check bdi_setup_and_register(struct backing_dev_info *, char *);
|
||||
void bdi_destroy(struct backing_dev_info *bdi);
|
||||
struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id);
|
||||
|
||||
void wb_start_writeback(struct bdi_writeback *wb, long nr_pages,
|
||||
bool range_cyclic, enum wb_reason reason);
|
||||
|
Reference in New Issue
Block a user