bdi_unregister() now contains very little functionality. It contains a "WARN_ON" if bdi->dev is NULL. This warning is of no real consequence as bdi->dev isn't needed by anything else in the function, and it triggers if blk_cleanup_queue() -> bdi_destroy() is called before bdi_unregister, which happens since Commit: 6cd18e711dd8 ("block: destroy bdi before blockdev is unregistered.") So this isn't wanted. It also calls bdi_set_min_ratio(). This needs to be called after writes through the bdi have all been flushed, and before the bdi is destroyed. Calling it early is better than calling it late as it frees up a global resource. Calling it immediately after bdi_wb_shutdown() in bdi_destroy() perfectly fits these requirements. So bdi_unregister() can be discarded with the important content moved to bdi_destroy(), as can the writeback_bdi_unregister event which is already not used.
Showing the changes to include (2 of 4 files). Show all
Unified · Split
| @@ -116,7 +116,6 @@ __printf(3, 4) · 115 unmodified lines | |||
| 116 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, | 116 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, |
| 117 | const char *fmt, ...); | 117 | const char *fmt, ...); |
| 118 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 118 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
| 119 | void bdi_unregister(struct backing_dev_info *bdi); | ||
| 120 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); | 119 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); |
| 121 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, | 120 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
| 122 | enum wb_reason reason); | 121 | enum wb_reason reason); |
| @@ -250,7 +250,6 @@ DEFINE_EVENT(writeback_class, name, \ · 249 unmodified lines | |||
| 250 | DEFINE_WRITEBACK_EVENT(writeback_nowork); | 250 | DEFINE_WRITEBACK_EVENT(writeback_nowork); |
| 251 | DEFINE_WRITEBACK_EVENT(writeback_wake_background); | 251 | DEFINE_WRITEBACK_EVENT(writeback_wake_background); |
| 252 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register); | 252 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register); |
| 253 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); | ||
| 254 | 253 | ||
| 255 | DECLARE_EVENT_CLASS(wbc_class, | 254 | DECLARE_EVENT_CLASS(wbc_class, |
| 256 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), | 255 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), |