Don't break long strings onto multiple lines.

It is best to keep strings all together so that they
are easier to search for in the source code.
If a string is so long that it looks ugly one line,
them maybe it should be broken into multiple lines
for display too.

Only strings which contain a newline can be broken
into multiple lines:

 "It is OK to\n"
 "break this string\n"


Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2015-02-12 13:46:53 +11:00
parent 1ade5cc15a
commit 7a862a020f
21 changed files with 275 additions and 582 deletions

View File

@ -233,8 +233,7 @@ static int select_devices(struct mddev_dev *devlist,
!conf_test_metadata(tst->ss->name, (pol = devid_policy(stb.st_rdev)),
tst->ss->match_home(tst, c->homehost) == 1)) {
if (report_mismatch)
pr_err("%s has metadata type %s for which "
"auto-assembly is disabled\n",
pr_err("%s has metadata type %s for which auto-assembly is disabled\n",
devname, tst->ss->name);
tmpdev->used = 2;
} else
@ -259,8 +258,7 @@ static int select_devices(struct mddev_dev *devlist,
!conf_test_metadata(tst->ss->name, (pol = devid_policy(stb.st_rdev)),
tst->ss->match_home(tst, c->homehost) == 1)) {
if (report_mismatch)
pr_err("%s has metadata type %s for which "
"auto-assembly is disabled\n",
pr_err("%s has metadata type %s for which auto-assembly is disabled\n",
devname, tst->ss->name);
tmpdev->used = 2;
}
@ -350,8 +348,7 @@ static int select_devices(struct mddev_dev *devlist,
st = tst; tst = NULL;
if (!auto_assem && inargv && tmpdev->next != NULL) {
pr_err("%s is a container, but is not "
"only device given: confused and aborting\n",
pr_err("%s is a container, but is not only device given: confused and aborting\n",
devname);
st->ss->free_super(st);
dev_policy_free(pol);
@ -636,8 +633,7 @@ static int load_devices(struct devs *devices, char *devmap,
c->homehost);
if (err < 0) {
if (err == -1)
pr_err("--update=%s not understood"
" for %s metadata\n",
pr_err("--update=%s not understood for %s metadata\n",
c->update, tst->ss->name);
tst->ss->free_super(tst);
free(tst);
@ -762,12 +758,9 @@ static int load_devices(struct devs *devices, char *devmap,
* Could be a mis-detection caused by overlapping
* partitions. fail-safe.
*/
pr_err("WARNING %s and %s appear"
" to have very similar superblocks.\n"
" If they are really different, "
"please --zero the superblock on one\n"
" If they are the same or overlap,"
" please remove one from %s.\n",
pr_err("WARNING %s and %s appear to have very similar superblocks.\n"
" If they are really different, please --zero the superblock on one\n"
" If they are the same or overlap, please remove one from %s.\n",
devices[best[i]].devname, devname,
inargv ? "the list" :
"the\n DEVICE list in mdadm.conf"
@ -968,8 +961,7 @@ static int start_array(int mdfd,
rv = add_disk(mdfd, st, content, &devices[j].i);
if (rv) {
pr_err("failed to add "
"%s to %s: %s\n",
pr_err("failed to add %s to %s: %s\n",
devices[j].devname,
mddev,
strerror(errno));
@ -998,8 +990,7 @@ static int start_array(int mdfd,
if (content->array.level == LEVEL_CONTAINER) {
if (c->verbose >= 0) {
pr_err("Container %s has been "
"assembled with %d drive%s",
pr_err("Container %s has been assembled with %d drive%s",
mddev, okcnt+sparecnt, okcnt+sparecnt==1?"":"s");
if (okcnt < (unsigned)content->array.raid_disks)
fprintf(stderr, " (out of %d)",
@ -1141,15 +1132,12 @@ static int start_array(int mdfd,
if (!enough(content->array.level, content->array.raid_disks,
content->array.layout, 1, avail))
pr_err("Not enough devices to "
"start the array.\n");
pr_err("Not enough devices to start the array.\n");
else if (!enough(content->array.level,
content->array.raid_disks,
content->array.layout, clean,
avail))
pr_err("Not enough devices to "
"start the array while not clean "
"- consider --force.\n");
pr_err("Not enough devices to start the array while not clean - consider --force.\n");
return 1;
}
@ -1174,9 +1162,7 @@ static int start_array(int mdfd,
content->array.raid_disks,
content->array.layout, clean,
avail))
fprintf(stderr, " - not enough to start the "
"array while not clean - consider "
"--force.\n");
fprintf(stderr, " - not enough to start the array while not clean - consider --force.\n");
else {
if (req_cnt == (unsigned)content->array.raid_disks)
fprintf(stderr, " - need all %d to start it", req_cnt);
@ -1698,8 +1684,7 @@ try_again:
int err = 0;
int *fdlist = xmalloc(sizeof(int)* bestcnt);
if (c->verbose > 0)
pr_err(":%s has an active reshape - checking "
"if critical section needs to be restored\n",
pr_err(":%s has an active reshape - checking if critical section needs to be restored\n",
chosen_name);
if (!c->backup_file)
c->backup_file = locate_backup(content->sys_name);
@ -1727,8 +1712,7 @@ try_again:
c->backup_file, c->verbose > 0);
if (err && c->invalid_backup) {
if (c->verbose > 0)
pr_err("continuing"
" without restoring backup\n");
pr_err("continuing without restoring backup\n");
err = 0;
}
}

View File

@ -254,8 +254,7 @@ int Build(char *mddev, struct mddev_dev *devlist,
pr_err("RUN_ARRAY failed: %s\n",
strerror(errno));
if (s->chunk & (s->chunk-1)) {
cont_err("Problem may be that chunk size"
" is not a power of 2\n");
cont_err("Problem may be that chunk size is not a power of 2\n");
}
goto abort;
}

View File

@ -177,8 +177,7 @@ int Create(struct supertype *st, char *mddev,
close(fd);
}
if (st && st->ss->external && s->sparedisks) {
pr_err("This metadata type does not support "
"spare disks at create time\n");
pr_err("This metadata type does not support spare disks at create time\n");
return 1;
}
if (subdevs > s->raiddisks+s->sparedisks) {
@ -261,8 +260,7 @@ int Create(struct supertype *st, char *mddev,
if (do_default_chunk) {
/* default chunk was just set */
if (c->verbose > 0)
pr_err("chunk size "
"defaults to %dK\n", s->chunk);
pr_err("chunk size defaults to %dK\n", s->chunk);
s->size &= ~(unsigned long long)(s->chunk - 1);
do_default_chunk = 0;
}
@ -375,8 +373,7 @@ int Create(struct supertype *st, char *mddev,
dname, strerror(errno));
exit(2);
}
pr_err("device %s not suitable "
"for any style of array\n",
pr_err("device %s not suitable for any style of array\n",
dname);
exit(2);
}
@ -393,8 +390,7 @@ int Create(struct supertype *st, char *mddev,
dname, &freesize,
c->verbose >= 0)) {
pr_err("%s is not suitable for "
"this array.\n",
pr_err("%s is not suitable for this array.\n",
dname);
fail = 1;
continue;
@ -408,8 +404,7 @@ int Create(struct supertype *st, char *mddev,
if (do_default_chunk) {
/* default chunk was just set */
if (c->verbose > 0)
pr_err("chunk size "
"defaults to %dK\n", s->chunk);
pr_err("chunk size defaults to %dK\n", s->chunk);
s->size &= ~(unsigned long long)(s->chunk - 1);
do_default_chunk = 0;
}
@ -421,8 +416,7 @@ int Create(struct supertype *st, char *mddev,
}
if (s->size && freesize < s->size) {
pr_err("%s is smaller than given size."
" %lluK < %lluK + metadata\n",
pr_err("%s is smaller than given size. %lluK < %lluK + metadata\n",
dname, freesize, s->size);
fail = 1;
continue;
@ -473,8 +467,7 @@ int Create(struct supertype *st, char *mddev,
}
}
if (s->raiddisks + s->sparedisks > st->max_devs) {
pr_err("Too many devices:"
" %s metadata only supports %d\n",
pr_err("Too many devices: %s metadata only supports %d\n",
st->ss->name, st->max_devs);
return 1;
}
@ -618,8 +611,7 @@ int Create(struct supertype *st, char *mddev,
memset(&inf, 0, sizeof(inf));
ioctl(mdfd, GET_ARRAY_INFO, &inf);
if (inf.working_disks != 0) {
pr_err("another array by this name"
" is already running.\n");
pr_err("another array by this name is already running.\n");
goto abort_locked;
}
}
@ -741,8 +733,7 @@ int Create(struct supertype *st, char *mddev,
mdi?mdi->text_version:"managed", devnm);
sysfs_free(mdi);
} else
pr_err("Defaulting to version"
" %s metadata\n", info.text_version);
pr_err("Defaulting to version %s metadata\n", info.text_version);
}
map_update(&map, fd2devnm(mdfd), info.text_version,
@ -797,14 +788,12 @@ int Create(struct supertype *st, char *mddev,
*/
container_fd = open_dev_excl(st->container_devnm);
if (container_fd < 0) {
pr_err("Cannot get exclusive "
"open on container - weird.\n");
pr_err("Cannot get exclusive open on container - weird.\n");
goto abort_locked;
}
if (mdmon_running(st->container_devnm)) {
if (c->verbose)
pr_err("reusing mdmon "
"for %s.\n",
pr_err("reusing mdmon for %s.\n",
st->container_devnm);
st->update_tail = &st->updates;
} else
@ -890,8 +879,7 @@ int Create(struct supertype *st, char *mddev,
fd = open(dv->devname, O_RDWR|O_EXCL);
if (fd < 0) {
pr_err("failed to open %s "
"after earlier success - aborting\n",
pr_err("failed to open %s after earlier success - aborting\n",
dv->devname);
goto abort_locked;
}
@ -928,8 +916,7 @@ int Create(struct supertype *st, char *mddev,
rv = add_disk(mdfd, st, &info, inf);
if (rv) {
pr_err("ADD_NEW_DISK for %s "
"failed: %s\n",
pr_err("ADD_NEW_DISK for %s failed: %s\n",
dv->devname, strerror(errno));
goto abort_locked;
}
@ -1007,8 +994,7 @@ int Create(struct supertype *st, char *mddev,
}
sysfs_set_safemode(&info, safe_mode_delay);
if (err) {
pr_err("failed to"
" activate array.\n");
pr_err("failed to activate array.\n");
ioctl(mdfd, STOP_ARRAY, NULL);
goto abort;
}
@ -1029,8 +1015,7 @@ int Create(struct supertype *st, char *mddev,
pr_err("RUN_ARRAY failed: %s\n",
strerror(errno));
if (info.array.chunk_size & (info.array.chunk_size-1)) {
cont_err("Problem may be that "
"chunk size is not a power of 2\n");
cont_err("Problem may be that chunk size is not a power of 2\n");
}
ioctl(mdfd, STOP_ARRAY, NULL);
goto abort;

182
Grow.c
View File

@ -87,11 +87,9 @@ int restore_backup(struct supertype *st,
}
free(fdlist);
if (err) {
pr_err("Failed to restore critical"
" section for reshape - sorry.\n");
pr_err("Failed to restore critical section for reshape - sorry.\n");
if (!backup_file)
pr_err("Possibly you need"
" to specify a --backup-file\n");
pr_err("Possibly you need to specify a --backup-file\n");
return 1;
}
@ -295,10 +293,8 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
if (vers < 9003) {
major = BITMAP_MAJOR_HOSTENDIAN;
pr_err("Warning - bitmaps created on this kernel"
" are not portable\n"
" between different architectures. Consider upgrading"
" the Linux kernel.\n");
pr_err("Warning - bitmaps created on this kernel are not portable\n"
" between different architectures. Consider upgrading the Linux kernel.\n");
}
if (ioctl(fd, GET_BITMAP_FILE, &bmf) != 0) {
@ -385,8 +381,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
int offset_setable = 0;
struct mdinfo *mdi;
if (st->ss->add_internal_bitmap == NULL) {
pr_err("Internal bitmaps not supported "
"with %s metadata\n", st->ss->name);
pr_err("Internal bitmaps not supported with %s metadata\n", st->ss->name);
return 1;
}
mdi = sysfs_read(fd, NULL, GET_BITMAP_LOCATION);
@ -417,8 +412,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
)
st->ss->write_bitmap(st, fd2);
else {
pr_err("failed to create internal bitmap"
" - chunksize problem.\n");
pr_err("failed to create internal bitmap - chunksize problem.\n");
close(fd2);
return 1;
}
@ -437,8 +431,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
}
if (rv < 0) {
if (errno == EBUSY)
pr_err("Cannot add bitmap while array is"
" resyncing or reshaping etc.\n");
pr_err("Cannot add bitmap while array is resyncing or reshaping etc.\n");
pr_err("failed to set internal bitmap.\n");
return 1;
}
@ -489,8 +482,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
if (ioctl(fd, SET_BITMAP_FILE, bitmap_fd) < 0) {
int err = errno;
if (errno == EBUSY)
pr_err("Cannot add bitmap while array is"
" resyncing or reshaping etc.\n");
pr_err("Cannot add bitmap while array is resyncing or reshaping etc.\n");
pr_err("Cannot set bitmap file for %s: %s\n",
devname, strerror(err));
return 1;
@ -917,8 +909,7 @@ int reshape_open_backup_file(char *backup_file,
dev = stb.st_dev;
fstat(fd, &stb);
if (stb.st_rdev == dev) {
pr_err("backup file must NOT be"
" on the array being reshaped.\n");
pr_err("backup file must NOT be on the array being reshaped.\n");
close(*fdlist);
return 0;
}
@ -926,8 +917,7 @@ int reshape_open_backup_file(char *backup_file,
memset(buf, 0, 512);
for (i=0; i < blocks + 8 ; i++) {
if (write(*fdlist, buf, 512) != 512) {
pr_err("%s: cannot create"
" backup file %s: %s\n",
pr_err("%s: cannot create backup file %s: %s\n",
devname, backup_file, strerror(errno));
return 0;
}
@ -1041,13 +1031,11 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
*/
if (info->new_level > 1 &&
(info->component_size & 7))
return "Cannot convert RAID1 of this size - "
"reduce size to multiple of 4K first.";
return "Cannot convert RAID1 of this size - reduce size to multiple of 4K first.";
if (info->new_level == 0) {
if (info->delta_disks != UnSet &&
info->delta_disks != 0)
return "Cannot change number of disks "
"with RAID1->RAID0 conversion";
return "Cannot change number of disks with RAID1->RAID0 conversion";
re->level = 0;
re->before.data_disks = 1;
re->after.data_disks = 1;
@ -1133,8 +1121,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
if (far > 1 && !offset)
return "Cannot reshape RAID10 to far-mode";
if (near * far != copies)
return "Cannot change number of copies"
" when reshaping RAID10";
return "Cannot change number of copies when reshaping RAID10";
}
if (info->delta_disks == UnSet)
info->delta_disks = 0;
@ -1184,15 +1171,13 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
/ info->array.raid_disks);
if (info->array.raid_disks * (copies-1)
!= info->delta_disks)
return "Impossible number of devices"
" for RAID0->RAID10";
return "Impossible number of devices for RAID0->RAID10";
info->new_layout = 0x100 + copies;
}
if (info->delta_disks == UnSet) {
int copies = info->new_layout & 0xff;
if (info->new_layout != 0x100 + copies)
return "New layout impossible"
" for RAID0->RAID10";;
return "New layout impossible for RAID0->RAID10";;
info->delta_disks = (copies - 1) *
info->array.raid_disks;
}
@ -1287,8 +1272,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
return "Can only convert a 2-device array to RAID1";
if (info->delta_disks != UnSet &&
info->delta_disks != 0)
return "Cannot set raid_disk when "
"converting RAID5->RAID1";
return "Cannot set raid_disk when converting RAID5->RAID1";
re->level = 1;
info->new_chunk = 0;
return NULL;
@ -1383,8 +1367,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
strcat(strcpy(layout, ls), "-6");
l = map_name(r6layout, layout);
if (l == UnSet)
return "Cannot find RAID6 layout"
" to convert to";
return "Cannot find RAID6 layout to convert to";
} else {
/* Current RAID6 has no equivalent.
* If it is already a '-6' layout we
@ -1571,10 +1554,8 @@ int Grow_reshape(char *devname, int fd,
if (s->size > 0 &&
(s->chunk || s->level!= UnSet || s->layout_str || s->raiddisks)) {
pr_err("cannot change component size at the same time "
"as other changes.\n"
" Change size first, then check data is intact before "
"making other changes.\n");
pr_err("cannot change component size at the same time as other changes.\n"
" Change size first, then check data is intact before making other changes.\n");
return 1;
}
@ -1592,8 +1573,7 @@ int Grow_reshape(char *devname, int fd,
return 1;
}
if (s->raiddisks > st->max_devs) {
pr_err("Cannot increase raid-disks on this array"
" beyond %d\n", st->max_devs);
pr_err("Cannot increase raid-disks on this array beyond %d\n", st->max_devs);
return 1;
}
@ -1647,9 +1627,7 @@ int Grow_reshape(char *devname, int fd,
& (1<<MD_SB_BLOCK_CONTAINER_RESHAPE))
allow_reshape = 0;
if (!allow_reshape) {
pr_err("cannot reshape arrays in"
" container with unsupported"
" metadata: %s(%s)\n",
pr_err("cannot reshape arrays in container with unsupported metadata: %s(%s)\n",
devname, container);
sysfs_free(cc);
free(subarray);
@ -1668,8 +1646,7 @@ int Grow_reshape(char *devname, int fd,
if (s->raiddisks > array.raid_disks &&
array.spare_disks +added_disks < (s->raiddisks - array.raid_disks) &&
!c->force) {
pr_err("Need %d spare%s to avoid degraded array,"
" and only have %d.\n"
pr_err("Need %d spare%s to avoid degraded array, and only have %d.\n"
" Use --force to over-ride this check.\n",
s->raiddisks - array.raid_disks,
s->raiddisks - array.raid_disks == 1 ? "" : "s",
@ -1695,8 +1672,7 @@ int Grow_reshape(char *devname, int fd,
sysfs_free(sra);
return 1;
} else if (frozen < 0) {
pr_err("%s is performing resync/recovery and cannot"
" be reshaped\n", devname);
pr_err("%s is performing resync/recovery and cannot be reshaped\n", devname);
sysfs_free(sra);
return 1;
}
@ -1737,8 +1713,7 @@ int Grow_reshape(char *devname, int fd,
sizeinfo->array.layout,
sizeinfo->array.raid_disks);
new_size /= data_disks;
dprintf("Metadata size correction from %llu to "
"%llu (%llu)\n", orig_size, new_size,
dprintf("Metadata size correction from %llu to %llu (%llu)\n", orig_size, new_size,
new_size * data_disks);
s->size = new_size;
sysfs_free(sizeinfo);
@ -1775,13 +1750,11 @@ int Grow_reshape(char *devname, int fd,
}
}
if (rv) {
pr_err("Cannot set size on "
"array members.\n");
pr_err("Cannot set size on array members.\n");
goto size_change_error;
}
if (min_csize && s->size > min_csize) {
pr_err("Cannot safely make this array "
"use more than 2TB per device on this kernel.\n");
pr_err("Cannot safely make this array use more than 2TB per device on this kernel.\n");
rv = 1;
goto size_change_error;
}
@ -1789,8 +1762,7 @@ int Grow_reshape(char *devname, int fd,
/* Don't let the kernel choose a size - it will get
* it wrong
*/
pr_err("Limited v0.90 array to "
"2TB per device\n");
pr_err("Limited v0.90 array to 2TB per device\n");
s->size = min_csize;
}
if (st->ss->external) {
@ -1879,12 +1851,10 @@ size_change_error:
s->size = array.size;
if (c->verbose >= 0) {
if (s->size == orig_size)
pr_err("component size of %s "
"unchanged at %lluK\n",
pr_err("component size of %s unchanged at %lluK\n",
devname, s->size);
else
pr_err("component size of %s "
"has been set to %lluK\n",
pr_err("component size of %s has been set to %lluK\n",
devname, s->size);
}
changed = 1;
@ -1952,12 +1922,9 @@ size_change_error:
if (info.array.level == 6 &&
(info.new_level == 6 || info.new_level == UnSet) &&
info.array.layout >= 16) {
pr_err("%s has a non-standard layout. If you"
" wish to preserve this\n", devname);
cont_err("during the reshape, please specify"
" --layout=preserve\n");
cont_err("If you want to change it, specify a"
" layout or use --layout=normalise\n");
pr_err("%s has a non-standard layout. If you wish to preserve this\n", devname);
cont_err("during the reshape, please specify --layout=preserve\n");
cont_err("If you want to change it, specify a layout or use --layout=normalise\n");
rv = 1;
goto release;
}
@ -1974,8 +1941,7 @@ size_change_error:
info.new_layout = map_name(r6layout, l);
}
} else {
pr_err("%s is only meaningful when reshaping"
" a RAID6 array.\n", s->layout_str);
pr_err("%s is only meaningful when reshaping a RAID6 array.\n", s->layout_str);
rv = 1;
goto release;
}
@ -1997,8 +1963,7 @@ size_change_error:
strcat(l, "-6");
info.new_layout = map_name(r6layout, l);
} else {
pr_err("%s in only meaningful when reshaping"
" to RAID6\n", s->layout_str);
pr_err("%s in only meaningful when reshaping to RAID6\n", s->layout_str);
rv = 1;
goto release;
}
@ -2020,14 +1985,12 @@ size_change_error:
info.new_layout = parse_layout_faulty(s->layout_str);
break;
default:
pr_err("layout not meaningful"
" with this level\n");
pr_err("layout not meaningful with this level\n");
rv = 1;
goto release;
}
if (info.new_layout == UnSet) {
pr_err("layout %s not understood"
" for this level\n",
pr_err("layout %s not understood for this level\n",
s->layout_str);
rv = 1;
goto release;
@ -2139,21 +2102,16 @@ static int verify_reshape_position(struct mdinfo *info, int level)
info->new_layout,
info->array.raid_disks);
if (info->reshape_progress < position) {
dprintf("Corrected reshape progress (%llu) to "
"md position (%llu)\n",
dprintf("Corrected reshape progress (%llu) to md position (%llu)\n",
info->reshape_progress, position);
info->reshape_progress = position;
ret_val = 1;
} else if (info->reshape_progress > position) {
pr_err("Fatal error: array "
"reshape was not properly frozen "
"(expected reshape position is %llu, "
"but reshape progress is %llu.\n",
pr_err("Fatal error: array reshape was not properly frozen (expected reshape position is %llu, but reshape progress is %llu.\n",
position, info->reshape_progress);
ret_val = -1;
} else {
dprintf("Reshape position in md and metadata "
"are the same;");
dprintf("Reshape position in md and metadata are the same;");
ret_val = 1;
}
}
@ -2255,8 +2213,7 @@ static int set_new_data_offset(struct mdinfo *sra, struct supertype *st,
if (info2.space_before == 0 &&
info2.space_after == 0) {
/* Metadata doesn't support data_offset changes */
pr_err("%s: Metadata version doesn't support"
" data_offset changes\n", devname);
pr_err("%s: Metadata version doesn't support data_offset changes\n", devname);
goto fallback;
}
if (before > info2.space_before)
@ -2502,8 +2459,7 @@ static int raid10_reshape(char *container, int fd, char *devname,
devname);
if (err == EBUSY &&
(info->array.state & (1<<MD_SB_BITMAP_PRESENT)))
cont_err(" Bitmap must be removed before"
" shape can be changed\n");
cont_err(" Bitmap must be removed before shape can be changed\n");
goto release;
}
sysfs_free(sra);
@ -2627,8 +2583,7 @@ static int impose_reshape(struct mdinfo *sra,
if (err == EBUSY &&
(array.state & (1<<MD_SB_BITMAP_PRESENT)))
cont_err("Bitmap must be removed before"
" shape can be changed\n");
cont_err("Bitmap must be removed before shape can be changed\n");
goto release;
}
@ -2652,8 +2607,7 @@ static int impose_reshape(struct mdinfo *sra,
if (err == EBUSY &&
(array.state & (1<<MD_SB_BITMAP_PRESENT)))
cont_err("Bitmap must be removed before"
" shape can be changed\n");
cont_err("Bitmap must be removed before shape can be changed\n");
goto release;
}
}
@ -2741,8 +2695,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
devname, c);
if (err == EBUSY &&
(array.state & (1<<MD_SB_BITMAP_PRESENT)))
cont_err("Bitmap must be removed"
" before level can be changed\n");
cont_err("Bitmap must be removed before level can be changed\n");
return err;
}
if (verbose >= 0)
@ -2872,8 +2825,7 @@ static int reshape_array(char *container, int fd, char *devname,
reshape.before.layout != info->array.layout ||
reshape.before.data_disks + reshape.parity
!= info->array.raid_disks - max(0, info->delta_disks))) {
pr_err("reshape info is not in native format -"
" cannot continue.\n");
pr_err("reshape info is not in native format - cannot continue.\n");
goto release;
}
@ -2930,8 +2882,7 @@ static int reshape_array(char *container, int fd, char *devname,
if (!force &&
info->new_level > 1 && info->array.level > 1 &&
spares_needed > info->array.spare_disks + added_disks) {
pr_err("Need %d spare%s to avoid degraded array,"
" and only have %d.\n"
pr_err("Need %d spare%s to avoid degraded array, and only have %d.\n"
" Use --force to over-ride this check.\n",
spares_needed,
spares_needed == 1 ? "" : "s",
@ -2944,8 +2895,7 @@ static int reshape_array(char *container, int fd, char *devname,
- array.raid_disks;
if ((info->new_level > 1 || info->new_level == 0) &&
spares_needed > info->array.spare_disks +added_disks) {
pr_err("Need %d spare%s to create working array,"
" and only have %d.\n",
pr_err("Need %d spare%s to create working array, and only have %d.\n",
spares_needed,
spares_needed == 1 ? "" : "s",
info->array.spare_disks + added_disks);
@ -3196,12 +3146,10 @@ started:
blocks < 16*1024*2)
blocks *= 2;
} else
pr_err("Need to backup %luK of critical "
"section..\n", blocks/2);
pr_err("Need to backup %luK of critical section..\n", blocks/2);
if (blocks >= sra->component_size/2) {
pr_err("%s: Something wrong"
" - reshape aborted\n",
pr_err("%s: Something wrong - reshape aborted\n",
devname);
goto release;
}
@ -3231,9 +3179,7 @@ started:
pr_err(" Please provide one with \"--backup=...\"\n");
goto release;
} else if (sra->array.spare_disks == 0) {
pr_err("%s: Cannot grow - "
"need a spare or backup-file to backup "
"critical section\n", devname);
pr_err("%s: Cannot grow - need a spare or backup-file to backup critical section\n", devname);
goto release;
}
} else {
@ -3276,8 +3222,7 @@ started:
free(fdlist);
free(offsets);
sysfs_free(sra);
pr_err("Reshape has to be continued from"
" location %llu when root filesystem has been mounted.\n",
pr_err("Reshape has to be continued from location %llu when root filesystem has been mounted.\n",
sra->reshape_progress);
return 1;
}
@ -3494,8 +3439,7 @@ int reshape_container(char *container, char *devname,
return 1;
default: /* parent */
if (!freeze_reshape)
printf("%s: multi-array reshape continues"
" in background\n", Name);
printf("%s: multi-array reshape continues in background\n", Name);
return 0;
case 0: /* child */
map_fork();
@ -3572,8 +3516,7 @@ int reshape_container(char *container, char *devname,
* This is possibly interim until the behaviour of
* reshape_array is resolved().
*/
printf("%s: Multiple reshape execution detected for "
"device %s.\n", Name, adev);
printf("%s: Multiple reshape execution detected for device %s.\n", Name, adev);
close(fd);
break;
}
@ -4528,8 +4471,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
if (info->array.utime > (int)__le64_to_cpu(bsb.mtime) + 2*60*60 ||
info->array.utime < (int)__le64_to_cpu(bsb.mtime) - 10*60) {
if (check_env("MDADM_GROW_ALLOW_OLD")) {
pr_err("accepting backup with timestamp %lu "
"for array with timestamp %lu\n",
pr_err("accepting backup with timestamp %lu for array with timestamp %lu\n",
(unsigned long)__le64_to_cpu(bsb.mtime),
(unsigned long)info->array.utime);
} else {
@ -4771,8 +4713,7 @@ int Grow_continue_command(char *devname, int fd,
int d;
dprintf_cont("native array (%s)\n", devname);
if (ioctl(fd, GET_ARRAY_INFO, &array.array) < 0) {
pr_err("%s is not an active md array -"
" aborting\n", devname);
pr_err("%s is not an active md array - aborting\n", devname);
ret_val = 1;
goto Grow_continue_command_exit;
}
@ -4828,8 +4769,7 @@ int Grow_continue_command(char *devname, int fd,
fd = cfd;
}
if (cfd < 0) {
pr_err("Unable to open container "
"for %s\n", devname);
pr_err("Unable to open container for %s\n", devname);
ret_val = 1;
goto Grow_continue_command_exit;
}
@ -4865,9 +4805,7 @@ int Grow_continue_command(char *devname, int fd,
allow_reshape = 0;
if (!allow_reshape) {
pr_err("cannot continue reshape of an array"
" in container with unsupported"
" metadata: %s(%s)\n",
pr_err("cannot continue reshape of an array in container with unsupported metadata: %s(%s)\n",
devname, container);
ret_val = 1;
goto Grow_continue_command_exit;
@ -4887,8 +4825,7 @@ int Grow_continue_command(char *devname, int fd,
break;
}
if (!content) {
pr_err("Unable to determine reshaped "
"array for %s\n", devname);
pr_err("Unable to determine reshaped array for %s\n", devname);
ret_val = 1;
goto Grow_continue_command_exit;
}
@ -4910,8 +4847,7 @@ int Grow_continue_command(char *devname, int fd,
if (mdmon_running(container))
st->update_tail = &st->updates;
else {
pr_err("No mdmon found. "
"Grow cannot continue.\n");
pr_err("No mdmon found. Grow cannot continue.\n");
ret_val = 1;
goto Grow_continue_command_exit;
}

View File

@ -138,8 +138,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
close(dfd);
if (!rv && st->ss->container_content) {
if (map_lock(&map))
pr_err("failed to get "
"exclusive lock on mapfile\n");
pr_err("failed to get exclusive lock on mapfile\n");
if (c->export)
printf("MD_DEVNAME=%s\n", devname);
rv = Incremental_container(st, devname, c, NULL);
@ -229,8 +228,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
if (match && match->devname
&& strcasecmp(match->devname, "<ignore>") == 0) {
if (c->verbose >= 0)
pr_err("array containing %s is explicitly"
" ignored by mdadm.conf\n",
pr_err("array containing %s is explicitly ignored by mdadm.conf\n",
devname);
goto out;
}
@ -251,8 +249,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
if (!match && !conf_test_metadata(st->ss->name, policy,
(trustworthy == LOCAL))) {
if (c->verbose >= 1)
pr_err("%s has metadata type %s for which "
"auto-assembly is disabled\n",
pr_err("%s has metadata type %s for which auto-assembly is disabled\n",
devname, st->ss->name);
goto out;
}
@ -289,8 +286,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
/* 4/ Check if array exists.
*/
if (map_lock(&map))
pr_err("failed to get exclusive lock on "
"mapfile\n");
pr_err("failed to get exclusive lock on mapfile\n");
/* Now check we can get O_EXCL. If not, probably "mdadm -A" has
* taken over
*/
@ -352,8 +348,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
* So reject it.
*/
ioctl(mdfd, STOP_ARRAY, NULL);
pr_err("You have an old buggy kernel which cannot support\n"
" --incremental reliably. Aborting.\n");
pr_err("You have an old buggy kernel which cannot support\n --incremental reliably. Aborting.\n");
rv = 2;
goto out_unlock;
}
@ -420,8 +415,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
st2 = dup_super(st);
if (st2->ss->load_super(st2, dfd2, NULL) ||
st->ss->compare_super(st, st2) != 0) {
pr_err("metadata mismatch between %s and "
"chosen array %s\n",
pr_err("metadata mismatch between %s and chosen array %s\n",
devname, chosen_name);
close(dfd2);
rv = 2;
@ -864,8 +858,7 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
*/
if (map_lock(&map)) {
pr_err("failed to get exclusive lock on "
"mapfile\n");
pr_err("failed to get exclusive lock on mapfile\n");
return 1;
}
for (mp = map ; mp ; mp = mp->next) {
@ -911,8 +904,7 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
sra->text_version);
if (!st2) {
if (verbose > 1)
pr_err("not adding %s to %s"
" as metadata not recognised.\n",
pr_err("not adding %s to %s as metadata not recognised.\n",
devname, mp->path);
goto next;
}
@ -994,8 +986,7 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
if (domain_test(dl, pol, st2->ss->name) != 1) {
/* domain test fails */
if (verbose > 1)
pr_err("not adding %s to %s as"
" it is not in a compatible domain\n",
pr_err("not adding %s to %s as it is not in a compatible domain\n",
devname, mp->path);
goto next;
@ -1267,8 +1258,7 @@ static int try_spare(char *devname, int *dfdp, struct dev_policy *pol,
!policy_action_allows(pol, st?st->ss->name:NULL,
act_spare_same_slot)) {
if (verbose > 1)
pr_err("%s is not bare, so not "
"considering as a spare\n",
pr_err("%s is not bare, so not considering as a spare\n",
devname);
return 1;
}
@ -1576,8 +1566,7 @@ static int Incremental_container(struct supertype *st, char *devname,
if (match && match->devname &&
strcasecmp(match->devname, "<ignore>") == 0) {
if (c->verbose > 0)
pr_err("array %s/%s is "
"explicitly ignored by mdadm.conf\n",
pr_err("array %s/%s is explicitly ignored by mdadm.conf\n",
match->container, match->member);
continue;
}
@ -1710,20 +1699,16 @@ int IncrementalRemove(char *devname, char *id_path, int verbose)
char buf[32];
if (!id_path)
dprintf("incremental removal without --path <id_path> "
"lacks the possibility to re-add new device in this "
"port\n");
dprintf("incremental removal without --path <id_path> lacks the possibility to re-add new device in this port\n");
if (strchr(devname, '/')) {
pr_err("incremental removal requires a "
"kernel device name, not a file: %s\n", devname);
pr_err("incremental removal requires a kernel device name, not a file: %s\n", devname);
return 1;
}
ent = mdstat_by_component(devname);
if (!ent) {
if (verbose >= 0)
pr_err("%s does not appear to be a component "
"of any array\n", devname);
pr_err("%s does not appear to be a component of any array\n", devname);
return 1;
}
sysfs_init(&mdi, -1, ent->devnm);

View File

@ -211,8 +211,7 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry)
if (md_get_version(fd) < 9000) {
if (ioctl(fd, STOP_MD, 0) == 0)
return 0;
pr_err("stopping device %s "
"failed: %s\n",
pr_err("stopping device %s failed: %s\n",
devname, strerror(errno));
return 1;
}
@ -252,10 +251,7 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry)
if (fd >= 0)
close(fd);
if (verbose >= 0)
pr_err("Cannot get exclusive access to %s:"
"Perhaps a running "
"process, mounted filesystem "
"or active volume group?\n",
pr_err("Cannot get exclusive access to %s:Perhaps a running process, mounted filesystem or active volume group?\n",
devname);
return 1;
}
@ -293,8 +289,7 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry)
fd = open_dev_excl(devnm);
if (fd < 0) {
if (verbose >= 0)
pr_err("failed to completely stop %s"
": Device is busy\n",
pr_err("failed to completely stop %s: Device is busy\n",
devname);
rv = 1;
goto out;
@ -320,8 +315,7 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry)
metadata_container_matches(m->metadata_version+9,
devnm)) {
if (verbose >= 0)
pr_err("Cannot stop container %s: "
"member %s still active\n",
pr_err("Cannot stop container %s: member %s still active\n",
devname, m->dev);
free_mdstat(mds);
rv = 1;
@ -460,9 +454,7 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry)
pr_err("failed to stop array %s: %s\n",
devname, strerror(errno));
if (errno == EBUSY)
cont_err("Perhaps a running "
"process, mounted filesystem "
"or active volume group?\n");
cont_err("Perhaps a running process, mounted filesystem or active volume group?\n");
}
rv = 1;
goto out;
@ -652,8 +644,7 @@ int attempt_re_add(int fd, int tfd, struct mddev_dev *dv,
int rv = -1;
tfd = dev_open(dv->devname, O_RDWR);
if (tfd < 0) {
pr_err("failed to open %s for"
" superblock update during re-add\n", dv->devname);
pr_err("failed to open %s for superblock update during re-add\n", dv->devname);
return -1;
}
@ -673,8 +664,7 @@ int attempt_re_add(int fd, int tfd, struct mddev_dev *dv,
rv = dev_st->ss->store_super(dev_st, tfd);
close(tfd);
if (rv != 0) {
pr_err("failed to update"
" superblock during re-add\n");
pr_err("failed to update superblock during re-add\n");
return -1;
}
}
@ -717,17 +707,13 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
if (tst->ss == &super0 && ldsize > 4ULL*1024*1024*1024*1024) {
/* More than 4TB is wasted on v0.90 */
if (!force) {
pr_err("%s is larger than %s can "
"effectively use.\n"
" Add --force is you "
"really want to add this device.\n",
pr_err("%s is larger than %s can effectively use.\n"
" Add --force is you really want to add this device.\n",
dv->devname, devname);
return -1;
}
pr_err("%s is larger than %s can "
"effectively use.\n"
" Adding anyway as --force "
"was given.\n",
pr_err("%s is larger than %s can effectively use.\n"
" Adding anyway as --force was given.\n",
dv->devname, devname);
}
if (!tst->ss->external &&
@ -949,8 +935,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
container_fd = open_dev_excl(devnm);
if (container_fd < 0) {
pr_err("add failed for %s:"
" could not get exclusive access to container\n",
pr_err("add failed for %s: could not get exclusive access to container\n",
dv->devname);
tst->ss->free_super(tst);
return -1;
@ -989,8 +974,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
* would block add_disk */
tst->ss->free_super(tst);
if (sysfs_add_disk(sra, &new_mdi, 0) != 0) {
pr_err("add new device to external metadata"
" failed for %s\n", dv->devname);
pr_err("add new device to external metadata failed for %s\n", dv->devname);
close(container_fd);
sysfs_free(sra);
return -1;
@ -1032,8 +1016,7 @@ int Manage_remove(struct supertype *tst, int fd, struct mddev_dev *dv,
strcpy(devnm, fd2devnm(fd));
lfd = open_dev_excl(devnm);
if (lfd < 0) {
pr_err("Cannot get exclusive access "
" to container - odd\n");
pr_err("Cannot get exclusive access to container - odd\n");
return -1;
}
/* We may not be able to check on holders in
@ -1093,8 +1076,7 @@ int Manage_remove(struct supertype *tst, int fd, struct mddev_dev *dv,
}
}
if (err) {
pr_err("hot remove failed "
"for %s: %s\n", dv->devname,
pr_err("hot remove failed for %s: %s\n", dv->devname,
strerror(errno));
if (lfd >= 0)
close(lfd);
@ -1304,8 +1286,7 @@ int Manage_subdevs(char *devname, int fd,
strcmp(dv->devname, "faulty") == 0) {
if (dv->disposition != 'A'
&& dv->disposition != 'r') {
pr_err("%s only meaningful "
"with -r or --re-add, not -%c\n",
pr_err("%s only meaningful with -r or --re-add, not -%c\n",
dv->devname, dv->disposition);
goto abort;
}
@ -1315,8 +1296,7 @@ int Manage_subdevs(char *devname, int fd,
}
if (strcmp(dv->devname, "detached") == 0) {
if (dv->disposition != 'r' && dv->disposition != 'f') {
pr_err("%s only meaningful "
"with -r of -f, not -%c\n",
pr_err("%s only meaningful with -r of -f, not -%c\n",
dv->devname, dv->disposition);
goto abort;
}
@ -1328,8 +1308,7 @@ int Manage_subdevs(char *devname, int fd,
struct mddev_dev *add_devlist = NULL;
struct mddev_dev **dp;
if (dv->disposition != 'A') {
pr_err("'missing' only meaningful "
"with --re-add\n");
pr_err("'missing' only meaningful with --re-add\n");
goto abort;
}
add_devlist = conf_get_devs();
@ -1381,8 +1360,7 @@ int Manage_subdevs(char *devname, int fd,
int found = 0;
char dname[55];
if (dv->disposition != 'r' && dv->disposition != 'f') {
pr_err("%s only meaningful "
"with -r or -f, not -%c\n",
pr_err("%s only meaningful with -r or -f, not -%c\n",
dv->devname, dv->disposition);
goto abort;
}
@ -1402,8 +1380,7 @@ int Manage_subdevs(char *devname, int fd,
if (!found) {
sysfd = sysfs_open(fd2devnm(fd), dname, "state");
if (sysfd < 0) {
pr_err("%s does not appear "
"to be a component of %s\n",
pr_err("%s does not appear to be a component of %s\n",
dv->devname, devname);
goto abort;
}
@ -1462,9 +1439,7 @@ int Manage_subdevs(char *devname, int fd,
case 'F': /* --re-add faulty */
/* add the device */
if (subarray) {
pr_err("Cannot add disks to a"
" \'member\' array, perform this"
" operation on the parent container\n");
pr_err("Cannot add disks to a \'member\' array, perform this operation on the parent container\n");
goto abort;
}
if (dv->disposition == 'F')
@ -1507,9 +1482,7 @@ int Manage_subdevs(char *devname, int fd,
case 'r':
/* hot remove */
if (subarray) {
pr_err("Cannot remove disks from a"
" \'member\' array, perform this"
" operation on the parent container\n");
pr_err("Cannot remove disks from a \'member\' array, perform this operation on the parent container\n");
rv = -1;
} else
rv = Manage_remove(tst, fd, dv, sysfd,
@ -1547,9 +1520,7 @@ int Manage_subdevs(char *devname, int fd,
break;
case 'R': /* Mark as replaceable */
if (subarray) {
pr_err("Cannot replace disks in a"
" \'member\' array, perform this"
" operation on the parent container\n");
pr_err("Cannot replace disks in a \'member\' array, perform this operation on the parent container\n");
rv = -1;
} else {
if (!frozen) {

View File

@ -310,15 +310,11 @@ static int check_one_sharer(int scan)
rv = stat(dir, &buf);
if (rv != -1) {
if (scan) {
pr_err("Only one "
"autorebuild process allowed"
" in scan mode, aborting\n");
pr_err("Only one autorebuild process allowed in scan mode, aborting\n");
fclose(fp);
return 1;
} else {
pr_err("Warning: One"
" autorebuild process already"
" running.\n");
pr_err("Warning: One autorebuild process already running.\n");
}
}
fclose(fp);
@ -326,14 +322,11 @@ static int check_one_sharer(int scan)
if (scan) {
if (mkdir(MDMON_DIR, S_IRWXU) < 0 &&
errno != EEXIST) {
pr_err("Can't create "
"autorebuild.pid file\n");
pr_err("Can't create autorebuild.pid file\n");
} else {
fp = fopen(path, "w");
if (!fp)
pr_err("Cannot create"
" autorebuild.pid"
"file\n");
pr_err("Cannot create autorebuild.pidfile\n");
else {
pid = getpid();
fprintf(fp, "%d\n", pid);
@ -387,18 +380,15 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
event, dev, hname);
fprintf(mp,
"This is an automatically generated"
" mail message from %s\n", Name);
"This is an automatically generated mail message from %s\n", Name);
fprintf(mp, "running on %s\n\n", hname);
fprintf(mp,
"A %s event had been detected on"
" md device %s.\n\n", event, dev);
"A %s event had been detected on md device %s.\n\n", event, dev);
if (disc && disc[0] != ' ')
fprintf(mp,
"It could be related to"
" component device %s.\n\n", disc);
"It could be related to component device %s.\n\n", disc);
if (disc && disc[0] == ' ')
fprintf(mp, "Extra information:%s.\n\n", disc);
@ -409,8 +399,7 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
char buf[8192];
int n;
fprintf(mp,
"\nP.S. The /proc/mdstat file"
" currently contains the following:\n\n");
"\nP.S. The /proc/mdstat file currently contains the following:\n\n");
while ( (n=fread(buf, 1, sizeof(buf), mdstat)) > 0)
n=fwrite(buf, 1, n, mp);
fclose(mdstat);
@ -439,8 +428,7 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
if (disc)
syslog(priority,
"%s event detected on md device %s,"
" component device %s", event, dev, disc);
"%s event detected on md device %s, component device %s", event, dev, disc);
else
syslog(priority,
"%s event detected on md device %s",
@ -1062,8 +1050,7 @@ int WaitClean(char *dev, int sock, int verbose)
mdi = sysfs_read(fd, devnm, GET_VERSION|GET_LEVEL|GET_SAFEMODE);
if (!mdi) {
if (verbose)
pr_err("Failed to read sysfs attributes for "
"%s\n", dev);
pr_err("Failed to read sysfs attributes for %s\n", dev);
close(fd);
return 0;
}

View File

@ -140,8 +140,7 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief)
info = xmalloc(sizeof(*info));
if (n < sizeof(info->sb)) {
pr_err("failed to read superblock of bitmap "
"file: %s\n", strerror(errno));
pr_err("failed to read superblock of bitmap file: %s\n", strerror(errno));
free(info);
free(buf);
return NULL;
@ -182,8 +181,7 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief)
}
if (read_bits < total_bits) { /* file truncated... */
pr_err("WARNING: bitmap file is not large "
"enough for array size %llu!\n\n",
pr_err("WARNING: bitmap file is not large enough for array size %llu!\n\n",
(unsigned long long)info->sb.sync_size);
total_bits = read_bits;
}

View File

@ -396,14 +396,12 @@ void arrayline(char *line)
) {
/* This is acceptable */;
if (mis.devname)
pr_err("only give one "
"device per ARRAY line: %s and %s\n",
pr_err("only give one device per ARRAY line: %s and %s\n",
mis.devname, w);
else
mis.devname = w;
}else {
pr_err("%s is an invalid name for "
"an md device - ignored.\n", w);
pr_err("%s is an invalid name for an md device - ignored.\n", w);
}
} else if (strncasecmp(w, "uuid=", 5)==0 ) {
if (mis.uuid_set)
@ -1121,8 +1119,7 @@ struct mddev_ident *conf_match(struct supertype *st,
!array_list->devices &&
array_list->super_minor == UnSet) {
if (verbose >= 2 && array_list->devname)
pr_err("%s doesn't have any identifying"
" information.\n",
pr_err("%s doesn't have any identifying information.\n",
array_list->devname);
continue;
}
@ -1131,13 +1128,11 @@ struct mddev_ident *conf_match(struct supertype *st,
if (match) {
if (verbose >= 0) {
if (match->devname && array_list->devname)
pr_err("we match both %s and %s - "
"cannot decide which to use.\n",
pr_err("we match both %s and %s - cannot decide which to use.\n",
match->devname,
array_list->devname);
else
pr_err("multiple lines in mdadm.conf"
" match\n");
pr_err("multiple lines in mdadm.conf match\n");
}
if (rvp)
*rvp = 2;
@ -1174,8 +1169,7 @@ int conf_verify_devnames(struct mddev_ident *array_list)
"%s have the same name: %s\n",
nbuf, a1->devname);
} else
pr_err("Device %s given twice"
" in config file\n", a1->devname);
pr_err("Device %s given twice in config file\n", a1->devname);
return 1;
}
}

94
mdadm.c
View File

@ -337,13 +337,11 @@ int main(int argc, char *argv[])
}
if (devs_found > 0 && mode == MANAGE && !devmode) {
pr_err("Must give one of -a/-r/-f"
" for subsequent devices at %s\n", optarg);
pr_err("Must give one of -a/-r/-f for subsequent devices at %s\n", optarg);
exit(2);
}
if (devs_found > 0 && mode == GROW && !devmode) {
pr_err("Must give -a/--add for"
" devices to add: %s\n", optarg);
pr_err("Must give -a/--add for devices to add: %s\n", optarg);
exit(2);
}
dv = xmalloc(sizeof(*dv));
@ -370,8 +368,7 @@ int main(int argc, char *argv[])
case O(BUILD,'c'): /* chunk or rounding */
case O(BUILD,ChunkSize): /* chunk or rounding */
if (s.chunk) {
pr_err("chunk/rounding may only be specified once. "
"Second value is %s.\n", optarg);
pr_err("chunk/rounding may only be specified once. Second value is %s.\n", optarg);
exit(2);
}
s.chunk = parse_size(optarg);
@ -421,8 +418,7 @@ int main(int argc, char *argv[])
case O(CREATE,'z'):
case O(BUILD,'z'): /* size */
if (s.size > 0) {
pr_err("size may only be specified once. "
"Second value is %s.\n", optarg);
pr_err("size may only be specified once. Second value is %s.\n", optarg);
exit(2);
}
if (strcmp(optarg, "max")==0)
@ -442,8 +438,7 @@ int main(int argc, char *argv[])
case O(GROW,'Z'): /* array size */
if (array_size > 0) {
pr_err("array-size may only be specified once. "
"Second value is %s.\n", optarg);
pr_err("array-size may only be specified once. Second value is %s.\n", optarg);
exit(2);
}
if (strcmp(optarg, "max") == 0)
@ -462,8 +457,7 @@ int main(int argc, char *argv[])
case O(CREATE,DataOffset):
case O(GROW,DataOffset):
if (data_offset != INVALID_SECTORS) {
pr_err("data-offset may only be specified one. "
"Second value is %s.\n", optarg);
pr_err("data-offset may only be specified one. Second value is %s.\n", optarg);
exit(2);
}
if (mode == CREATE &&
@ -482,8 +476,7 @@ int main(int argc, char *argv[])
case O(CREATE,'l'):
case O(BUILD,'l'): /* set raid level*/
if (s.level != UnSet) {
pr_err("raid level may only be set once. "
"Second value is %s.\n", optarg);
pr_err("raid level may only be set once. Second value is %s.\n", optarg);
exit(2);
}
s.level = map_name(pers, optarg);
@ -511,8 +504,7 @@ int main(int argc, char *argv[])
case O(GROW, 'p'): /* new layout */
case O(GROW, Layout):
if (s.layout_str) {
pr_err("layout may only be sent once. "
"Second value was %s\n", optarg);
pr_err("layout may only be sent once. Second value was %s\n", optarg);
exit(2);
}
s.layout_str = optarg;
@ -524,8 +516,7 @@ int main(int argc, char *argv[])
case O(BUILD,'p'): /* faulty layout */
case O(BUILD,Layout):
if (s.layout != UnSet) {
pr_err("layout may only be sent once. "
"Second value was %s\n", optarg);
pr_err("layout may only be sent once. Second value was %s\n", optarg);
exit(2);
}
switch(s.level) {
@ -656,8 +647,7 @@ int main(int argc, char *argv[])
case O(CREATE,'u'): /* uuid of array */
case O(ASSEMBLE,'u'): /* uuid of array */
if (ident.uuid_set) {
pr_err("uuid cannot be set twice. "
"Second value %s.\n", optarg);
pr_err("uuid cannot be set twice. Second value %s.\n", optarg);
exit(2);
}
if (parse_uuid(optarg, ident.uuid))
@ -672,8 +662,7 @@ int main(int argc, char *argv[])
case O(ASSEMBLE,'N'):
case O(MISC,'N'):
if (ident.name[0]) {
pr_err("name cannot be set twice. "
"Second value %s.\n", optarg);
pr_err("name cannot be set twice. Second value %s.\n", optarg);
exit(2);
}
if (mode == MISC && !c.subarray) {
@ -691,8 +680,7 @@ int main(int argc, char *argv[])
case O(ASSEMBLE,'m'): /* super-minor for array */
case O(ASSEMBLE,SuperMinor):
if (ident.super_minor != UnSet) {
pr_err("super-minor cannot be set twice. "
"Second value: %s.\n", optarg);
pr_err("super-minor cannot be set twice. Second value: %s.\n", optarg);
exit(2);
}
if (strcmp(optarg, "dev")==0)
@ -715,14 +703,12 @@ int main(int argc, char *argv[])
case O(ASSEMBLE,'U'): /* update the superblock */
case O(MISC,'U'):
if (c.update) {
pr_err("Can only update one aspect"
" of superblock, both %s and %s given.\n",
pr_err("Can only update one aspect of superblock, both %s and %s given.\n",
c.update, optarg);
exit(2);
}
if (mode == MISC && !c.subarray) {
pr_err("Only subarrays can be"
" updated in misc mode\n");
pr_err("Only subarrays can be updated in misc mode\n");
exit(2);
}
c.update = optarg;
@ -754,16 +740,14 @@ int main(int argc, char *argv[])
continue;
if (strcmp(c.update, "byteorder")==0) {
if (ss) {
pr_err("must not set metadata"
" type with --update=byteorder.\n");
pr_err("must not set metadata type with --update=byteorder.\n");
exit(2);
}
for(i=0; !ss && superlist[i]; i++)
ss = superlist[i]->match_metadata_desc(
"0.swap");
if (!ss) {
pr_err("INTERNAL ERROR"
" cannot find 0.swap\n");
pr_err("INTERNAL ERROR cannot find 0.swap\n");
exit(2);
}
@ -790,13 +774,11 @@ int main(int argc, char *argv[])
case O(MANAGE,'U'):
/* update=devicesize is allowed with --re-add */
if (devmode != 'A') {
pr_err("--update in Manage mode only"
" allowed with --re-add.\n");
pr_err("--update in Manage mode only allowed with --re-add.\n");
exit(1);
}
if (c.update) {
pr_err("Can only update one aspect"
" of superblock, both %s and %s given.\n",
pr_err("Can only update one aspect of superblock, both %s and %s given.\n",
c.update, optarg);
exit(2);
}
@ -804,8 +786,7 @@ int main(int argc, char *argv[])
if (strcmp(c.update, "devicesize") != 0 &&
strcmp(c.update, "bbl") != 0 &&
strcmp(c.update, "no-bbl") != 0) {
pr_err("only 'devicesize', 'bbl' and 'no-bbl' can be"
" updated with --re-add\n");
pr_err("only 'devicesize', 'bbl' and 'no-bbl' can be updated with --re-add\n");
exit(2);
}
continue;
@ -827,8 +808,7 @@ int main(int argc, char *argv[])
case O(MONITOR,ConfigFile):
case O(CREATE,ConfigFile):
if (configfile) {
pr_err("configfile cannot be set twice. "
"Second value is %s.\n", optarg);
pr_err("configfile cannot be set twice. Second value is %s.\n", optarg);
exit(2);
}
configfile = optarg;
@ -994,8 +974,7 @@ int main(int argc, char *argv[])
case O(MISC ,Action):
if (opt == KillSubarray || opt == UpdateSubarray) {
if (c.subarray) {
pr_err("subarray can only"
" be specified once\n");
pr_err("subarray can only be specified once\n");
exit(2);
}
c.subarray = optarg;
@ -1042,12 +1021,10 @@ int main(int argc, char *argv[])
continue;
case O(MISC, UdevRules):
if (devmode && devmode != opt) {
pr_err("--udev-rules must"
" be the only option.\n");
pr_err("--udev-rules must be the only option.\n");
} else {
if (udev_filename)
pr_err("only specify one udev "
"rule filename. %s ignored.\n",
pr_err("only specify one udev rule filename. %s ignored.\n",
optarg);
else
udev_filename = optarg;
@ -1239,15 +1216,13 @@ int main(int argc, char *argv[])
/* non-existent device is OK */
mdfd = open_mddev(devlist->devname, 0);
if (mdfd == -2) {
pr_err("device %s exists but is not an "
"md array.\n", devlist->devname);
pr_err("device %s exists but is not an md array.\n", devlist->devname);
exit(1);
}
if ((int)ident.super_minor == -2) {
struct stat stb;
if (mdfd < 0) {
pr_err("--super-minor=dev given, and "
"listed device %s doesn't exist.\n",
pr_err("--super-minor=dev given, and listed device %s doesn't exist.\n",
devlist->devname);
exit(1);
}
@ -1485,8 +1460,7 @@ int main(int argc, char *argv[])
struct mdinfo sra;
int err;
if (s.raiddisks || s.level != UnSet) {
pr_err("cannot change array size in same operation "
"as changing raiddisks or level.\n"
pr_err("cannot change array size in same operation as changing raiddisks or level.\n"
" Change size first, then check that data is still intact.\n");
rv = 1;
break;
@ -1498,11 +1472,9 @@ int main(int argc, char *argv[])
err = sysfs_set_num(&sra, NULL, "array_size", array_size / 2);
if (err < 0) {
if (errno == E2BIG)
pr_err("--array-size setting"
" is too large.\n");
pr_err("--array-size setting is too large.\n");
else
pr_err("current kernel does"
" not support setting --array-size\n");
pr_err("current kernel does not support setting --array-size\n");
rv = 1;
break;
}
@ -1510,8 +1482,7 @@ int main(int argc, char *argv[])
if (devs_found > 1 && s.raiddisks == 0 && s.level == UnSet) {
/* must be '-a'. */
if (s.size > 0 || s.chunk || s.layout_str != NULL || s.bitmap_file) {
pr_err("--add cannot be used with "
"other geometry changes in --grow mode\n");
pr_err("--add cannot be used with other geometry changes in --grow mode\n");
rv = 1;
break;
}
@ -1524,9 +1495,7 @@ int main(int argc, char *argv[])
} else if (s.bitmap_file) {
if (s.size > 0 || s.raiddisks || s.chunk ||
s.layout_str != NULL || devs_found > 1) {
pr_err("--bitmap changes cannot be "
"used with other geometry changes "
"in --grow mode\n");
pr_err("--bitmap changes cannot be used with other geometry changes in --grow mode\n");
rv = 1;
break;
}
@ -1603,8 +1572,7 @@ static int scan_assemble(struct supertype *ss,
int failures, successes;
if (conf_verify_devnames(array_list)) {
pr_err("Duplicate MD device names in "
"conf file were found.\n");
pr_err("Duplicate MD device names in conf file were found.\n");
return 1;
}
if (devlist == NULL) {

View File

@ -173,8 +173,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
/* name *must* be mdXX or md_dXX in this context */
if (num < 0 ||
(strcmp(cname, "md") != 0 && strcmp(cname, "md_d") != 0)) {
pr_err("%s is an invalid name "
"for an md device. Try /dev/md/%s\n",
pr_err("%s is an invalid name for an md device. Try /dev/md/%s\n",
dev, dev+5);
return -1;
}
@ -191,13 +190,11 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
* empty.
*/
if (strchr(cname, '/') != NULL) {
pr_err("%s is an invalid name "
"for an md device.\n", dev);
pr_err("%s is an invalid name for an md device.\n", dev);
return -1;
}
if (cname[0] == 0) {
pr_err("%s is an invalid name "
"for an md device (empty!).", dev);
pr_err("%s is an invalid name for an md device (empty!).", dev);
return -1;
}
if (num < 0) {
@ -226,8 +223,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
if (name && name[0] == 0)
name = NULL;
if (name && trustworthy == METADATA && use_mdp == 1) {
pr_err("%s is not allowed for a %s container. "
"Consider /dev/md%d.\n", dev, name, num);
pr_err("%s is not allowed for a %s container. Consider /dev/md%d.\n", dev, name, num);
return -1;
}
if (name && trustworthy == METADATA)
@ -432,8 +428,7 @@ int open_mddev(char *dev, int report_errors)
if (md_get_version(mdfd) <= 0) {
close(mdfd);
if (report_errors)
pr_err("%s does not appear to be "
"an md device\n", dev);
pr_err("%s does not appear to be an md device\n", dev);
return -2;
}
return mdfd;

View File

@ -217,8 +217,7 @@ struct orom_entry {
static inline char *guid_str(char *buf, struct efi_guid guid)
{
sprintf(buf, "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x-%02x%02x%02x%02x%02x%02x",
sprintf(buf, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
guid.b[3], guid.b[2], guid.b[1], guid.b[0],
guid.b[5], guid.b[4], guid.b[7], guid.b[6],
guid.b[8], guid.b[9], guid.b[10], guid.b[11],

View File

@ -727,16 +727,14 @@ void policy_save_path(char *id_path, struct map_ent *array)
FILE *f = NULL;
if (mkdir(FAILED_SLOTS_DIR, S_IRWXU) < 0 && errno != EEXIST) {
pr_err("can't create file to save path "
"to old disk: %s\n", strerror(errno));
pr_err("can't create file to save path to old disk: %s\n", strerror(errno));
return;
}
snprintf(path, PATH_MAX, FAILED_SLOTS_DIR "/%s", id_path);
f = fopen(path, "w");
if (!f) {
pr_err("can't create file to"
" save path to old disk: %s\n",
pr_err("can't create file to save path to old disk: %s\n",
strerror(errno));
return;
}
@ -745,8 +743,7 @@ void policy_save_path(char *id_path, struct map_ent *array)
array->metadata,
array->uuid[0], array->uuid[1],
array->uuid[2], array->uuid[3]) <= 0)
pr_err("Failed to write to "
"<id_path> cookie\n");
pr_err("Failed to write to <id_path> cookie\n");
fclose(f);
}

View File

@ -642,8 +642,7 @@ int main(int argc, char *argv[])
raid_disks, chunk_size, level, layout,
start, length, disk_name, repair, failed_disk1, failed_disk2);
if (rv != 0) {
fprintf(stderr,
"%s: check_stripes returned %d\n", prg, rv);
fprintf(stderr, "%s: check_stripes returned %d\n", prg, rv);
exit_err = 7;
goto exitHere;
}

View File

@ -898,8 +898,7 @@ main(int argc, char *argv[])
char *err = NULL;
if (argc < 10) {
fprintf(stderr, "Usage: test_stripe save/restore file raid_disks"
" chunk_size level layout start length devices...\n");
fprintf(stderr, "Usage: test_stripe save/restore file raid_disks chunk_size level layout start length devices...\n");
exit(1);
}
if (strcmp(argv[1], "save")==0)

View File

@ -918,8 +918,7 @@ static int load_ddf_headers(int fd, struct ddf_super *super, char *devname)
if (memcmp(super->anchor.revision, DDF_REVISION_0, 8) != 0 &&
memcmp(super->anchor.revision, DDF_REVISION_2, 8) != 0) {
if (devname)
pr_err("can only support super revision"
" %.8s and earlier, not %.8s on %s\n",
pr_err("can only support super revision %.8s and earlier, not %.8s on %s\n",
DDF_REVISION_2, super->anchor.revision,devname);
return 2;
}
@ -928,8 +927,7 @@ static int load_ddf_headers(int fd, struct ddf_super *super, char *devname)
dsize >> 9, 1,
&super->primary, &super->anchor) == 0) {
if (devname)
pr_err("Failed to load primary DDF header "
"on %s\n", devname);
pr_err("Failed to load primary DDF header on %s\n", devname);
} else
super->active = &super->primary;
@ -1189,15 +1187,13 @@ static int load_super_ddf(struct supertype *st, int fd,
/* 32M is a lower bound */
if (dsize <= 32*1024*1024) {
if (devname)
pr_err("%s is too small for ddf: "
"size is %llu sectors.\n",
pr_err("%s is too small for ddf: size is %llu sectors.\n",
devname, dsize>>9);
return 1;
}
if (dsize & 511) {
if (devname)
pr_err("%s is an odd size for ddf: "
"size is %llu bytes.\n",
pr_err("%s is an odd size for ddf: size is %llu bytes.\n",
devname, dsize);
return 1;
}
@ -1223,8 +1219,7 @@ static int load_super_ddf(struct supertype *st, int fd,
if (rv) {
if (devname)
pr_err("Failed to load all information "
"sections on %s\n", devname);
pr_err("Failed to load all information sections on %s\n", devname);
free(super);
return rv;
}
@ -1233,8 +1228,7 @@ static int load_super_ddf(struct supertype *st, int fd,
if (rv) {
if (devname)
pr_err("Failed to load all information "
"sections on %s\n", devname);
pr_err("Failed to load all information sections on %s\n", devname);
free(super);
return rv;
}
@ -3430,8 +3424,7 @@ static int validate_geometry_ddf(struct supertype *st,
close(fd);
/* Just a bare device, no good to us */
if (verbose)
pr_err("ddf: Cannot create this array "
"on device %s - a container is required.\n",
pr_err("ddf: Cannot create this array on device %s - a container is required.\n",
dev);
return 0;
}
@ -3547,8 +3540,7 @@ static int validate_geometry_ddf_bvd(struct supertype *st,
}
if (dcnt < raiddisks) {
if (verbose)
pr_err("ddf: Not enough devices with "
"space for this array (%d < %d)\n",
pr_err("ddf: Not enough devices with space for this array (%d < %d)\n",
dcnt, raiddisks);
return 0;
}
@ -3566,8 +3558,7 @@ static int validate_geometry_ddf_bvd(struct supertype *st,
}
if (!dl) {
if (verbose)
pr_err("ddf: %s is not in the "
"same DDF set\n",
pr_err("ddf: %s is not in the same DDF set\n",
dev);
return 0;
}

View File

@ -1926,8 +1926,7 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle
list = find_intel_devices();
if (!list) {
if (verbose > 0)
pr_err("no active Intel(R) RAID "
"controller found.\n");
pr_err("no active Intel(R) RAID controller found.\n");
return 2;
} else if (verbose > 0)
print_found_intel_controllers(list);
@ -1975,8 +1974,7 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle
host_base = ahci_get_port_count(hba->path, &port_count);
if (ahci_enumerate_ports(hba->path, port_count, host_base, verbose)) {
if (verbose > 0)
pr_err("failed to enumerate "
"ports on SATA controller at %s.\n", hba->pci_id);
pr_err("failed to enumerate ports on SATA controller at %s.\n", hba->pci_id);
result |= 2;
}
}
@ -2749,8 +2747,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
info->reshape_progress = blocks_per_unit * units;
dprintf("IMSM: General Migration checkpoint : %llu "
"(%llu) -> read reshape progress : %llu\n",
dprintf("IMSM: General Migration checkpoint : %llu (%llu) -> read reshape progress : %llu\n",
(unsigned long long)units,
(unsigned long long)blocks_per_unit,
info->reshape_progress);
@ -3619,8 +3616,7 @@ static int load_imsm_mpb(int fd, struct intel_super *super, char *devname)
if (posix_memalign((void**)&anchor, 512, 512) != 0) {
if (devname)
pr_err("Failed to allocate imsm anchor buffer"
" on %s\n", devname);
pr_err("Failed to allocate imsm anchor buffer on %s\n", devname);
return 1;
}
if (read(fd, anchor, 512) != 512) {
@ -3868,10 +3864,8 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de
if (devname) {
struct intel_hba *hba = super->hba;
pr_err("%s is attached to Intel(R) %s RAID "
"controller (%s),\n"
" but the container is assigned to Intel(R) "
"%s RAID controller (",
pr_err("%s is attached to Intel(R) %s RAID controller (%s),\n"
" but the container is assigned to Intel(R) %s RAID controller (",
devname,
get_sys_dev_type(hba_name->type),
hba_name->pci_id ? : "Err!",
@ -3884,8 +3878,7 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de
hba = hba->next;
}
fprintf(stderr, ").\n"
" Mixing devices attached to different controllers "
"is not allowed.\n");
" Mixing devices attached to different controllers is not allowed.\n");
}
return 2;
}
@ -4173,8 +4166,7 @@ imsm_thunderdome(struct intel_super **super_list, int len)
champion = s;
if (conflict)
pr_err("Chose family %#x on '%s', "
"assemble conflicts to new container with '--update=uuid'\n",
pr_err("Chose family %#x on '%s', assemble conflicts to new container with '--update=uuid'\n",
__le32_to_cpu(s->anchor->family_num), s->disks->devname);
/* collect all dl's onto 'champion', and update them to
@ -4514,8 +4506,7 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname)
if (rv) {
if (devname)
pr_err("Failed to load all information "
"sections on %s\n", devname);
pr_err("Failed to load all information sections on %s\n", devname);
free_imsm(super);
return rv;
}
@ -4651,8 +4642,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
unsigned long long num_data_stripes;
if (super->orom && mpb->num_raid_devs >= super->orom->vpa) {
pr_err("This imsm-container already has the "
"maximum of %d volumes\n", super->orom->vpa);
pr_err("This imsm-container already has the maximum of %d volumes\n", super->orom->vpa);
return 0;
}
@ -4753,8 +4743,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
if (info->level == 1 && info->raid_disks > 2) {
free(dev);
free(dv);
pr_err("imsm does not support more than 2 disks"
"in a raid1 volume\n");
pr_err("imsm does not support more than 2 disksin a raid1 volume\n");
return 0;
}
@ -5414,8 +5403,7 @@ static int validate_geometry_imsm_container(struct supertype *st, int level,
if (super->orom) {
if (raiddisks > super->orom->tds) {
if (verbose)
pr_err("%d exceeds maximum number of"
" platform supported disks: %d\n",
pr_err("%d exceeds maximum number of platform supported disks: %d\n",
raiddisks, super->orom->tds);
free_imsm(super);
return 0;
@ -5934,8 +5922,7 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout,
*chunk = imsm_default_chunk(super->orom);
if (super->orom && !imsm_orom_has_chunk(super->orom, *chunk)) {
pr_vrb(": platform does not support a chunk size of: "
"%d\n", *chunk);
pr_vrb(": platform does not support a chunk size of: %d\n", *chunk);
return 0;
}
@ -5986,8 +5973,7 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
mpb = super->anchor;
if (!validate_geometry_imsm_orom(super, level, layout, raiddisks, chunk, size, verbose)) {
pr_err("RAID gemetry validation failed. "
"Cannot proceed with the action(s).\n");
pr_err("RAID gemetry validation failed. Cannot proceed with the action(s).\n");
return 0;
}
if (!dev) {
@ -6028,9 +6014,7 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
}
if (dcnt < raiddisks) {
if (verbose)
pr_err("imsm: Not enough "
"devices with space for this array "
"(%d < %d)\n",
pr_err("imsm: Not enough devices with space for this array (%d < %d)\n",
dcnt, raiddisks);
return 0;
}
@ -6049,8 +6033,7 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
}
if (!dl) {
if (verbose)
pr_err("%s is not in the "
"same imsm set\n", dev);
pr_err("%s is not in the same imsm set\n", dev);
return 0;
} else if (super->orom && dl->index < 0 && mpb->num_raid_devs) {
/* If a volume is present then the current creation attempt
@ -6058,15 +6041,12 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
* understand this configuration (all member disks must be
* members of each array in the container).
*/
pr_err("%s is a spare and a volume"
" is already defined for this container\n", dev);
pr_err("The option-rom requires all member"
" disks to be a member of all volumes\n");
pr_err("%s is a spare and a volume is already defined for this container\n", dev);
pr_err("The option-rom requires all member disks to be a member of all volumes\n");
return 0;
} else if (super->orom && mpb->num_raid_devs > 0 &&
mpb->num_disks != raiddisks) {
pr_err("The option-rom requires all member"
" disks to be a member of all volumes\n");
pr_err("The option-rom requires all member disks to be a member of all volumes\n");
return 0;
}
@ -6109,21 +6089,16 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
if (!check_env("IMSM_NO_PLATFORM") &&
mpb->num_raid_devs > 0 && size && size != maxsize) {
pr_err("attempting to create a second "
"volume with size less then remaining space. "
"Aborting...\n");
pr_err("attempting to create a second volume with size less then remaining space. Aborting...\n");
return 0;
}
if (maxsize < size || maxsize == 0) {
if (verbose) {
if (maxsize == 0)
pr_err("no free space"
" left on device. Aborting...\n");
pr_err("no free space left on device. Aborting...\n");
else
pr_err("not enough space"
" to create volume of given size"
" (%llu < %llu). Aborting...\n",
pr_err("not enough space to create volume of given size (%llu < %llu). Aborting...\n",
maxsize, size);
}
return 0;
@ -6209,9 +6184,7 @@ static int imsm_get_free_size(struct supertype *st, int raiddisks,
}
if (!check_env("IMSM_NO_PLATFORM") &&
mpb->num_raid_devs > 0 && size && size != maxsize) {
pr_err("attempting to create a second "
"volume with size less then remaining space. "
"Aborting...\n");
pr_err("attempting to create a second volume with size less then remaining space. Aborting...\n");
return 0;
}
cnt = 0;
@ -6293,8 +6266,7 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
count = count_volumes(super->hba->path,
super->orom->dpa, verbose);
if (super->orom->vphba <= count) {
pr_vrb(": platform does not support more"
" than %d raid volumes.\n",
pr_vrb(": platform does not support more than %d raid volumes.\n",
super->orom->vphba);
return 0;
}
@ -6612,14 +6584,12 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
/* do not assemble arrays when not all attributes are supported */
if (imsm_check_attributes(mpb->attributes) == 0) {
sb_errors = 1;
pr_err("Unsupported attributes in IMSM metadata."
"Arrays activation is blocked.\n");
pr_err("Unsupported attributes in IMSM metadata.Arrays activation is blocked.\n");
}
/* check for bad blocks */
if (imsm_bbm_log_size(super->anchor)) {
pr_err("BBM log found in IMSM metadata."
"Arrays activation is blocked.\n");
pr_err("BBM log found in IMSM metadata.Arrays activation is blocked.\n");
sb_errors = 1;
}
@ -6653,8 +6623,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
*/
if (dev->vol.migr_state &&
(migr_type(dev) == MIGR_STATE_CHANGE)) {
pr_err("cannot assemble volume '%.16s':"
" unsupported migration in progress\n",
pr_err("cannot assemble volume '%.16s': unsupported migration in progress\n",
dev->volume);
continue;
}
@ -6676,8 +6645,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
map->num_members, /* raid disks */
&chunk, join_u32(dev->size_low, dev->size_high),
1 /* verbose */)) {
pr_err("IMSM RAID geometry validation"
" failed. Array %s activation is blocked.\n",
pr_err("IMSM RAID geometry validation failed. Array %s activation is blocked.\n",
dev->volume);
this->array.state |=
(1<<MD_SB_BLOCK_CONTAINER_RESHAPE) |
@ -7666,8 +7634,7 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
/* Cannot activate another spare if rebuild is in progress already
*/
if (is_rebuilding(dev)) {
dprintf("imsm: No spare activation allowed. "
"Rebuild in progress already.\n");
dprintf("imsm: No spare activation allowed. Rebuild in progress already.\n");
return NULL;
}
@ -7687,8 +7654,7 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
* are removed from container.
*/
if (failed) {
dprintf("found failed disks in %.*s, check if there another"
"failed sub-array.\n",
dprintf("found failed disks in %.*s, check if there anotherfailed sub-array.\n",
MAX_RAID_SERIAL_LEN, dev->volume);
/* check if states of the other volumes allow for rebuild */
for (i = 0; i < super->anchor->num_raid_devs; i++) {
@ -7969,8 +7935,7 @@ static int apply_reshape_migration_update(struct imsm_update_reshape_migration *
new_disk = get_disk_super(super,
major(u->new_disks[0]),
minor(u->new_disks[0]));
dprintf("imsm: new disk for reshape is: %i:%i "
"(%p, index = %i)\n",
dprintf("imsm: new disk for reshape is: %i:%i (%p, index = %i)\n",
major(u->new_disks[0]),
minor(u->new_disks[0]),
new_disk, new_disk->index);
@ -8070,8 +8035,7 @@ static int apply_update_activate_spare(struct imsm_update_activate_spare *u,
break;
if (!dl) {
pr_err("error: imsm_activate_spare passed "
"an unknown disk (index: %d)\n",
pr_err("error: imsm_activate_spare passed an unknown disk (index: %d)\n",
u->dl->index);
return 0;
}
@ -8178,8 +8142,7 @@ static int apply_reshape_container_disks_update(struct imsm_update_reshape *u,
new_disk = get_disk_super(super,
major(u->new_disks[i]),
minor(u->new_disks[i]));
dprintf("imsm: new disk for reshape is: %i:%i "
"(%p, index = %i)\n",
dprintf("imsm: new disk for reshape is: %i:%i (%p, index = %i)\n",
major(u->new_disks[i]), minor(u->new_disks[i]),
new_disk, new_disk->index);
if ((new_disk == NULL) ||
@ -8651,8 +8614,7 @@ static void imsm_process_update(struct supertype *st,
break;
}
default:
pr_err("error: unsuported process update type:"
"(type: %d)\n", type);
pr_err("error: unsuported process update type:(type: %d)\n", type);
}
}
@ -9353,8 +9315,7 @@ int save_checkpoint_imsm(struct supertype *st, struct mdinfo *info, int state)
unsigned long long curr_migr_unit;
if (load_imsm_migr_rec(super, info) != 0) {
dprintf("imsm: ERROR: Cannot read migration record "
"for checkpoint save.\n");
dprintf("imsm: ERROR: Cannot read migration record for checkpoint save.\n");
return 1;
}
@ -9378,8 +9339,7 @@ int save_checkpoint_imsm(struct supertype *st, struct mdinfo *info, int state)
__cpu_to_le32(curr_migr_unit *
__le32_to_cpu(super->migr_rec->dest_depth_per_unit));
if (write_imsm_migr_rec(st) < 0) {
dprintf("imsm: Cannot write migration record "
"outside backup area\n");
dprintf("imsm: Cannot write migration record outside backup area\n");
return 1;
}
@ -9490,16 +9450,14 @@ int recover_backup_imsm(struct supertype *st, struct mdinfo *info)
new_disks,
super,
id->dev)) {
pr_err("Cannot restore data from backup."
" Too many failed disks\n");
pr_err("Cannot restore data from backup. Too many failed disks\n");
goto abort;
}
if (save_checkpoint_imsm(st, info, UNIT_SRC_NORMAL)) {
/* ignore error == 2, this can mean end of reshape here
*/
dprintf("imsm: Cannot write checkpoint to "
"migration record (UNIT_SRC_NORMAL) during restart\n");
dprintf("imsm: Cannot write checkpoint to migration record (UNIT_SRC_NORMAL) during restart\n");
} else
retval = 0;
@ -9574,22 +9532,19 @@ static int imsm_reshape_is_allowed_on_container(struct supertype *st,
struct mdinfo *info, *member;
int devices_that_can_grow = 0;
dprintf("imsm: imsm_reshape_is_allowed_on_container(ENTER): "
"st->devnm = (%s)\n", st->devnm);
dprintf("imsm: imsm_reshape_is_allowed_on_container(ENTER): st->devnm = (%s)\n", st->devnm);
if (geo->size > 0 ||
geo->level != UnSet ||
geo->layout != UnSet ||
geo->chunksize != 0 ||
geo->raid_disks == UnSet) {
dprintf("imsm: Container operation is allowed for "
"raid disks number change only.\n");
dprintf("imsm: Container operation is allowed for raid disks number change only.\n");
return ret_val;
}
if (direction == ROLLBACK_METADATA_CHANGES) {
dprintf("imsm: Metadata changes rollback is not supported for "
"container operation.\n");
dprintf("imsm: Metadata changes rollback is not supported for container operation.\n");
return ret_val;
}
@ -9604,8 +9559,7 @@ static int imsm_reshape_is_allowed_on_container(struct supertype *st,
/* we work on container for Online Capacity Expansion
* only so raid_disks has to grow
*/
dprintf("imsm: for container operation raid disks "
"increase is required\n");
dprintf("imsm: for container operation raid disks increase is required\n");
break;
}
@ -9613,8 +9567,7 @@ static int imsm_reshape_is_allowed_on_container(struct supertype *st,
(info->array.level != 5)) {
/* we cannot use this container with other raid level
*/
dprintf("imsm: for container operation wrong"
" raid level (%i) detected\n",
dprintf("imsm: for container operation wrong raid level (%i) detected\n",
info->array.level);
break;
} else {
@ -9625,8 +9578,7 @@ static int imsm_reshape_is_allowed_on_container(struct supertype *st,
if (!is_raid_level_supported(super->orom,
member->array.level,
geo->raid_disks)) {
dprintf("platform does not support raid%d with"
" %d disk%s\n",
dprintf("platform does not support raid%d with %d disk%s\n",
info->array.level,
geo->raid_disks,
geo->raid_disks > 1 ? "s" : "");
@ -9636,8 +9588,7 @@ static int imsm_reshape_is_allowed_on_container(struct supertype *st,
*/
if (info->component_size %
(info->array.chunk_size/512)) {
dprintf("Component size is not aligned to "
"chunk size\n");
dprintf("Component size is not aligned to chunk size\n");
break;
}
}
@ -9726,8 +9677,7 @@ static int imsm_create_metadata_update_for_reshape(
if (spares == NULL
|| delta_disks > spares->array.spare_disks) {
pr_err("imsm: ERROR: Cannot get spare devices "
"for %s.\n", geo->dev_name);
pr_err("imsm: ERROR: Cannot get spare devices for %s.\n", geo->dev_name);
i = -1;
goto abort;
}
@ -9840,8 +9790,7 @@ static int imsm_create_metadata_update_for_migration(
if (geo->chunksize != current_chunk_size) {
u->new_chunksize = geo->chunksize / 1024;
dprintf("imsm: "
"chunk size change from %i to %i\n",
dprintf("imsm: chunk size change from %i to %i\n",
current_chunk_size, u->new_chunksize);
}
previous_level = map->raid_level;
@ -9856,8 +9805,7 @@ static int imsm_create_metadata_update_for_migration(
free(u);
sysfs_free(spares);
update_memory_size = 0;
dprintf("error: cannot get spare device "
"for requested migration");
dprintf("error: cannot get spare device for requested migration");
return 0;
}
sysfs_free(spares);
@ -9925,9 +9873,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
if (geo->level == 5) {
change = CH_MIGRATION;
if (geo->layout != ALGORITHM_LEFT_ASYMMETRIC) {
pr_err("Error. Requested Layout "
"not supported (left-asymmetric layout "
"is supported only)!\n");
pr_err("Error. Requested Layout not supported (left-asymmetric layout is supported only)!\n");
change = -1;
goto analyse_change_exit;
}
@ -9952,8 +9898,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
break;
}
if (change == -1) {
pr_err("Error. Level Migration from %d to %d "
"not supported!\n",
pr_err("Error. Level Migration from %d to %d not supported!\n",
info.array.level, geo->level);
goto analyse_change_exit;
}
@ -9974,8 +9919,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
geo->layout = 0;
geo->level = 5;
} else {
pr_err("Error. Layout Migration from %d to %d "
"not supported!\n",
pr_err("Error. Layout Migration from %d to %d not supported!\n",
info.array.layout, geo->layout);
change = -1;
goto analyse_change_exit;
@ -10009,9 +9953,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
chunk * 1024,
geo->size * 2);
if (geo->size == 0) {
pr_err("Error. Size expansion is " \
"supported only (current size is %llu, " \
"requested size /rounded/ is 0).\n",
pr_err("Error. Size expansion is supported only (current size is %llu, requested size /rounded/ is 0).\n",
current_size);
goto analyse_change_exit;
}
@ -10019,14 +9961,12 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
if ((current_size != geo->size) && (geo->size > 0)) {
if (change != -1) {
pr_err("Error. Size change should be the only "
"one at a time.\n");
pr_err("Error. Size change should be the only one at a time.\n");
change = -1;
goto analyse_change_exit;
}
if ((super->current_vol + 1) != super->anchor->num_raid_devs) {
pr_err("Error. The last volume in container "
"can be expanded only (%i/%s).\n",
pr_err("Error. The last volume in container can be expanded only (%i/%s).\n",
super->current_vol, st->devnm);
goto analyse_change_exit;
}
@ -10051,8 +9991,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
/* requested size change to the maximum available size
*/
if (max_size == 0) {
pr_err("Error. Cannot find "
"maximum available space.\n");
pr_err("Error. Cannot find maximum available space.\n");
change = -1;
goto analyse_change_exit;
} else
@ -10070,17 +10009,12 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
dprintf("Prepare update for size change to %llu\n",
geo->size );
if (current_size >= geo->size) {
pr_err("Error. Size expansion is "
"supported only (current size is %llu, "
"requested size /rounded/ is %llu).\n",
pr_err("Error. Size expansion is supported only (current size is %llu, requested size /rounded/ is %llu).\n",
current_size, geo->size);
goto analyse_change_exit;
}
if (max_size && geo->size > max_size) {
pr_err("Error. Requested size is larger "
"than maximum available size (maximum "
"available size is %llu, "
"requested size /rounded/ is %llu).\n",
pr_err("Error. Requested size is larger than maximum available size (maximum available size is %llu, requested size /rounded/ is %llu).\n",
max_size, geo->size);
goto analyse_change_exit;
}
@ -10103,9 +10037,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
struct imsm_super *mpb = super->anchor;
if (mpb->num_raid_devs > 1) {
pr_err("Error. Cannot perform operation on %s"
"- for this operation it MUST be single "
"array in container\n",
pr_err("Error. Cannot perform operation on %s- for this operation it MUST be single array in container\n",
geo->dev_name);
change = -1;
}
@ -10114,8 +10046,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
analyse_change_exit:
if ((direction == ROLLBACK_METADATA_CHANGES) &&
((change == CH_MIGRATION) || (change == CH_TAKEOVER))) {
dprintf("imsm: Metadata changes rollback is not supported for "
"migration and takeover operations.\n");
dprintf("imsm: Metadata changes rollback is not supported for migration and takeover operations.\n");
change = -1;
}
return change;
@ -10209,8 +10140,7 @@ static int imsm_reshape_super(struct supertype *st, unsigned long long size,
free(u);
} else {
pr_err("(imsm) Operation "
"is not allowed on this container\n");
pr_err("(imsm) Operation is not allowed on this container\n");
}
} else {
/* On volume level we support following operations
@ -10248,8 +10178,7 @@ static int imsm_reshape_super(struct supertype *st, unsigned long long size,
imsm_create_metadata_update_for_migration(
st, &geo, &u);
if (len < 1) {
dprintf("imsm: "
"Cannot prepare update\n");
dprintf("imsm: Cannot prepare update\n");
break;
}
ret_val = 0;
@ -10268,8 +10197,7 @@ static int imsm_reshape_super(struct supertype *st, unsigned long long size,
imsm_create_metadata_update_for_size_change(
st, &geo, &u);
if (len < 1) {
dprintf("imsm: "
"Cannot prepare update\n");
dprintf("imsm: Cannot prepare update\n");
break;
}
ret_val = 0;
@ -10487,8 +10415,7 @@ static int imsm_manage_reshape(
init_migr_record_imsm(st, dev, sra);
else {
if (__le32_to_cpu(migr_rec->rec_status) != UNIT_SRC_NORMAL) {
dprintf("imsm: cannot restart migration when data "
"are present in copy area.\n");
dprintf("imsm: cannot restart migration when data are present in copy area.\n");
goto abort;
}
/* Save checkpoint to update migration record for current
@ -10498,9 +10425,7 @@ static int imsm_manage_reshape(
if (save_checkpoint_imsm(st, sra, UNIT_SRC_NORMAL) == 1) {
/* ignore error == 2, this can mean end of reshape here
*/
dprintf("imsm: Cannot write checkpoint to "
"migration record (UNIT_SRC_NORMAL, "
"initial save)\n");
dprintf("imsm: Cannot write checkpoint to migration record (UNIT_SRC_NORMAL, initial save)\n");
goto abort;
}
}
@ -10531,8 +10456,7 @@ static int imsm_manage_reshape(
*/
degraded = check_degradation_change(sra, fds, degraded);
if (degraded > 1) {
dprintf("imsm: Abort reshape due to degradation"
" level (%i)\n", degraded);
dprintf("imsm: Abort reshape due to degradation level (%i)\n", degraded);
goto abort;
}
@ -10566,10 +10490,7 @@ static int imsm_manage_reshape(
if (next_step_filler)
next_step_filler = (old_data_stripe_length
- next_step_filler);
dprintf("save_stripes() parameters: start = %llu,"
"\tstart_src = %llu,\tnext_step*512 = %llu,"
"\tstart_in_buf_shift = %llu,"
"\tnext_step_filler = %llu\n",
dprintf("save_stripes() parameters: start = %llu,\tstart_src = %llu,\tnext_step*512 = %llu,\tstart_in_buf_shift = %llu,\tnext_step_filler = %llu\n",
start, start_src, copy_length,
start_buf_shift, next_step_filler);
@ -10579,8 +10500,7 @@ static int imsm_manage_reshape(
copy_length +
next_step_filler + start_buf_shift,
buf)) {
dprintf("imsm: Cannot save stripes"
" to buffer\n");
dprintf("imsm: Cannot save stripes to buffer\n");
goto abort;
}
/* Convert data to destination format and store it
@ -10588,14 +10508,12 @@ static int imsm_manage_reshape(
*/
if (save_backup_imsm(st, dev, sra,
buf + start_buf_shift, copy_length)) {
dprintf("imsm: Cannot save stripes to "
"target devices\n");
dprintf("imsm: Cannot save stripes to target devices\n");
goto abort;
}
if (save_checkpoint_imsm(st, sra,
UNIT_SRC_IN_CP_AREA)) {
dprintf("imsm: Cannot write checkpoint to "
"migration record (UNIT_SRC_IN_CP_AREA)\n");
dprintf("imsm: Cannot write checkpoint to migration record (UNIT_SRC_IN_CP_AREA)\n");
goto abort;
}
} else {
@ -10626,8 +10544,7 @@ static int imsm_manage_reshape(
if (save_checkpoint_imsm(st, sra, UNIT_SRC_NORMAL) == 1) {
/* ignore error == 2, this can mean end of reshape here
*/
dprintf("imsm: Cannot write checkpoint to "
"migration record (UNIT_SRC_NORMAL)\n");
dprintf("imsm: Cannot write checkpoint to migration record (UNIT_SRC_NORMAL)\n");
goto abort;
}

View File

@ -1269,8 +1269,7 @@ static int validate_geometry0(struct supertype *st, int level,
}
if (size >= tbmax * 2ULL*1024*1024*1024) {
if (verbose)
pr_err("0.90 metadata supports at most "
"%d terabytes per device\n", tbmax);
pr_err("0.90 metadata supports at most %d terabytes per device\n", tbmax);
return 0;
}
if (*chunk == UnSet)

View File

@ -197,8 +197,7 @@ static int aread(struct align_fd *afd, void *buf, int len)
if (!bsize || bsize > 4096 || len > 4096) {
if (!bsize)
fprintf(stderr, "WARNING - aread() called with "
"invalid block size\n");
fprintf(stderr, "WARNING - aread() called with invalid block size\n");
return -1;
}
b = ROUND_UP_PTR((char *)abuf, 4096);
@ -230,8 +229,7 @@ static int awrite(struct align_fd *afd, void *buf, int len)
bsize = afd->blk_sz;
if (!bsize || bsize > 4096 || len > 4096) {
if (!bsize)
fprintf(stderr, "WARNING - awrite() called with "
"invalid block size\n");
fprintf(stderr, "WARNING - awrite() called with invalid block size\n");
return -1;
}
b = ROUND_UP_PTR((char *)abuf, 4096);
@ -1678,8 +1676,7 @@ static int write_init_super1(struct supertype *st)
}
break;
default:
pr_err("Failed to write invalid "
"metadata format 1.%i to %s\n",
pr_err("Failed to write invalid metadata format 1.%i to %s\n",
st->minor_version, di->devname);
rv = -EINVAL;
goto out;

View File

@ -623,8 +623,7 @@ int sysfs_set_array(struct mdinfo *info, int vers)
if ((vers % 100) < 2 ||
sysfs_set_str(info, NULL, "metadata_version",
ver) < 0) {
pr_err("This kernel does not "
"support external metadata.\n");
pr_err("This kernel does not support external metadata.\n");
return 1;
}
}
@ -644,9 +643,7 @@ int sysfs_set_array(struct mdinfo *info, int vers)
rc = sysfs_set_num(info, NULL, "array_size",
info->custom_array_size/2);
if (rc && errno == ENOENT) {
pr_err("This kernel does not "
"have the md/array_size attribute, "
"the array may be larger than expected\n");
pr_err("This kernel does not have the md/array_size attribute, the array may be larger than expected\n");
rc = 0;
}
rv |= rc;

12
util.c
View File

@ -1740,8 +1740,7 @@ int start_mdmon(char *devnm)
status = execl("/bin/systemctl", "systemctl", "start",
pathbuf, NULL);
exit(1);
case -1: pr_err("cannot run mdmon. "
"Array remains readonly\n");
case -1: pr_err("cannot run mdmon. Array remains readonly\n");
return -1;
default: /* parent - good */
pid = wait(&status);
@ -1766,14 +1765,12 @@ int start_mdmon(char *devnm)
devnm, NULL);
}
exit(1);
case -1: pr_err("cannot run mdmon. "
"Array remains readonly\n");
case -1: pr_err("cannot run mdmon. Array remains readonly\n");
return -1;
default: /* parent - good */
pid = wait(&status);
if (pid < 0 || status != 0) {
pr_err("failed to launch mdmon. "
"Array remains readonly\n");
pr_err("failed to launch mdmon. Array remains readonly\n");
return -1;
}
}
@ -1845,8 +1842,7 @@ int experimental(void)
if (check_env("MDADM_EXPERIMENTAL"))
return 1;
else {
pr_err("To use this feature MDADM_EXPERIMENTAL"
" environment variable has to be defined.\n");
pr_err("To use this feature MDADM_EXPERIMENTAL environment variable has to be defined.\n");
return 0;
}
}