Skip to content

Commit f79846c

Browse files
damien-lemoalmartinkpetersen
authored andcommitted
scsi: sd_zbc: Set zone limits before revalidating zones
In sd_zbc_revalidate_zones(), execute blk_queue_chunk_sectors() and blk_queue_max_zone_append_sectors() to respectively set a ZBC device zone size and maximum zone append sector limit before executing blk_revalidate_disk_zones(). This is to allow the block layer zone reavlidation to check these device characteristics prior to checking all zones of the device. Since blk_queue_max_zone_append_sectors() already caps the device maximum zone append limit to the zone size and to the maximum command size, the max_append value passed to blk_queue_max_zone_append_sectors() is simplified to the maximum number of segments times the number of sectors per page. Signed-off-by: Damien Le Moal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 24033d7 commit f79846c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/scsi/sd_zbc.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,6 @@ int sd_zbc_revalidate_zones(struct scsi_disk *sdkp)
831831
struct request_queue *q = disk->queue;
832832
u32 zone_blocks = sdkp->early_zone_info.zone_blocks;
833833
unsigned int nr_zones = sdkp->early_zone_info.nr_zones;
834-
u32 max_append;
835834
int ret = 0;
836835
unsigned int flags;
837836

@@ -876,6 +875,11 @@ int sd_zbc_revalidate_zones(struct scsi_disk *sdkp)
876875
goto unlock;
877876
}
878877

878+
blk_queue_chunk_sectors(q,
879+
logical_to_sectors(sdkp->device, zone_blocks));
880+
blk_queue_max_zone_append_sectors(q,
881+
q->limits.max_segments << PAGE_SECTORS_SHIFT);
882+
879883
ret = blk_revalidate_disk_zones(disk, sd_zbc_revalidate_zones_cb);
880884

881885
memalloc_noio_restore(flags);
@@ -888,12 +892,6 @@ int sd_zbc_revalidate_zones(struct scsi_disk *sdkp)
888892
goto unlock;
889893
}
890894

891-
max_append = min_t(u32, logical_to_sectors(sdkp->device, zone_blocks),
892-
q->limits.max_segments << PAGE_SECTORS_SHIFT);
893-
max_append = min_t(u32, max_append, queue_max_hw_sectors(q));
894-
895-
blk_queue_max_zone_append_sectors(q, max_append);
896-
897895
sd_zbc_print_zones(sdkp);
898896

899897
unlock:

0 commit comments

Comments
 (0)