diff options
author | Jan Kara <jack@suse.cz> | 2017-02-02 15:56:49 +0100 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-02-02 16:18:41 +0100 |
commit | f44f1ab5a2dcd4e16eab850fd08e40ff2d0c28d4 (patch) | |
tree | 759fa3fdce7ef3b945baa2668842c5216e42bf1f /block/blk-core.c | |
parent | nbd: use an idr to keep track of nbd devices (diff) | |
download | linux-f44f1ab5a2dcd4e16eab850fd08e40ff2d0c28d4.tar.xz linux-f44f1ab5a2dcd4e16eab850fd08e40ff2d0c28d4.zip |
block: Unhash block device inodes on gendisk destruction
Currently, block device inodes stay around after corresponding gendisk
hash died until memory reclaim finds them and frees them. Since we will
make block device inode pin the bdi, we want to free the block device
inode as soon as the device goes away so that bdi does not stay around
unnecessarily. Furthermore we need to avoid issues when new device with
the same major,minor pair gets created since reusing the bdi structure
would be rather difficult in this case.
Unhashing block device inode on gendisk destruction nicely deals with
these problems. Once last block device inode reference is dropped (which
may be directly in del_gendisk()), the inode gets evicted. Furthermore if
the major,minor pair gets reallocated, we are guaranteed to get new
block device inode even if old block device inode is not yet evicted and
thus we avoid issues with possible reuse of bdi.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-core.c')
0 files changed, 0 insertions, 0 deletions