Commit b6875734 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

bdi: remove bdi->wb_lock locking around bdi->dev clearing in bdi_unregister()

The only places where NULL test on bdi->dev is used are
bdi_[un]register().  The functions can't be called in parallel anyway
and there's no point in protecting bdi->dev clearing with a lock.
Remove bdi->wb_lock grabbing around bdi->dev clearing and move it
after device_unregister() call so that bdi->dev doesn't have to be
cached in a local variable.

This patch shouldn't introduce any behavior difference.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent e36f1dfc
...@@ -402,21 +402,15 @@ static void bdi_prune_sb(struct backing_dev_info *bdi) ...@@ -402,21 +402,15 @@ static void bdi_prune_sb(struct backing_dev_info *bdi)
void bdi_unregister(struct backing_dev_info *bdi) void bdi_unregister(struct backing_dev_info *bdi)
{ {
struct device *dev = bdi->dev; if (bdi->dev) {
if (dev) {
bdi_set_min_ratio(bdi, 0); bdi_set_min_ratio(bdi, 0);
trace_writeback_bdi_unregister(bdi); trace_writeback_bdi_unregister(bdi);
bdi_prune_sb(bdi); bdi_prune_sb(bdi);
bdi_wb_shutdown(bdi); bdi_wb_shutdown(bdi);
bdi_debug_unregister(bdi); bdi_debug_unregister(bdi);
device_unregister(bdi->dev);
spin_lock_bh(&bdi->wb_lock);
bdi->dev = NULL; bdi->dev = NULL;
spin_unlock_bh(&bdi->wb_lock);
device_unregister(dev);
} }
} }
EXPORT_SYMBOL(bdi_unregister); EXPORT_SYMBOL(bdi_unregister);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment