Patch to fix some macros that didn't have enough parenthses to force the correct behavior. The problem shows when creating/discovering RAID0 regions with disks of different sizes. It may have other manifestations as well. --- evms-2.2.1/plugins/md/md.h Tue Nov 11 15:58:33 2003 +++ evms-2.2.1-fix/plugins/md/md.h Tue Dec 30 14:44:12 2003 @@ -52,8 +52,8 @@ #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) +#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) #define MD_SB_BYTES 4096 #define MD_SB_WORDS (MD_SB_BYTES / 4) @@ -382,9 +382,9 @@ } #define MD_CHUNK_ALIGN_NEW_SIZE_SECTORS(chunk_size_in_sectors, size_in_sectors) \ - chunk_size_in_sectors ? (MD_NEW_SIZE_SECTORS(size_in_sectors) & ~(chunk_size_in_sectors - 1)) : MD_NEW_SIZE_SECTORS(size_in_sectors) + ((chunk_size_in_sectors) ? (MD_NEW_SIZE_SECTORS(size_in_sectors) & ~((chunk_size_in_sectors) - 1)) : MD_NEW_SIZE_SECTORS(size_in_sectors)) #define MD_CHUNK_ALIGN_NEW_SIZE_BLOCKS(chunk_size_in_blocks, size_in_blocks) \ - chunk_size_in_blocks ? (MD_NEW_SIZE_BLOCKS(size_in_blocks) & ~(chunk_size_in_blocks - 1)) : MD_NEW_SIZE_BLOCKS(size_in_blocks) + ((chunk_size_in_blocks) ? (MD_NEW_SIZE_BLOCKS(size_in_blocks) & ~((chunk_size_in_blocks) - 1)) : MD_NEW_SIZE_BLOCKS(size_in_blocks)) #define VSECTORS_TO_BLOCKS(sectors) ((sector_count_t) sectors / (BLOCK_SIZE >> EVMS_VSECTOR_SIZE_SHIFT)) #define BLOCKS_TO_VSECTORS(blocks) ((sector_count_t) blocks * (BLOCK_SIZE >> EVMS_VSECTOR_SIZE_SHIFT))