Skip to content

Commit 1933192

Browse files
damien-lemoalaxboe
authored andcommitted
block: Optimize disk zone resource cleanup
For zoned block devices using zone write plugging, an rcu_barrier() call is needed in disk_free_zone_resources() to synchronize freeing of zone write plugs and the destrution of the mempool used to allocate the plugs. The barrier call does slow down a little teardown of zoned block devices but should not affect teardown of regular block devices or zoned block devices that do not use zone write plugging (e.g. zoned DM devices that do not require zone append emulation). Modify disk_free_zone_resources() to return early if we do not have a mempool to start with, that is, if the device does not use zone write plugging. This avoids the costly rcu_barrier() and speeds up disk teardown. Reported-by: Mikulas Patocka <[email protected]> Fixes: dd291d7 ("block: Introduce zone write plugging") Signed-off-by: Damien Le Moal <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Tested-by: Mikulas Patocka <[email protected]> Reviewed-by: Niklas Cassel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 9b1ebce commit 1933192

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

block/blk-zoned.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,6 +1552,9 @@ static void disk_destroy_zone_wplugs_hash_table(struct gendisk *disk)
15521552

15531553
void disk_free_zone_resources(struct gendisk *disk)
15541554
{
1555+
if (!disk->zone_wplugs_pool)
1556+
return;
1557+
15551558
cancel_work_sync(&disk->zone_wplugs_work);
15561559

15571560
if (disk->zone_wplugs_wq) {

0 commit comments

Comments
 (0)