mdadm and 4k sectors (advanced format)
Yes, it is made for 4k sector alignment.
With 1.1 and 1.2 superblocks, space is reserved at the start of each disk so that the superblock doesn't get trampled. The superblock creation code forces this reserved space to be a multiple of 4kB. All physical reads are offset from the end of this reserved space, not from the end of the superblock. This therefore preserves the alignment for any sector size that divides evenly into 4kB.
If you're interested, here is the proof from the mdadm source code (super1.c
):
/* force 4K alignment */
reserved &= ~7ULL;
sb->data_offset = __cpu_to_le64(reserved);
And this data_offset
parameter is used by the RAID1 code in the kernel to offset the physical reads, e.g. in the read path:
read_bio->bi_sector = r1_bio->sector + mirror->rdev->data_offset