summaryrefslogtreecommitdiff
path: root/block/genhd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-08-09 08:40:28 +0200
committerJens Axboe <axboe@kernel.dk>2021-08-12 10:29:36 -0600
commit50b4aecfbbb09869db967e4a26212a47e10c0088 (patch)
tree11348e1e5960f45f23b5c4eaa9d687a1e0de3b6b /block/genhd.c
parentb75f4aed88febe903bd40a6128b74edd2388417e (diff)
block: remove GENHD_FL_UP
Just check inode_unhashed on the whole device bdev inode instead, and provide a helper to check for that information. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210809064028.1198327-9-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/block/genhd.c b/block/genhd.c
index f8def1129501..9d6b3aeea288 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -77,7 +77,8 @@ bool set_capacity_and_notify(struct gendisk *disk, sector_t size)
* initial capacity during probing.
*/
if (size == capacity ||
- (disk->flags & (GENHD_FL_UP | GENHD_FL_HIDDEN)) != GENHD_FL_UP)
+ !disk_live(disk) ||
+ (disk->flags & GENHD_FL_HIDDEN))
return false;
pr_info("%s: detected capacity change from %lld to %lld\n",
@@ -527,8 +528,6 @@ void device_add_disk(struct device *parent, struct gendisk *disk,
disk->flags |= GENHD_FL_EXT_DEVT;
}
- disk->flags |= GENHD_FL_UP;
-
disk_alloc_events(disk);
if (disk->flags & GENHD_FL_HIDDEN) {
@@ -597,7 +596,6 @@ void del_gendisk(struct gendisk *disk)
mutex_lock(&disk->open_mutex);
remove_inode_hash(disk->part0->bd_inode);
- disk->flags &= ~GENHD_FL_UP;
blk_drop_partitions(disk);
mutex_unlock(&disk->open_mutex);