summaryrefslogtreecommitdiff
path: root/block/genhd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-08-18 17:45:37 +0300
committerJens Axboe <axboe@kernel.dk>2021-08-23 21:55:45 +0300
commit75f4dca59694dfe288ae6a48d7b147b60d11c95c (patch)
treed289fc188015956312856ccba0be547fbf25118e /block/genhd.c
parentbab53f6b617d9f530978d6e3693f88e586d81a8a (diff)
downloadlinux-75f4dca59694dfe288ae6a48d7b147b60d11c95c.tar.xz
block: call blk_register_queue earlier in device_add_disk
Ensure that all the sysfs bits are set up before bdev_add is called, as that will make the upcomding error handling much easier. However this means the call to disk_update_readahead has to be split as that requires a bdi. Also remove various sanity checks that don't make sense now that blk_register_queue only has a single caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210818144542.19305-7-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 75d900e4c82f..a54b4849242c 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -508,6 +508,8 @@ void device_add_disk(struct device *parent, struct gendisk *disk,
disk->slave_dir = NULL;
}
+ blk_register_queue(disk);
+
if (disk->flags & GENHD_FL_HIDDEN) {
/*
* Don't let hidden disks show up in /proc/partitions,
@@ -537,8 +539,7 @@ void device_add_disk(struct device *parent, struct gendisk *disk,
disk_uevent(disk, KOBJ_ADD);
}
- blk_register_queue(disk);
-
+ disk_update_readahead(disk);
disk_add_events(disk);
}
EXPORT_SYMBOL(device_add_disk);