Support 'bitmap=' in mdadm.conf for auto-assembling arrays with write-intent bitmaps in separate files.
Signed-off-by: Neil Brown <neilb@suse.de>
This commit is contained in:
parent
2ae555c3d9
commit
7ef02d0143
14
Assemble.c
14
Assemble.c
|
@ -623,6 +623,20 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
|
||||||
fprintf(stderr, Name ": SET_BITMAP_FILE failed.\n");
|
fprintf(stderr, Name ": SET_BITMAP_FILE failed.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
} else if (ident->bitmap_file) {
|
||||||
|
/* From config file */
|
||||||
|
int bmfd = open(ident->bitmap_file, O_RDWR);
|
||||||
|
if (bmfd < 0) {
|
||||||
|
fprintf(stderr, Name ": Could not open bitmap file %s\n",
|
||||||
|
ident->bitmap_file);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (ioctl(mdfd, SET_BITMAP_FILE, bmfd) != 0) {
|
||||||
|
fprintf(stderr, Name ": Failed to set bitmapfile for %s\n", mddev);
|
||||||
|
close(bmfd);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
close(bmfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First, add the raid disks, but add the chosen one last */
|
/* First, add the raid disks, but add the chosen one last */
|
||||||
|
|
|
@ -14,6 +14,8 @@ Changes Prior to 2.4 release
|
||||||
- Handle symlinks in /dev better
|
- Handle symlinks in /dev better
|
||||||
- Fix mess in --detail output which a device is missing.
|
- Fix mess in --detail output which a device is missing.
|
||||||
- Manpage tidyup
|
- Manpage tidyup
|
||||||
|
- Support 'bitmap=' in mdadm.conf for auto-assembling arrays with
|
||||||
|
write-intent bitmaps in separate files.
|
||||||
|
|
||||||
Changes Prior to 2.3.1 release
|
Changes Prior to 2.3.1 release
|
||||||
- Fixed -O2 compile so I could make and RPM.
|
- Fixed -O2 compile so I could make and RPM.
|
||||||
|
|
8
config.c
8
config.c
|
@ -281,6 +281,7 @@ void arrayline(char *line)
|
||||||
mis.next = NULL;
|
mis.next = NULL;
|
||||||
mis.st = NULL;
|
mis.st = NULL;
|
||||||
mis.bitmap_fd = -1;
|
mis.bitmap_fd = -1;
|
||||||
|
mis.bitmap_file = NULL;
|
||||||
mis.name[0] = 0;
|
mis.name[0] = 0;
|
||||||
|
|
||||||
for (w=dl_next(line); w!=line; w=dl_next(w)) {
|
for (w=dl_next(line); w!=line; w=dl_next(w)) {
|
||||||
|
@ -321,6 +322,13 @@ void arrayline(char *line)
|
||||||
else
|
else
|
||||||
strcpy(mis.name, w+5);
|
strcpy(mis.name, w+5);
|
||||||
|
|
||||||
|
} else if (strncasecmp(w, "bitmap=", 7) == 0) {
|
||||||
|
if (mis.bitmap_file)
|
||||||
|
fprintf(stderr, Name ": only specify bitmap file once. %s ignored\n",
|
||||||
|
w);
|
||||||
|
else
|
||||||
|
mis.bitmap_file = w+7;
|
||||||
|
|
||||||
} else if (strncasecmp(w, "devices=", 8 ) == 0 ) {
|
} else if (strncasecmp(w, "devices=", 8 ) == 0 ) {
|
||||||
if (mis.devices)
|
if (mis.devices)
|
||||||
fprintf(stderr, Name ": only specify devices once (use a comma separated list). %s ignored\n",
|
fprintf(stderr, Name ": only specify devices once (use a comma separated list). %s ignored\n",
|
||||||
|
|
1
mdadm.c
1
mdadm.c
|
@ -112,6 +112,7 @@ int main(int argc, char *argv[])
|
||||||
ident.autof = 0;
|
ident.autof = 0;
|
||||||
ident.st = NULL;
|
ident.st = NULL;
|
||||||
ident.bitmap_fd = -1;
|
ident.bitmap_fd = -1;
|
||||||
|
ident.bitmap_file = NULL;
|
||||||
ident.name[0] = 0;
|
ident.name[0] = 0;
|
||||||
|
|
||||||
while ((option_index = -1) ,
|
while ((option_index = -1) ,
|
||||||
|
|
12
mdadm.conf.5
12
mdadm.conf.5
|
@ -151,6 +151,18 @@ also have a number appended to indicate how many partitions to create
|
||||||
device files for, e.g.
|
device files for, e.g.
|
||||||
.BR auto=mdp5 .
|
.BR auto=mdp5 .
|
||||||
The default is 4.
|
The default is 4.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B bitmap=
|
||||||
|
The option specifies a file in which a write-intent bitmap should be
|
||||||
|
found. When assembling the array,
|
||||||
|
.I mdadm
|
||||||
|
will provide this file to the
|
||||||
|
.B md
|
||||||
|
driver as the bitmap file. This has the same function as the
|
||||||
|
.B --bitmap-file
|
||||||
|
option to
|
||||||
|
.BR --assemble .
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
|
|
1
mdadm.h
1
mdadm.h
|
@ -147,6 +147,7 @@ typedef struct mddev_ident_s {
|
||||||
struct supertype *st;
|
struct supertype *st;
|
||||||
int autof; /* 1 for normal, 2 for partitioned */
|
int autof; /* 1 for normal, 2 for partitioned */
|
||||||
char *spare_group;
|
char *spare_group;
|
||||||
|
char *bitmap_file;
|
||||||
int bitmap_fd;
|
int bitmap_fd;
|
||||||
|
|
||||||
struct mddev_ident_s *next;
|
struct mddev_ident_s *next;
|
||||||
|
|
Loading…
Reference in New Issue