diff options
author | Tejun Heo <tj@kernel.org> | 2014-09-07 19:03:58 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-09-08 12:00:38 -0400 |
commit | b68757341d8015d28e261990deea58dd836e04da (patch) | |
tree | 0ebc92ce23fe41cebe2a81733e609a9b303522a6 /mm | |
parent | e36f1dfce0b45d347927568efe1088821758cc3c (diff) |
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: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/backing-dev.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 1706cbbdf5f0..4afeefe9e365 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -402,21 +402,15 @@ static void bdi_prune_sb(struct backing_dev_info *bdi) | |||
402 | 402 | ||
403 | void bdi_unregister(struct backing_dev_info *bdi) | 403 | void bdi_unregister(struct backing_dev_info *bdi) |
404 | { | 404 | { |
405 | struct device *dev = bdi->dev; | 405 | if (bdi->dev) { |
406 | |||
407 | if (dev) { | ||
408 | bdi_set_min_ratio(bdi, 0); | 406 | bdi_set_min_ratio(bdi, 0); |
409 | trace_writeback_bdi_unregister(bdi); | 407 | trace_writeback_bdi_unregister(bdi); |
410 | bdi_prune_sb(bdi); | 408 | bdi_prune_sb(bdi); |
411 | 409 | ||
412 | bdi_wb_shutdown(bdi); | 410 | bdi_wb_shutdown(bdi); |
413 | bdi_debug_unregister(bdi); | 411 | bdi_debug_unregister(bdi); |
414 | 412 | device_unregister(bdi->dev); | |
415 | spin_lock_bh(&bdi->wb_lock); | ||
416 | bdi->dev = NULL; | 413 | bdi->dev = NULL; |
417 | spin_unlock_bh(&bdi->wb_lock); | ||
418 | |||
419 | device_unregister(dev); | ||
420 | } | 414 | } |
421 | } | 415 | } |
422 | EXPORT_SYMBOL(bdi_unregister); | 416 | EXPORT_SYMBOL(bdi_unregister); |