Re: [RFC] block: check partition alignment

From: Christoph Hellwig
Date: Wed Dec 14 2016 - 12:08:07 EST


> To prevent partitions that are not aligned to the physical blocksize
> of a device check for the alignment in the blkpg_ioctl.

We'd also need to reject this when reading partitions from disk, right?

> + /* check if partition is aligned to blocksize */
> + if (p.start % bdev_physical_block_size(bdev) != 0)

And this should be bdev_logical_block_size, as the logical block size
is the only thing that matters for the OS - exposing the physical block
size is just an optional hint to prevent users from doing stupid
things (like creating unaligned partitions :))