]> git.baikalelectronics.ru Git - kernel.git/commit
block: add a ->free_disk method
authorChristoph Hellwig <hch@lst.de>
Tue, 15 Feb 2022 09:45:10 +0000 (10:45 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 17 Feb 2022 02:44:24 +0000 (19:44 -0700)
commit89200cf7c29ee09fb60704baae50198156e1a94a
treed46b30e52e66b4f27ccb9c06a9cedf3d83abf546
parent4d744ae7f5a6798b3c8baf971f57348b4e319a28
block: add a ->free_disk method

Add a method to notify the driver that the gendisk is about to be freed.
This allows drivers to tie the lifetime of their private data to that of
the gendisk and thus deal with device removal races without expensive
synchronization and boilerplate code.

A new flag is added so that ->free_disk is only called after a successful
call to add_disk, which significantly simplifies the error handling path
during probing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220215094514.3828912-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/genhd.c
include/linux/blkdev.h