Now that all backing_dev_info structure are allocated separately, we can drop some unused functions.
Unified · Split
| @@ -17,8 +17,6 @@ · 16 unmodified lines | |||
| 17 | #include <linux/backing-dev-defs.h> | 17 | #include <linux/backing-dev-defs.h> |
| 18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
| 19 | 19 | ||
| 20 | int __must_check bdi_init(struct backing_dev_info *bdi); | ||
| 21 | |||
| 22 | static inline struct backing_dev_info *bdi_get(struct backing_dev_info *bdi) | 20 | static inline struct backing_dev_info *bdi_get(struct backing_dev_info *bdi) |
| 23 | { | 21 | { |
| 24 | kref_get(&bdi->refcnt); | 22 | kref_get(&bdi->refcnt); |
| @@ -32,12 +30,9 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, · 7 unmodified lines | |||
| 32 | const char *fmt, ...); | 30 | const char *fmt, ...); |
| 33 | int bdi_register_va(struct backing_dev_info *bdi, struct device *parent, | 31 | int bdi_register_va(struct backing_dev_info *bdi, struct device *parent, |
| 34 | const char *fmt, va_list args); | 32 | const char *fmt, va_list args); |
| 35 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | ||
| 36 | int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner); | 33 | int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner); |
| 37 | void bdi_unregister(struct backing_dev_info *bdi); | 34 | void bdi_unregister(struct backing_dev_info *bdi); |
| 38 | 35 | ||
| 39 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); | ||
| 40 | void bdi_destroy(struct backing_dev_info *bdi); | ||
| 41 | struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id); | 36 | struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id); |
| 42 | static inline struct backing_dev_info *bdi_alloc(gfp_t gfp_mask) | 37 | static inline struct backing_dev_info *bdi_alloc(gfp_t gfp_mask) |
| 43 | { | 38 | { |
| @@ -12,8 +12,6 @@ · 11 unmodified lines | |||
| 12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
| 13 | #include <trace/events/writeback.h> | 13 | #include <trace/events/writeback.h> |
| 14 | 14 | ||
| 15 | static atomic_long_t bdi_seq = ATOMIC_LONG_INIT(0); | ||
| 16 | |||
| 17 | struct backing_dev_info noop_backing_dev_info = { | 15 | struct backing_dev_info noop_backing_dev_info = { |
| 18 | .name = "noop", | 16 | .name = "noop", |
| 19 | .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK, | 17 | .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK, |
| @@ -242,6 +240,8 @@ static __init int bdi_class_init(void) · 222 unmodified lines | |||
| 242 | } | 240 | } |
| 243 | postcore_initcall(bdi_class_init); | 241 | postcore_initcall(bdi_class_init); |
| 244 | 242 | ||
| 243 | static int bdi_init(struct backing_dev_info *bdi); | ||
| 244 | |||
| 245 | static int __init default_bdi_init(void) | 245 | static int __init default_bdi_init(void) |
| 246 | { | 246 | { |
| 247 | int err; | 247 | int err; |
| @@ -820,7 +820,7 @@ static void cgwb_remove_from_bdi_list(struct bdi_writeback *wb) · 572 unmodified lines | |||
| 820 | 820 | ||
| 821 | #endif /* CONFIG_CGROUP_WRITEBACK */ | 821 | #endif /* CONFIG_CGROUP_WRITEBACK */ |
| 822 | 822 | ||
| 823 | int bdi_init(struct backing_dev_info *bdi) | 823 | static int bdi_init(struct backing_dev_info *bdi) |
| 824 | { | 824 | { |
| 825 | int ret; | 825 | int ret; |
| 826 | 826 | ||
| @@ -838,7 +838,6 @@ int bdi_init(struct backing_dev_info *bdi) · 11 unmodified lines | |||
| 838 | 838 | ||
| 839 | return ret; | 839 | return ret; |
| 840 | } | 840 | } |
| 841 | EXPORT_SYMBOL(bdi_init); | ||
| 842 | 841 | ||
| 843 | struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id) | 842 | struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id) |
| 844 | { | 843 | { |
| @@ -897,12 +896,6 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, · 52 unmodified lines | |||
| 897 | } | 896 | } |
| 898 | EXPORT_SYMBOL(bdi_register); | 897 | EXPORT_SYMBOL(bdi_register); |
| 899 | 898 | ||
| 900 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev) | ||
| 901 | { | ||
| 902 | return bdi_register(bdi, NULL, "%u:%u", MAJOR(dev), MINOR(dev)); | ||
| 903 | } | ||
| 904 | EXPORT_SYMBOL(bdi_register_dev); | ||
| 905 | |||
| 906 | int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner) | 899 | int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner) |
| 907 | { | 900 | { |
| 908 | int rc; | 901 | int rc; |
| @@ -950,13 +943,6 @@ void bdi_unregister(struct backing_dev_info *bdi) · 41 unmodified lines | |||
| 950 | } | 943 | } |
| 951 | } | 944 | } |
| 952 | 945 | ||
| 953 | static void bdi_exit(struct backing_dev_info *bdi) | ||
| 954 | { | ||
| 955 | WARN_ON_ONCE(bdi->dev); | ||
| 956 | wb_exit(&bdi->wb); | ||
| 957 | cgwb_bdi_exit(bdi); | ||
| 958 | } | ||
| 959 | |||
| 960 | static void release_bdi(struct kref *ref) | 946 | static void release_bdi(struct kref *ref) |
| 961 | { | 947 | { |
| 962 | struct backing_dev_info *bdi = | 948 | struct backing_dev_info *bdi = |
| @@ -964,7 +950,9 @@ static void release_bdi(struct kref *ref) · 1 unmodified line | |||
| 964 | 950 | ||
| 965 | if (test_bit(WB_registered, &bdi->wb.state)) | 951 | if (test_bit(WB_registered, &bdi->wb.state)) |
| 966 | bdi_unregister(bdi); | 952 | bdi_unregister(bdi); |
| 967 | bdi_exit(bdi); | 953 | WARN_ON_ONCE(bdi->dev); |
| 954 | wb_exit(&bdi->wb); | ||
| 955 | cgwb_bdi_exit(bdi); | ||
| 968 | kfree(bdi); | 956 | kfree(bdi); |
| 969 | } | 957 | } |
| 970 | 958 | ||
| @@ -974,38 +962,6 @@ void bdi_put(struct backing_dev_info *bdi) · 3 unmodified lines | |||
| 974 | } | 962 | } |
| 975 | EXPORT_SYMBOL(bdi_put); | 963 | EXPORT_SYMBOL(bdi_put); |
| 976 | 964 | ||
| 977 | void bdi_destroy(struct backing_dev_info *bdi) | ||
| 978 | { | ||
| 979 | bdi_unregister(bdi); | ||
| 980 | bdi_exit(bdi); | ||
| 981 | } | ||
| 982 | EXPORT_SYMBOL(bdi_destroy); | ||
| 983 | |||
| 984 | /* | ||
| 985 | * For use from filesystems to quickly init and register a bdi associated | ||
| 986 | * with dirty writeback | ||
| 987 | */ | ||
| 988 | int bdi_setup_and_register(struct backing_dev_info *bdi, char *name) | ||
| 989 | { | ||
| 990 | int err; | ||
| 991 | |||
| 992 | bdi->name = name; | ||
| 993 | bdi->capabilities = 0; | ||
| 994 | err = bdi_init(bdi); | ||
| 995 | if (err) | ||
| 996 | return err; | ||
| 997 | |||
| 998 | err = bdi_register(bdi, NULL, "%.28s-%ld", name, | ||
| 999 | atomic_long_inc_return(&bdi_seq)); | ||
| 1000 | if (err) { | ||
| 1001 | bdi_destroy(bdi); | ||
| 1002 | return err; | ||
| 1003 | } | ||
| 1004 | |||
| 1005 | return 0; | ||
| 1006 | } | ||
| 1007 | EXPORT_SYMBOL(bdi_setup_and_register); | ||
| 1008 | |||
| 1009 | static wait_queue_head_t congestion_wqh[2] = { | 965 | static wait_queue_head_t congestion_wqh[2] = { |
| 1010 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]), | 966 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]), |
| 1011 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) | 967 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) |