mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
block: untangle request_queue refcounting from sysfs
The kobject embedded into the request_queue is used for the queue directory in sysfs, but that is a child of the gendisks directory and is intimately tied to it. Move this kobject to the gendisk and use a refcount_t in the request_queue for the actual request_queue refcounting that is completely unrelated to the device model. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20221114042637.1009333-5-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
40602997be
commit
2bd85221a6
11
block/bsg.c
11
block/bsg.c
@@ -175,8 +175,10 @@ static void bsg_device_release(struct device *dev)
|
||||
|
||||
void bsg_unregister_queue(struct bsg_device *bd)
|
||||
{
|
||||
if (bd->queue->kobj.sd)
|
||||
sysfs_remove_link(&bd->queue->kobj, "bsg");
|
||||
struct gendisk *disk = bd->queue->disk;
|
||||
|
||||
if (disk && disk->queue_kobj.sd)
|
||||
sysfs_remove_link(&disk->queue_kobj, "bsg");
|
||||
cdev_device_del(&bd->cdev, &bd->device);
|
||||
put_device(&bd->device);
|
||||
}
|
||||
@@ -216,8 +218,9 @@ struct bsg_device *bsg_register_queue(struct request_queue *q,
|
||||
if (ret)
|
||||
goto out_put_device;
|
||||
|
||||
if (q->kobj.sd) {
|
||||
ret = sysfs_create_link(&q->kobj, &bd->device.kobj, "bsg");
|
||||
if (q->disk && q->disk->queue_kobj.sd) {
|
||||
ret = sysfs_create_link(&q->disk->queue_kobj, &bd->device.kobj,
|
||||
"bsg");
|
||||
if (ret)
|
||||
goto out_device_del;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user