blk-cgroup: delay blk-cgroup initialization until add_disk
authorChristoph Hellwig <hch@lst.de>
Fri, 3 Feb 2023 15:03:43 +0000 (16:03 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 3 Feb 2023 15:20:04 +0000 (08:20 -0700)
commit178fa7d49815ea8001f43ade37a22072829fd8ab
treea27898ff8fedf946256c22264c8fb9d05371858d
parenta886001c2da8dd02357d0d336ddb021903347f89
blk-cgroup: delay blk-cgroup initialization until add_disk

There is no need to initialize the cgroup code before the disk is marked
live.  Moving the cgroup initialization earlier will help to have a
fully initialized struct device in the gendisk for the cgroup code to
use in the future.  Similarly tear the cgroup information down in
del_gendisk to be symmetric and because none of the cgroup tracking is
needed once non-passthrough I/O stops.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andreas Herrmann <aherrmann@suse.de>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20230203150400.3199230-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/genhd.c