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: introduce bdev_zone_start()

Introduce the function bdev_zone_start() as a more explicit (and clear)
replacement for ALIGN_DOWN() to get the start sector of a zone
containing a particular sector of a zoned block device.

Use this new helper in blkdev_get_zone_info() and
blkdev_report_zones_cached().

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Damien Le Moal and committed by
Jens Axboe
25976c31 e2b0ec77

+8 -2
+2 -2
block/blk-zoned.c
··· 950 950 return -EINVAL; 951 951 952 952 memset(zone, 0, sizeof(*zone)); 953 - sector = ALIGN_DOWN(sector, zone_sectors); 953 + sector = bdev_zone_start(bdev, sector); 954 954 955 955 if (!blkdev_has_cached_report_zones(bdev)) 956 956 return blkdev_report_zone_fallback(bdev, sector, zone); ··· 1068 1068 return blkdev_do_report_zones(bdev, sector, nr_zones, &args); 1069 1069 } 1070 1070 1071 - for (sector = ALIGN_DOWN(sector, zone_sectors); 1071 + for (sector = bdev_zone_start(bdev, sector); 1072 1072 sector < capacity && idx < nr_zones; 1073 1073 sector += zone_sectors, idx++) { 1074 1074 ret = blkdev_get_zone_info(bdev, sector, &zone);
+6
include/linux/blkdev.h
··· 1522 1522 return q->limits.chunk_sectors; 1523 1523 } 1524 1524 1525 + static inline sector_t bdev_zone_start(struct block_device *bdev, 1526 + sector_t sector) 1527 + { 1528 + return sector & ~(bdev_zone_sectors(bdev) - 1); 1529 + } 1530 + 1525 1531 static inline sector_t bdev_offset_from_zone_start(struct block_device *bdev, 1526 1532 sector_t sector) 1527 1533 {