diff --git a/Grow.c b/Grow.c index fc454b8..98b0fab 100755 --- a/Grow.c +++ b/Grow.c @@ -315,8 +315,8 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) return 1; } if (bmf.pathname[0]) { - if (strcmp(s->bitmap_file,"none")==0) { - if (ioctl(fd, SET_BITMAP_FILE, -1)!= 0) { + if (strcmp(s->bitmap_file,"none") == 0) { + if (ioctl(fd, SET_BITMAP_FILE, -1) != 0) { pr_err("failed to remove bitmap %s\n", bmf.pathname); return 1; @@ -331,11 +331,11 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) pr_err("cannot get array status for %s\n", devname); return 1; } - if (array.state & (1<bitmap_file, "none")==0) { - array.state &= ~(1< (0x7fffffffULL<<9)) { + array_size > (0x7fffffffULL << 9)) { /* Array is big enough that we cannot trust array.size * try other approaches */ @@ -371,7 +371,9 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) } if (array.level == 10) { - int ncopies = (array.layout&255)*((array.layout>>8)&255); + int ncopies; + + ncopies = (array.layout & 255) * ((array.layout >> 8) & 255); bitmapsize = bitmapsize * array.raid_disks / ncopies; } @@ -402,7 +404,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) mdi = sysfs_read(fd, NULL, GET_BITMAP_LOCATION); if (mdi) offset_setable = 1; - for (d=0; d< st->max_devs; d++) { + for (d = 0; d < st->max_devs; d++) { mdu_disk_info_t disk; char *dv; int fd2; @@ -410,10 +412,9 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) disk.number = d; if (ioctl(fd, GET_DISK_INFO, &disk) < 0) continue; - if (disk.major == 0 && - disk.minor == 0) + if (disk.major == 0 && disk.minor == 0) continue; - if ((disk.state & (1<bitmap_offset); } else { if (strcmp(s->bitmap_file, "clustered") == 0) - array.state |= (1<bitmap_file, c->force, (char*)uuid, s->bitmap_chunk, - c->delay, s->write_behind, bitmapsize, major)) { + if (CreateBitmap(s->bitmap_file, c->force, (char*)uuid, + s->bitmap_chunk, c->delay, s->write_behind, + bitmapsize, major)) { return 1; } bitmap_fd = open(s->bitmap_file, O_RDWR); if (bitmap_fd < 0) { - pr_err("weird: %s cannot be opened\n", - s->bitmap_file); + pr_err("weird: %s cannot be opened\n", s->bitmap_file); return 1; } if (ioctl(fd, SET_BITMAP_FILE, bitmap_fd) < 0) {