summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-06-14 08:29:20 +0200
committerNeil Brown <neilb@suse.de>2005-06-14 08:29:20 +0200
commit98ce3849202b323eb57a34f038bd8faa7ab30541 (patch)
tree2472737577d72b993bb024cf3aa7385d9d9b91c2
parentStuff (diff)
downloadmdadm-98ce3849202b323eb57a34f038bd8faa7ab30541.tar.xz
mdadm-98ce3849202b323eb57a34f038bd8faa7ab30541.zip
From paul.clements@steeleye.com Thu May 19 11:09:55 2005
X-VM-v5-Data: ([nil nil nil nil t nil nil nil nil] ["2589" "Wednesday" "18" "May" "2005" "21:09:47" "-0400" "Paul Clements" "paul.clements@steeleye.com" nil "93" "[PATCH 1/1] mdadm 2.0 devel: fix bitmap size calculation and allow \"missing\" device in Build command" "^From:" "neilb@cse.unsw.edu.au" "neilb@cse.unsw.edu.au" "5" nil nil nil nil nil nil nil nil nil] nil) Return-Path: <paul.clements@steeleye.com> Received: From smtp-dist.unsw.edu.au ([149.171.97.16] == smtp-dist-01.services.comms.unsw.EDU.AU) (for <neilb@cse.unsw.edu.au>) By note With Smtp ; Thu, 19 May 2005 11:09:55 +1000 Received: from localhost (avspam-03.services.comms.unsw.edu.au [149.171.100.18]) by smtp-dist.unsw.edu.au (8.13.1/8.13.1) with ESMTP id j4J19t05017496 for <VRT+EFNJ=JQ=cse.unsw.edu.au=neilb@cse.unsw.edu.au>; Thu, 19 May 2005 11:09:55 +1000 (EST) Received: from note.orchestra.cse.unsw.EDU.AU (note.orchestra.cse.unsw.EDU.AU [129.94.242.24]) by smtp.unsw.edu.au (8.13.1/8.13.1) with ESMTP id j4J19qEL010258 for <VRT+EFNJ=JQ=cse.unsw.edu.au=neilb@cse.unsw.edu.au>; Thu, 19 May 2005 11:09:53 +1000 (EST) Received: From hancock.sc.steeleye.com ([209.192.50.48] == stat16.steeleye.com) (for <neilb@cse.unsw.edu.au>) By note With Smtp ; Thu, 19 May 2005 11:09:52 +1000 Received: from steeleye.com (clements.sc.steeleye.com [172.17.6.4]) by hancock.sc.steeleye.com (8.11.6/8.11.6) with ESMTP id j4J19lA29968 for <neilb@cse.unsw.edu.au>; Wed, 18 May 2005 21:09:48 -0400 Message-ID: <428BE75B.20803@steeleye.com> User-Agent: Mozilla Thunderbird 0.5 (X11/20040208) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <428A496D.6000303@steeleye.com> In-Reply-To: <428A496D.6000303@steeleye.com> From: Paul Clements <paul.clements@steeleye.com> To: neilb@cse.unsw.edu.au Subject: [PATCH 1/1] mdadm 2.0 devel: fix bitmap size calculation and allow "missing" device in Build command Date: Wed, 18 May 2005 21:09:47 -0400 Content-Type: multipart/mixed; boundary="------------090601020206040308050709" This is a multi-part message in MIME format. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
-rw-r--r--Build.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/Build.c b/Build.c
index b1fa1225..3034b735 100644
--- a/Build.c
+++ b/Build.c
@@ -55,12 +55,18 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout,
int i;
int vers;
struct stat stb;
- int subdevs = 0;
+ int subdevs = 0, missing_disks = 0;
mddev_dev_t dv;
int bitmap_fd;
+/* unsigned long long size = ~0ULL; / * needed for bitmap only */
/* scan all devices, make sure they really are block devices */
for (dv = devlist; dv; dv=dv->next) {
+ subdevs++;
+ if (strcmp("missing", dv->devname) == 0) {
+ missing_disks++;
+ continue;
+ }
if (stat(dv->devname, &stb)) {
fprintf(stderr, Name ": Cannot find %s: %s\n",
dv->devname, strerror(errno));
@@ -71,7 +77,6 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout,
dv->devname);
return 1;
}
- subdevs++;
}
if (raiddisks != subdevs) {
@@ -124,10 +129,10 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout,
array.state = 0; /* not clean, but no errors */
if (assume_clean)
array.state |= 1;
- array.active_disks = raiddisks;
- array.working_disks = raiddisks;
+ array.active_disks = raiddisks - missing_disks;
+ array.working_disks = raiddisks - missing_disks;
array.spare_disks = 0;
- array.failed_disks = 0;
+ array.failed_disks = missing_disks;
if (chunk == 0)
chunk = 64;
array.chunk_size = chunk*1024;
@@ -143,8 +148,10 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout,
}
/* now add the devices */
for ((i=0), (dv = devlist) ; dv ; i++, dv=dv->next) {
+ if (strcmp("missing", dv->devname) == 0)
+ continue;
if (stat(dv->devname, &stb)) {
- fprintf(stderr, Name ": Wierd: %s has disappeared.\n",
+ fprintf(stderr, Name ": Weird: %s has disappeared.\n",
dv->devname);
goto abort;
}
@@ -236,4 +243,3 @@ int Build(char *mddev, int mdfd, int chunk, int level, int layout,
return 1;
}
-