On 11/8/19 2:56 AM, Damien Le Moal wrote: > For ZBC and ZAC zoned devices, the scsi driver revalidation processing > implemented by sd_revalidate_disk() includes a call to > sd_zbc_read_zones() which executes a full disk zone report used to > check that all zones of the disk are the same size. This processing is > followed by a call to blk_revalidate_disk_zones(), used to initialize > the device request queue zone bitmaps (zone type and zone write lock > bitmaps). To do so, blk_revalidate_disk_zones() also executes a full > device zone report to obtain zone types. As a result, the entire > zoned block device revalidation process includes two full device zone > report. > > By moving the zone size checks into blk_revalidate_disk_zones(), this > process can be optimized to a single full device zone report, leading to > shorter device scan and revalidation times. This patch implements this > optimization, reducing the original full device zone report implemented > in sd_zbc_check_zones() to a single, small, report zones command > execution to obtain the size of the first zone of the device. Checks > whether all zones of the device are the same size as the first zone > size are moved to the generic blk_check_zone() function called from > blk_revalidate_disk_zones(). > > This optimization also has the following benefits: > 1) fewer memory allocations in the scsi layer during disk revalidation > as the potentailly large buffer for zone report execution is not > needed. > 2) Implement zone checks in a generic manner, reducing the burden on > device driver which only need to obtain the zone size and check that > this size is a power of 2 number of LBAs. Any new type of zoned > block device will benefit from this. > > Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxx> > --- > block/blk-zoned.c | 62 +++++++++++++++++++++++- > drivers/scsi/sd_zbc.c | 107 ++++++++---------------------------------- > 2 files changed, 80 insertions(+), 89 deletions(-) > Reviewed-by: Hannes Reinecke <hare@xxxxxxx> Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@xxxxxxx +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 247165 (AG München), GF: Felix Imendörffer