summaryrefslogtreecommitdiff
path: root/src/build.c
AgeCommit message (Expand)AuthorFilesLines
2006-11-13Initial import15.6-2Tobias Klauser1-0/+734
n>space:mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2016-12-01 16:00:25 +0900
committerJens Axboe <axboe@fb.com>2016-12-01 07:56:53 -0700
commitb02d8aaea12463f573c5ef485c638ab12628dc5e (patch)
treef9f27e54550b528a091cd6df50d87badc6de19b8 /arch
parent333ba053d145d6f9152f6b0311a345b876f0fed1 (diff)
block: Check partition alignment on zoned block devices
Both blkdev_report_zones and blkdev_reset_zones can operate on a partition of a zoned block device. However, the first and last zones reported for a partition make sense only if the partition start sector and size are aligned on the device zone size. The same applies for zone reset. Resetting the first or the last zone of a partition straddling zones may impact neighboring partitions. Finally, if a partition start sector is not at the beginning of a sequential zone, it will be impossible to write to the first sectors of the partition on a host-managed device. Avoid all these problems and incoherencies by ignoring partitions that are not zone aligned. Note: Even with CONFIG_BLK_DEV_ZONED disabled, bdev_is_zoned() will report the correct disk zoning type (host-aware, host-managed or none) but bdev_zone_size() will always return 0 for zoned block devices (i.e. the zone size is unknown). So test this as a way to ensure that a zoned block device is being handled as such. As a result, for a host-aware devices, unaligned zone partitions will be accepted with CONFIG_BLK_DEV_ZONED disabled. That is, the disk will be treated as a regular block device (as it should). If zoned block device support is enabled, only aligned partitions will be accepted. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'arch')