mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
block: cleanup del_gendisk a bit
Merge three hidden gendisk checks into one. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
a7cb3d2f09
commit
6b3ba9762f
@ -895,6 +895,9 @@ void del_gendisk(struct gendisk *disk)
|
||||
|
||||
might_sleep();
|
||||
|
||||
if (WARN_ON_ONCE(!disk->queue))
|
||||
return;
|
||||
|
||||
blk_integrity_del(disk);
|
||||
disk_del_events(disk);
|
||||
|
||||
@ -917,20 +920,18 @@ void del_gendisk(struct gendisk *disk)
|
||||
disk->flags &= ~GENHD_FL_UP;
|
||||
up_write(&disk->lookup_sem);
|
||||
|
||||
if (!(disk->flags & GENHD_FL_HIDDEN))
|
||||
if (!(disk->flags & GENHD_FL_HIDDEN)) {
|
||||
sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi");
|
||||
if (disk->queue) {
|
||||
|
||||
/*
|
||||
* Unregister bdi before releasing device numbers (as they can
|
||||
* get reused and we'd get clashes in sysfs).
|
||||
*/
|
||||
if (!(disk->flags & GENHD_FL_HIDDEN))
|
||||
bdi_unregister(disk->queue->backing_dev_info);
|
||||
blk_unregister_queue(disk);
|
||||
} else {
|
||||
WARN_ON(1);
|
||||
bdi_unregister(disk->queue->backing_dev_info);
|
||||
}
|
||||
|
||||
blk_unregister_queue(disk);
|
||||
|
||||
if (!(disk->flags & GENHD_FL_HIDDEN))
|
||||
blk_unregister_region(disk_devt(disk), disk->minors);
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user