diff options
| author | Jan Kara <jack@suse.cz> | 2017-02-02 09:56:51 -0500 |
|---|---|---|
| committer | Jens Axboe <axboe@fb.com> | 2017-02-02 10:20:50 -0500 |
| commit | d03f6cdc1fc422accb734c7c07a661a0018d8631 (patch) | |
| tree | fe3500795df51b8ad11a0f76dddfa27d60fecf13 /include/linux/backing-dev.h | |
| parent | dc3b17cc8bf21307c7e076e7c778d5db756f7871 (diff) | |
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>
Diffstat (limited to 'include/linux/backing-dev.h')
| -rw-r--r-- | include/linux/backing-dev.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 43b93a947e61..efb6ca992d05 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
| @@ -18,7 +18,14 @@ | |||
| 18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
| 19 | 19 | ||
| 20 | int __must_check bdi_init(struct backing_dev_info *bdi); | 20 | int __must_check bdi_init(struct backing_dev_info *bdi); |
| 21 | void bdi_exit(struct backing_dev_info *bdi); | 21 | |
| 22 | static inline struct backing_dev_info *bdi_get(struct backing_dev_info *bdi) | ||
| 23 | { | ||
| 24 | kref_get(&bdi->refcnt); | ||
| 25 | return bdi; | ||
| 26 | } | ||
| 27 | |||
| 28 | void bdi_put(struct backing_dev_info *bdi); | ||
| 22 | 29 | ||
| 23 | __printf(3, 4) | 30 | __printf(3, 4) |
| 24 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, | 31 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, |
| @@ -29,6 +36,7 @@ void bdi_unregister(struct backing_dev_info *bdi); | |||
| 29 | 36 | ||
| 30 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); | 37 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); |
| 31 | void bdi_destroy(struct backing_dev_info *bdi); | 38 | void bdi_destroy(struct backing_dev_info *bdi); |
| 39 | struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id); | ||
| 32 | 40 | ||
| 33 | void wb_start_writeback(struct bdi_writeback *wb, long nr_pages, | 41 | void wb_start_writeback(struct bdi_writeback *wb, long nr_pages, |
| 34 | bool range_cyclic, enum wb_reason reason); | 42 | bool range_cyclic, enum wb_reason reason); |
