Please enable JavaScript.
Coggle requires JavaScript to display documents.
block device lifetime - Coggle Diagram
block device lifetime
problems
bdev has to be live in IO path
IO can be drained when closing bdev?
yes, fs layer does that by fget()/fput()
observe libaio
submit one io, then close bdev
all IOs are done before closing bdev
IO needs to be shutdown during delete disk
disk may be removed before cleanup queue
disk is parant of request_queue
io throttle/cgroup may submit bios in async context without holding bdev
blk-mq want to grab q_usage_counter at batch
scsi
disk is released before cleanup queue
facts
objects
block_device
has same lifetime with inode
add by add_disk
remove by del_gendisk
worker for bdev inode
use case
submit bio
retrieve q & disk
io account
bdev has to be live if IO isn't done
represents part(include part0)
replace original hd_struct
part grabs disk bdev's ref
release it in part_release()
FS IO is submitted on opened bdev
bdev is valid when submit_bio() is run
gendisk
associated with bdev via ->part0
has no its own kobj
use bdev's device actually
why release queue in disk_release()?
get queue in allocate_disk
request_queue
own its kobject
child of bdev/gendisk
it is released after disk/bdev is released
inode
bio based driver
not easy to shutdown IO during delete disk
fs layer lifetime
fget/fput is grabbed when submitting one IO
so dev/file isn't released until all IOs are done
ideas
release bdev & gendisk in request_queue's release handler
add API of free_disk()
for drivers to remove disk
keep put_disk() as original
put queue
call put_disk in blk_release_queue