diff options
-rw-r--r-- | Build.c | 4 | ||||
-rw-r--r-- | Create.c | 4 | ||||
-rw-r--r-- | mdadm.8.in | 3 | ||||
-rw-r--r-- | mdadm.c | 4 |
4 files changed, 13 insertions, 2 deletions
@@ -254,6 +254,10 @@ int Build(char *mddev, int chunk, int level, int layout, if (ioctl(mdfd, RUN_ARRAY, ¶m)) { fprintf(stderr, Name ": RUN_ARRAY failed: %s\n", strerror(errno)); + if (chunk & (chunk-1)) { + fprintf(stderr, " : Problem may be that chunk size" + " is not a power of 2\n"); + } goto abort; } } else { @@ -930,6 +930,10 @@ int Create(struct supertype *st, char *mddev, if (ioctl(mdfd, RUN_ARRAY, ¶m)) { fprintf(stderr, Name ": RUN_ARRAY failed: %s\n", strerror(errno)); + if (info.array.chunk_size & (info.array.chunk_size-1)) { + fprintf(stderr, " : Problem may be that " + "chunk size is not a power of 2\n"); + } ioctl(mdfd, STOP_ARRAY, NULL); goto abort; } @@ -484,6 +484,9 @@ array is 512KB. To ensure compatibility with earlier versions, the default when Building and array with no persistent metadata is 64KB. This is only meaningful for RAID0, RAID4, RAID5, RAID6, and RAID10. +RAID4, RAID5, RAID6, and RAID10 require the chunk size to be a power +of 2. In any case it must be a multiple of 4KB. + A suffix of 'M' or 'G' can be given to indicate Megabytes or Gigabytes respectively. @@ -361,12 +361,12 @@ int main(int argc, char *argv[]) exit(2); } chunk = parse_size(optarg); - if (chunk < 8 || ((chunk-1)&chunk)) { + if (chunk < 8 || (chunk&1)) { fprintf(stderr, Name ": invalid chunk/rounding value: %s\n", optarg); exit(2); } - /* Covert sectors to K */ + /* Convert sectors to K */ chunk /= 2; continue; |