Merge branch 'master' into devel-3.0
Conflicts: Build.c mdadm.c mdadm.h super1.c
This commit is contained in:
commit
8320878543
7
Build.c
7
Build.c
|
@ -36,7 +36,7 @@
|
||||||
int Build(char *mddev, int chunk, int level, int layout,
|
int Build(char *mddev, int chunk, int level, int layout,
|
||||||
int raiddisks, mddev_dev_t devlist, int assume_clean,
|
int raiddisks, mddev_dev_t devlist, int assume_clean,
|
||||||
char *bitmap_file, int bitmap_chunk, int write_behind,
|
char *bitmap_file, int bitmap_chunk, int write_behind,
|
||||||
int delay, int verbose, int autof)
|
int delay, int verbose, int autof, unsigned long long size)
|
||||||
{
|
{
|
||||||
/* Build a linear or raid0 arrays without superblocks
|
/* Build a linear or raid0 arrays without superblocks
|
||||||
* We cannot really do any checks, we just do it.
|
* We cannot really do any checks, we just do it.
|
||||||
|
@ -57,7 +57,6 @@ int Build(char *mddev, int chunk, int level, int layout,
|
||||||
int subdevs = 0, missing_disks = 0;
|
int subdevs = 0, missing_disks = 0;
|
||||||
mddev_dev_t dv;
|
mddev_dev_t dv;
|
||||||
int bitmap_fd;
|
int bitmap_fd;
|
||||||
unsigned long long size = ~0ULL;
|
|
||||||
unsigned long long bitmapsize;
|
unsigned long long bitmapsize;
|
||||||
int mdfd;
|
int mdfd;
|
||||||
char chosen_name[1024];
|
char chosen_name[1024];
|
||||||
|
@ -135,7 +134,7 @@ int Build(char *mddev, int chunk, int level, int layout,
|
||||||
if (vers >= 9000) {
|
if (vers >= 9000) {
|
||||||
mdu_array_info_t array;
|
mdu_array_info_t array;
|
||||||
array.level = level;
|
array.level = level;
|
||||||
array.size = 0;
|
array.size = size;
|
||||||
array.nr_disks = raiddisks;
|
array.nr_disks = raiddisks;
|
||||||
array.raid_disks = raiddisks;
|
array.raid_disks = raiddisks;
|
||||||
array.md_minor = 0;
|
array.md_minor = 0;
|
||||||
|
@ -194,7 +193,7 @@ int Build(char *mddev, int chunk, int level, int layout,
|
||||||
(size == 0 || dsize < size))
|
(size == 0 || dsize < size))
|
||||||
size = dsize;
|
size = dsize;
|
||||||
close(fd);
|
close(fd);
|
||||||
if (vers>= 9000) {
|
if (vers >= 9000) {
|
||||||
mdu_disk_info_t disk;
|
mdu_disk_info_t disk;
|
||||||
disk.number = i;
|
disk.number = i;
|
||||||
disk.raid_disk = i;
|
disk.raid_disk = i;
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -127,13 +127,13 @@ mdadm.tcc : $(SRCS) mdadm.h
|
||||||
|
|
||||||
mdadm.klibc : $(SRCS) mdadm.h
|
mdadm.klibc : $(SRCS) mdadm.h
|
||||||
rm -f $(OBJS)
|
rm -f $(OBJS)
|
||||||
gcc -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32 $(CFLAGS) $(SRCS)
|
$(CC) -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32 $(CFLAGS) $(SRCS)
|
||||||
|
|
||||||
mdadm.Os : $(SRCS) mdadm.h
|
mdadm.Os : $(SRCS) mdadm.h
|
||||||
gcc -o mdadm.Os $(CFLAGS) -DHAVE_STDINT_H -Os $(SRCS)
|
$(CC) -o mdadm.Os $(CFLAGS) -DHAVE_STDINT_H -Os $(SRCS)
|
||||||
|
|
||||||
mdadm.O2 : $(SRCS) mdadm.h
|
mdadm.O2 : $(SRCS) mdadm.h
|
||||||
gcc -o mdadm.O2 $(CFLAGS) -DHAVE_STDINT_H -O2 $(SRCS)
|
$(CC) -o mdadm.O2 $(CFLAGS) -DHAVE_STDINT_H -O2 $(SRCS)
|
||||||
|
|
||||||
mdmon : $(MON_OBJS)
|
mdmon : $(MON_OBJS)
|
||||||
$(CC) $(LDFLAGS) -o mdmon $(MON_OBJS) $(LDLIBS)
|
$(CC) $(LDFLAGS) -o mdmon $(MON_OBJS) $(LDLIBS)
|
||||||
|
|
5
Manage.c
5
Manage.c
|
@ -588,6 +588,11 @@ int Manage_subdevs(char *devname, int fd,
|
||||||
fprintf(stderr, Name ": re-added %s\n", dv->devname);
|
fprintf(stderr, Name ": re-added %s\n", dv->devname);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (errno == ENOMEM || errno == EROFS) {
|
||||||
|
fprintf(stderr, Name ": add new device failed for %s: %s\n",
|
||||||
|
dv->devname, strerror(errno));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/* fall back on normal-add */
|
/* fall back on normal-add */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
24
bitmap.c
24
bitmap.c
|
@ -271,6 +271,7 @@ int ExamineBitmap(char *filename, int brief, struct supertype *st)
|
||||||
int rv = 1;
|
int rv = 1;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
int swap;
|
int swap;
|
||||||
|
__u32 uuid32[4];
|
||||||
|
|
||||||
info = bitmap_file_read(filename, brief, &st);
|
info = bitmap_file_read(filename, brief, &st);
|
||||||
if (!info)
|
if (!info)
|
||||||
|
@ -298,19 +299,20 @@ int ExamineBitmap(char *filename, int brief, struct supertype *st)
|
||||||
#else
|
#else
|
||||||
swap = 1;
|
swap = 1;
|
||||||
#endif
|
#endif
|
||||||
if (swap) {
|
memcpy(uuid32, sb->uuid, 16);
|
||||||
|
if (swap)
|
||||||
printf(" UUID : %08x:%08x:%08x:%08x\n",
|
printf(" UUID : %08x:%08x:%08x:%08x\n",
|
||||||
swapl(*(__u32 *)(sb->uuid+0)),
|
swapl(uuid32[0]),
|
||||||
swapl(*(__u32 *)(sb->uuid+4)),
|
swapl(uuid32[1]),
|
||||||
swapl(*(__u32 *)(sb->uuid+8)),
|
swapl(uuid32[2]),
|
||||||
swapl(*(__u32 *)(sb->uuid+12)));
|
swapl(uuid32[3]));
|
||||||
} else {
|
else
|
||||||
printf(" UUID : %08x:%08x:%08x:%08x\n",
|
printf(" UUID : %08x:%08x:%08x:%08x\n",
|
||||||
*(__u32 *)(sb->uuid+0),
|
uuid32[0],
|
||||||
*(__u32 *)(sb->uuid+4),
|
uuid32[1],
|
||||||
*(__u32 *)(sb->uuid+8),
|
uuid32[2],
|
||||||
*(__u32 *)(sb->uuid+12));
|
uuid32[3]);
|
||||||
}
|
|
||||||
printf(" Events : %llu\n", (unsigned long long)sb->events);
|
printf(" Events : %llu\n", (unsigned long long)sb->events);
|
||||||
printf(" Events Cleared : %llu\n", (unsigned long long)sb->events_cleared);
|
printf(" Events Cleared : %llu\n", (unsigned long long)sb->events_cleared);
|
||||||
printf(" State : %s\n", bitmap_state(sb->state));
|
printf(" State : %s\n", bitmap_state(sb->state));
|
||||||
|
|
5
mdadm.c
5
mdadm.c
|
@ -378,7 +378,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
case O(GROW,'z'):
|
case O(GROW,'z'):
|
||||||
case O(CREATE,'z'): /* size */
|
case O(CREATE,'z'):
|
||||||
|
case O(BUILD,'z'): /* size */
|
||||||
if (size >= 0) {
|
if (size >= 0) {
|
||||||
fprintf(stderr, Name ": size may only be specified once. "
|
fprintf(stderr, Name ": size may only be specified once. "
|
||||||
"Second value is %s.\n", optarg);
|
"Second value is %s.\n", optarg);
|
||||||
|
@ -1202,7 +1203,7 @@ int main(int argc, char *argv[])
|
||||||
rv = Build(devlist->devname, chunk, level, layout,
|
rv = Build(devlist->devname, chunk, level, layout,
|
||||||
raiddisks, devlist->next, assume_clean,
|
raiddisks, devlist->next, assume_clean,
|
||||||
bitmap_file, bitmap_chunk, write_behind,
|
bitmap_file, bitmap_chunk, write_behind,
|
||||||
delay, verbose-quiet, autof);
|
delay, verbose-quiet, autof, size);
|
||||||
break;
|
break;
|
||||||
case CREATE:
|
case CREATE:
|
||||||
if (delay == 0) delay = DEFAULT_BITMAP_DELAY;
|
if (delay == 0) delay = DEFAULT_BITMAP_DELAY;
|
||||||
|
|
2
mdadm.h
2
mdadm.h
|
@ -730,7 +730,7 @@ extern int Assemble(struct supertype *st, char *mddev,
|
||||||
extern int Build(char *mddev, int chunk, int level, int layout,
|
extern int Build(char *mddev, int chunk, int level, int layout,
|
||||||
int raiddisks, mddev_dev_t devlist, int assume_clean,
|
int raiddisks, mddev_dev_t devlist, int assume_clean,
|
||||||
char *bitmap_file, int bitmap_chunk, int write_behind,
|
char *bitmap_file, int bitmap_chunk, int write_behind,
|
||||||
int delay, int verbose, int autof);
|
int delay, int verbose, int autof, unsigned long long size);
|
||||||
|
|
||||||
|
|
||||||
extern int Create(struct supertype *st, char *mddev,
|
extern int Create(struct supertype *st, char *mddev,
|
||||||
|
|
22
super1.c
22
super1.c
|
@ -687,10 +687,8 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
|
||||||
|
|
||||||
if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
|
if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
|
||||||
read(rfd, sb->device_uuid, 16) != 16) {
|
read(rfd, sb->device_uuid, 16) != 16) {
|
||||||
*(__u32*)(sb->device_uuid) = random();
|
__u32 r[4] = {random(), random(), random(), random()};
|
||||||
*(__u32*)(sb->device_uuid+4) = random();
|
memcpy(sb->device_uuid, r, 16);
|
||||||
*(__u32*)(sb->device_uuid+8) = random();
|
|
||||||
*(__u32*)(sb->device_uuid+12) = random();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb->dev_roles[i] =
|
sb->dev_roles[i] =
|
||||||
|
@ -816,10 +814,8 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
|
||||||
else {
|
else {
|
||||||
if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
|
if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
|
||||||
read(rfd, sb->set_uuid, 16) != 16) {
|
read(rfd, sb->set_uuid, 16) != 16) {
|
||||||
*(__u32*)(sb->set_uuid) = random();
|
__u32 r[4] = {random(), random(), random(), random()};
|
||||||
*(__u32*)(sb->set_uuid+4) = random();
|
memcpy(sb->set_uuid, r, 16);
|
||||||
*(__u32*)(sb->set_uuid+8) = random();
|
|
||||||
*(__u32*)(sb->set_uuid+12) = random();
|
|
||||||
}
|
}
|
||||||
if (rfd >= 0) close(rfd);
|
if (rfd >= 0) close(rfd);
|
||||||
}
|
}
|
||||||
|
@ -1023,12 +1019,12 @@ static int write_init_super1(struct supertype *st)
|
||||||
|
|
||||||
if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
|
if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
|
||||||
read(rfd, sb->device_uuid, 16) != 16) {
|
read(rfd, sb->device_uuid, 16) != 16) {
|
||||||
*(__u32*)(sb->device_uuid) = random();
|
__u32 r[4] = {random(), random(), random(), random()};
|
||||||
*(__u32*)(sb->device_uuid+4) = random();
|
memcpy(sb->device_uuid, r, 16);
|
||||||
*(__u32*)(sb->device_uuid+8) = random();
|
|
||||||
*(__u32*)(sb->device_uuid+12) = random();
|
|
||||||
}
|
}
|
||||||
if (rfd >= 0) close(rfd);
|
if (rfd >= 0)
|
||||||
|
close(rfd);
|
||||||
|
|
||||||
sb->events = 0;
|
sb->events = 0;
|
||||||
|
|
||||||
refst =*st;
|
refst =*st;
|
||||||
|
|
Loading…
Reference in New Issue