summaryrefslogtreecommitdiffstats
path: root/block/partition-generic.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-11-25 11:22:37 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2019-11-25 11:22:37 -0800
commit464a47f45d2ae2db859f0e7c128b5f01aff19a53 (patch)
tree81862e9d67614d5283dfb3d45d86b74c548f0386 /block/partition-generic.c
parent323264eefba1ea288d5962c0a9e23ebd62107ca8 (diff)
parenta468168130ec1a3245812f2c713be97081149ca2 (diff)
downloadtalos-op-linux-464a47f45d2ae2db859f0e7c128b5f01aff19a53.tar.gz
talos-op-linux-464a47f45d2ae2db859f0e7c128b5f01aff19a53.zip
Merge tag 'for-5.5/zoned-20191122' of git://git.kernel.dk/linux-block
Pull zoned block device update from Jens Axboe: "Enhancements and improvements to the zoned device support" * tag 'for-5.5/zoned-20191122' of git://git.kernel.dk/linux-block: scsi: sd_zbc: Remove set but not used variable 'buflen' block: rework zone reporting scsi: sd_zbc: Cleanup sd_zbc_alloc_report_buffer() null_blk: Add zone_nr_conv to features null_blk: clean up report zones null_blk: clean up the block device operations block: Remove partition support for zoned block devices block: Simplify report zones execution block: cleanup the !zoned case in blk_revalidate_disk_zones block: Enhance blk_revalidate_disk_zones()
Diffstat (limited to 'block/partition-generic.c')
-rw-r--r--block/partition-generic.c74
1 files changed, 9 insertions, 65 deletions
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 3db8b73a96b1..3084d4cba5c7 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -462,56 +462,6 @@ static int drop_partitions(struct gendisk *disk, struct block_device *bdev)
return 0;
}
-static bool part_zone_aligned(struct gendisk *disk,
- struct block_device *bdev,
- sector_t from, sector_t size)
-{
- unsigned int zone_sectors = bdev_zone_sectors(bdev);
-
- /*
- * If this function is called, then the disk is a zoned block device
- * (host-aware or host-managed). This can be detected even if the
- * zoned block device support is disabled (CONFIG_BLK_DEV_ZONED not
- * set). In this case, however, only host-aware devices will be seen
- * as a block device is not created for host-managed devices. Without
- * zoned block device support, host-aware drives can still be used as
- * regular block devices (no zone operation) and their zone size will
- * be reported as 0. Allow this case.
- */
- if (!zone_sectors)
- return true;
-
- /*
- * Check partition start and size alignement. If the drive has a
- * smaller last runt zone, ignore it and allow the partition to
- * use it. Check the zone size too: it should be a power of 2 number
- * of sectors.
- */
- if (WARN_ON_ONCE(!is_power_of_2(zone_sectors))) {
- u32 rem;
-
- div_u64_rem(from, zone_sectors, &rem);
- if (rem)
- return false;
- if ((from + size) < get_capacity(disk)) {
- div_u64_rem(size, zone_sectors, &rem);
- if (rem)
- return false;
- }
-
- } else {
-
- if (from & (zone_sectors - 1))
- return false;
- if ((from + size) < get_capacity(disk) &&
- (size & (zone_sectors - 1)))
- return false;
-
- }
-
- return true;
-}
-
int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
{
struct parsed_partitions *state = NULL;
@@ -547,6 +497,14 @@ rescan:
}
return -EIO;
}
+
+ /* Partitions are not supported on zoned block devices */
+ if (bdev_is_zoned(bdev)) {
+ pr_warn("%s: ignoring partition table on zoned block device\n",
+ disk->disk_name);
+ goto out;
+ }
+
/*
* If any partition code tried to read beyond EOD, try
* unlocking native capacity even if partition table is
@@ -610,21 +568,6 @@ rescan:
}
}
- /*
- * On a zoned block device, partitions should be aligned on the
- * device zone size (i.e. zone boundary crossing not allowed).
- * Otherwise, resetting the write pointer of the last zone of
- * one partition may impact the following partition.
- */
- if (bdev_is_zoned(bdev) &&
- !part_zone_aligned(disk, bdev, from, size)) {
- printk(KERN_WARNING
- "%s: p%d start %llu+%llu is not zone aligned\n",
- disk->disk_name, p, (unsigned long long) from,
- (unsigned long long) size);
- continue;
- }
-
part = add_partition(disk, p, from, size,
state->parts[p].flags,
&state->parts[p].info);
@@ -638,6 +581,7 @@ rescan:
md_autodetect_dev(part_to_dev(part)->devt);
#endif
}
+out:
free_partitions(state);
return 0;
}
OpenPOWER on IntegriCloud