NeilBrown: Grow: --size improvements.
Martin F. Krafft
madduck at alioth.debian.org
Wed Jan 27 02:03:01 UTC 2010
Module: mdadm
Branch: upstream
Commit: 5f4fc0e1916c47c1b172801f53362e50d32cd4dc
URL: http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=5f4fc0e1916c47c1b172801f53362e50d32cd4dc
Author: NeilBrown <neilb at suse.de>
Date: Tue Jul 14 14:32:30 2009 +1000
Grow: --size improvements.
1/ allow --size to be given with 'G' or 'T' suffix.
2/ allow size to exceed 32bits, and in that case write through sysfs.
Signed-off-by: NeilBrown <neilb at suse.de>
---
Grow.c | 15 ++++++++++++++-
mdadm.c | 6 ++++--
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/Grow.c b/Grow.c
index 65b708a..29d3628 100644
--- a/Grow.c
+++ b/Grow.c
@@ -512,8 +512,21 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
}
}
if (size >= 0) {
+ int rv;
array.size = size;
- if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
+ if (array.size != size) {
+ /* got truncated to 32bit, write to
+ * component_size instead
+ */
+ sra = sysfs_read(fd, 0, 0);
+ if (sra)
+ rv = sysfs_set_num(sra, NULL,
+ "component_size", size);
+ else
+ rv = -1;
+ } else
+ rv = ioctl(fd, SET_ARRAY_INFO, &array);
+ if (rv != 0) {
fprintf(stderr, Name ": Cannot set device size for %s: %s\n",
devname, strerror(errno));
return 1;
diff --git a/mdadm.c b/mdadm.c
index 0432622..a77c4ad 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -389,12 +389,14 @@ int main(int argc, char *argv[])
if (strcmp(optarg, "max")==0)
size = 0;
else {
- size = strtoll(optarg, &c, 10);
- if (!optarg[0] || *c || size < 4) {
+ size = parse_size(optarg);
+ if (size < 8) {
fprintf(stderr, Name ": invalid size: %s\n",
optarg);
exit(2);
}
+ /* convert sectors to K */
+ size /= 2;
}
continue;
More information about the pkg-mdadm-commits
mailing list