Add function that registers bdi and takes va_list instead of variable number of arguments. Add bdi_alloc() as simple wrapper for NUMA-unaware users allocating BDI.
Unified · Split
| @@ -30,6 +30,8 @@ void bdi_put(struct backing_dev_info *bdi); · 29 unmodified lines | |||
| 30 | __printf(3, 4) | 30 | __printf(3, 4) |
| 31 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, | 31 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, |
| 32 | const char *fmt, ...); | 32 | const char *fmt, ...); |
| 33 | int bdi_register_va(struct backing_dev_info *bdi, struct device *parent, | ||
| 34 | const char *fmt, va_list args); | ||
| 33 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 35 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
| 34 | int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner); | 36 | int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner); |
| 35 | void bdi_unregister(struct backing_dev_info *bdi); | 37 | void bdi_unregister(struct backing_dev_info *bdi); |
| @@ -37,6 +39,10 @@ void bdi_unregister(struct backing_dev_info *bdi); · 1 unmodified line | |||
| 37 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); | 39 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); |
| 38 | void bdi_destroy(struct backing_dev_info *bdi); | 40 | void bdi_destroy(struct backing_dev_info *bdi); |
| 39 | struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id); | 41 | 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) | ||
| 43 | { | ||
| 44 | return bdi_alloc_node(gfp_mask, NUMA_NO_NODE); | ||
| 45 | } | ||
| 40 | 46 | ||
| 41 | void wb_start_writeback(struct bdi_writeback *wb, long nr_pages, | 47 | void wb_start_writeback(struct bdi_writeback *wb, long nr_pages, |
| 42 | bool range_cyclic, enum wb_reason reason); | 48 | bool range_cyclic, enum wb_reason reason); |
| @@ -856,18 +856,15 @@ struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id) · 855 unmodified lines | |||
| 856 | return bdi; | 856 | return bdi; |
| 857 | } | 857 | } |
| 858 | 858 | ||
| 859 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, | 859 | int bdi_register_va(struct backing_dev_info *bdi, struct device *parent, |
| 860 | const char *fmt, ...) | 860 | const char *fmt, va_list args) |
| 861 | { | 861 | { |
| 862 | va_list args; | ||
| 863 | struct device *dev; | 862 | struct device *dev; |
| 864 | 863 | ||
| 865 | if (bdi->dev) /* The driver needs to use separate queues per device */ | 864 | if (bdi->dev) /* The driver needs to use separate queues per device */ |
| 866 | return 0; | 865 | return 0; |
| 867 | 866 | ||
| 868 | va_start(args, fmt); | ||
| 869 | dev = device_create_vargs(bdi_class, parent, MKDEV(0, 0), bdi, fmt, args); | 867 | dev = device_create_vargs(bdi_class, parent, MKDEV(0, 0), bdi, fmt, args); |
| 870 | va_end(args); | ||
| 871 | if (IS_ERR(dev)) | 868 | if (IS_ERR(dev)) |
| 872 | return PTR_ERR(dev); | 869 | return PTR_ERR(dev); |
| 873 | 870 | ||
| @@ -884,6 +881,19 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, · 10 unmodified lines | |||
| 884 | trace_writeback_bdi_register(bdi); | 881 | trace_writeback_bdi_register(bdi); |
| 885 | return 0; | 882 | return 0; |
| 886 | } | 883 | } |
| 884 | EXPORT_SYMBOL(bdi_register_va); | ||
| 885 | |||
| 886 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, | ||
| 887 | const char *fmt, ...) | ||
| 888 | { | ||
| 889 | va_list args; | ||
| 890 | int ret; | ||
| 891 | |||
| 892 | va_start(args, fmt); | ||
| 893 | ret = bdi_register_va(bdi, parent, fmt, args); | ||
| 894 | va_end(args); | ||
| 895 | return ret; | ||
| 896 | } | ||
| 887 | EXPORT_SYMBOL(bdi_register); | 897 | EXPORT_SYMBOL(bdi_register); |
| 888 | 898 | ||
| 889 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev) | 899 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev) |