mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
block: Unregister bdi on last reference drop
Most users will want to unregister bdi when dropping last reference to a bdi. Only a few users (like block devices) want to play more complex tricks with bdi registration and unregistration. So unregister bdi when the last reference to bdi is dropped and just make sure we don't unregister the bdi the second time if it is already unregistered. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
baf7a616d5
commit
5af110b2fb
@ -961,6 +961,8 @@ static void release_bdi(struct kref *ref)
|
||||
struct backing_dev_info *bdi =
|
||||
container_of(ref, struct backing_dev_info, refcnt);
|
||||
|
||||
if (test_bit(WB_registered, &bdi->wb.state))
|
||||
bdi_unregister(bdi);
|
||||
bdi_exit(bdi);
|
||||
kfree(bdi);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user