Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: Fake max open zones limit when there is no limit

For a zoned block device that has no limit on the number of open zones
and no limit on the number of active zones, the zone write plug mempool
is created with a size of 128 zone write plugs. For such case, set the
device max_open_zones queue limit to this value to indicate to the user
the potential performance penalty that may happen when writing
simultaneously to more zones than the mempool size.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Hans Holmberg <hans.holmberg@wdc.com>
Tested-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20240408014128.205141-9-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Damien Le Moal and committed by
Jens Axboe
843283e9 dd291d77

+35 -6
+35 -6
block/blk-zoned.c
··· 1504 1504 }; 1505 1505 1506 1506 /* 1507 + * Update the disk zone resources information and device queue limits. 1508 + * The disk queue is frozen when this is executed. 1509 + */ 1510 + static int disk_update_zone_resources(struct gendisk *disk, 1511 + struct blk_revalidate_zone_args *args) 1512 + { 1513 + struct request_queue *q = disk->queue; 1514 + struct queue_limits lim; 1515 + 1516 + disk->nr_zones = args->nr_zones; 1517 + disk->zone_capacity = args->zone_capacity; 1518 + swap(disk->seq_zones_wlock, args->seq_zones_wlock); 1519 + swap(disk->conv_zones_bitmap, args->conv_zones_bitmap); 1520 + 1521 + /* 1522 + * If the device has no limit on the maximum number of open and active 1523 + * zones, set its max open zone limit to the mempool size to indicate 1524 + * to the user that there is a potential performance impact due to 1525 + * dynamic zone write plug allocation when simultaneously writing to 1526 + * more zones than the size of the mempool. 1527 + */ 1528 + if (disk->zone_wplugs_pool) { 1529 + lim = queue_limits_start_update(q); 1530 + if (!lim.max_open_zones && !lim.max_active_zones) 1531 + lim.max_open_zones = disk->zone_wplugs_pool->min_nr; 1532 + return queue_limits_commit_update(q, &lim); 1533 + } 1534 + 1535 + return 0; 1536 + } 1537 + 1538 + /* 1507 1539 * Helper function to check the validity of zones of a zoned block device. 1508 1540 */ 1509 1541 static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx, ··· 1735 1703 */ 1736 1704 blk_mq_freeze_queue(q); 1737 1705 if (ret > 0) { 1738 - disk->nr_zones = args.nr_zones; 1739 - disk->zone_capacity = args.zone_capacity; 1740 - swap(disk->seq_zones_wlock, args.seq_zones_wlock); 1741 - swap(disk->conv_zones_bitmap, args.conv_zones_bitmap); 1706 + ret = disk_update_zone_resources(disk, &args); 1742 1707 if (update_driver_data) 1743 1708 update_driver_data(disk); 1744 - ret = 0; 1745 1709 } else { 1746 1710 pr_warn("%s: failed to revalidate zones\n", disk->disk_name); 1747 - disk_free_zone_resources(disk); 1748 1711 } 1712 + if (ret) 1713 + disk_free_zone_resources(disk); 1749 1714 blk_mq_unfreeze_queue(q); 1750 1715 1751 1716 kfree(args.seq_zones_wlock);