diff options
author | Neil Brown <neilb@suse.de> | 2006-01-30 23:23:45 +0000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-01-30 23:23:45 +0000 |
commit | 8fac0577f01646cb8a768c0830a884f74c63a18c (patch) | |
tree | 80f70444c7fb89aa7e610b4a360b575129033470 /Grow.c | |
parent | 91eedefcdddd6c4f4e159cfb9be9de38c9b39c7d (diff) | |
download | mdadm-8fac0577f01646cb8a768c0830a884f74c63a18c.tar.gz mdadm-8fac0577f01646cb8a768c0830a884f74c63a18c.tar.xz mdadm-8fac0577f01646cb8a768c0830a884f74c63a18c.zip |
Stuff like..
- report Intent Bitmap in --detail
- report internal bitmap in --examine
- pass' --force through to --grow --bitmap
- support v.large arrays in --grow --bitmap
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'Grow.c')
-rw-r--r-- | Grow.c | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -192,7 +192,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev) return 0; } -int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int write_behind) +int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int write_behind, int force) { /* * First check that array doesn't have a bitmap @@ -208,7 +208,7 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int struct supertype *st; int major = BITMAP_MAJOR_HI; int vers = md_get_version(fd); - unsigned long long bitmapsize; + unsigned long long bitmapsize, array_size; if (vers < 9003) { major = BITMAP_MAJOR_HOSTENDIAN; @@ -255,7 +255,22 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int devname); return 1; } - bitmapsize = array.size * 2; + bitmapsize = array.size; + bitmapsize <<= 1; +#ifdef BLKGETSIZE64 + if (ioctl(fd, BLKGETSIZE64, &array_size) == 0 && + array_size > (0x7fffffffULL<<9)) { + /* Array is big enough that we cannot trust array.size + * try other approaches + */ + bitmapsize = get_component_size(fd); + } +#endif + if (bitmapsize == 0) { + fprintf(stderr, Name ": Cannot reliably determine size of array to create bitmap - sorry.\n"); + return 1; + } + if (array.level == 10) { int ncopies = (array.layout&255)*(array.layout>>8); bitmapsize = bitmapsize * array.raid_disks / ncopies; @@ -343,13 +358,13 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int fprintf(stderr, Name ": cannot find UUID for array!\n"); return 1; } - if (CreateBitmap(file, 0, (char*)uuid, chunk, + if (CreateBitmap(file, force, (char*)uuid, chunk, delay, write_behind, bitmapsize, major)) { return 1; } bitmap_fd = open(file, O_RDWR); if (bitmap_fd < 0) { - fprintf(stderr, Name ": weird: %s cannot be openned\n", + fprintf(stderr, Name ": weird: %s cannot be opened\n", file); return 1; } |