On Monday February 26, [EMAIL PROTECTED] wrote:
> 
> Actually, the LVM metadata is somewhat poorly layed out in this respect.
> The metadata is at the start of the device, and on occasion is not even
> sector aligned, AFAICS.  Also, the PE structures, while large powers of
> 2 in size, are not guaranteed to be other than sector aligned.  They
> aligned with the END of the partition/device, and not the start.  I think
> under Linux, partitions are at least 1k multiples in size so the PEs will
> at least be 1k aligned...

MD/RAID volumes are always a multiple of 64k.  The amount of a single
device will be rounded down using MD_NEW_SIZE_BLOCKS defined as:

#define MD_RESERVED_BYTES               (64 * 1024)
#define MD_RESERVED_SECTORS             (MD_RESERVED_BYTES / 512)
#define MD_RESERVED_BLOCKS              (MD_RESERVED_BYTES / BLOCK_SIZE)

#define MD_NEW_SIZE_SECTORS(x)          ((x & ~(MD_RESERVED_SECTORS - 1)) - 
MD_RESERVED_SECTORS)
#define MD_NEW_SIZE_BLOCKS(x)           ((x & ~(MD_RESERVED_BLOCKS - 1)) - 
MD_RESERVED_BLOCKS)

And the whole array will be the sum of 1 or more of these sizes.
So if each PE is indeed  sized "from 8KB to 512MB in powers of 2 and
unit KB", then all accesses should be properly aligned, so you
shouldn't have any problems (and if you apply the patch and get no
errors, then you will be doubly sure).

I thought a bit more about the consequences of unaligned accesses and
I think it is most significant when rebuilding parity.

RAID5 assumes that two different stripes with different sector
addresses will not overlap.
If all accesses are properly aligned, then this will be true.  Also if
all accesses are misaligned by the same amount (e.g. 4K accesses at
(4n+1)K offsets) then everything should work well too.
However, raid5 resync always aligns accesses so if the current
stripe-cache size were 4K, all sync accesses would be at (4n)K
offsets.
If there were (4n+1)K accesses happening at the same time, they would
not synchronise with the resync accesses and you could get corruption.

But it sounds like LVM is safe from this problem.

NeilBrown
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [EMAIL PROTECTED]

Reply via email to