Consistently print program Name and __func__ in debug messages.
make dprintf() print program name and __func__, so that this messaging is consistent. Also remove all __func__ messages from pr_err(). We shouldn't leak that internal data in error message. If we really want function name there, we new pr_XXX might be wanted. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
d56dd607ba
commit
1ade5cc15a
17
Grow.c
17
Grow.c
|
@ -1496,7 +1496,7 @@ static int set_array_size(struct supertype *st, struct mdinfo *sra,
|
|||
ret_val = 0;
|
||||
dprintf("Array size changed");
|
||||
}
|
||||
dprintf(" from %llu to %llu.\n",
|
||||
dprintf_cont(" from %llu to %llu.\n",
|
||||
current_size, new_size);
|
||||
}
|
||||
sysfs_free(info);
|
||||
|
@ -1919,7 +1919,7 @@ size_change_error:
|
|||
int err;
|
||||
err = remove_disks_for_takeover(st, sra, array.layout);
|
||||
if (err) {
|
||||
dprintf("%s: Array cannot be reshaped\n", Name);
|
||||
dprintf("Array cannot be reshaped\n");
|
||||
if (cfd > -1)
|
||||
close(cfd);
|
||||
rv = 1;
|
||||
|
@ -2133,7 +2133,7 @@ static int verify_reshape_position(struct mdinfo *info, int level)
|
|||
char *ep;
|
||||
unsigned long long position = strtoull(buf, &ep, 0);
|
||||
|
||||
dprintf("%s: Read sync_max sysfs entry is: %s\n", Name, buf);
|
||||
dprintf("Read sync_max sysfs entry is: %s\n", buf);
|
||||
if (!(ep == buf || (*ep != 0 && *ep != '\n' && *ep != ' '))) {
|
||||
position *= get_data_disks(level,
|
||||
info->new_layout,
|
||||
|
@ -3557,8 +3557,7 @@ int reshape_container(char *container, char *devname,
|
|||
|
||||
fd = open_dev(mdstat->devnm);
|
||||
if (fd < 0) {
|
||||
printf("%s: Device %s cannot be opened for reshape.",
|
||||
Name, adev);
|
||||
pr_err("Device %s cannot be opened for reshape.\n", adev);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3574,7 +3573,7 @@ int reshape_container(char *container, char *devname,
|
|||
* reshape_array is resolved().
|
||||
*/
|
||||
printf("%s: Multiple reshape execution detected for "
|
||||
"device %s.", Name, adev);
|
||||
"device %s.\n", Name, adev);
|
||||
close(fd);
|
||||
break;
|
||||
}
|
||||
|
@ -4770,7 +4769,7 @@ int Grow_continue_command(char *devname, int fd,
|
|||
dprintf("Grow continue is run for ");
|
||||
if (st->ss->external == 0) {
|
||||
int d;
|
||||
dprintf("native array (%s)\n", devname);
|
||||
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);
|
||||
|
@ -4818,14 +4817,14 @@ int Grow_continue_command(char *devname, int fd,
|
|||
char *container;
|
||||
|
||||
if (subarray) {
|
||||
dprintf("subarray (%s)\n", subarray);
|
||||
dprintf_cont("subarray (%s)\n", subarray);
|
||||
container = st->container_devnm;
|
||||
cfd = open_dev_excl(st->container_devnm);
|
||||
} else {
|
||||
container = st->devnm;
|
||||
close(fd);
|
||||
cfd = open_dev_excl(st->devnm);
|
||||
dprintf("container (%s)\n", container);
|
||||
dprintf_cont("container (%s)\n", container);
|
||||
fd = cfd;
|
||||
}
|
||||
if (cfd < 0) {
|
||||
|
|
|
@ -1710,9 +1710,9 @@ int IncrementalRemove(char *devname, char *id_path, int verbose)
|
|||
char buf[32];
|
||||
|
||||
if (!id_path)
|
||||
dprintf("%s: incremental removal without --path <id_path> "
|
||||
dprintf("incremental removal without --path <id_path> "
|
||||
"lacks the possibility to re-add new device in this "
|
||||
"port\n", Name);
|
||||
"port\n");
|
||||
|
||||
if (strchr(devname, '/')) {
|
||||
pr_err("incremental removal requires a "
|
||||
|
|
16
managemon.c
16
managemon.c
|
@ -134,7 +134,7 @@ static void free_aa(struct active_array *aa)
|
|||
/* Note that this doesn't close fds if they are being used
|
||||
* by a clone. ->container will be set for a clone
|
||||
*/
|
||||
dprintf("%s: sys_name: %s\n", __func__, aa->info.sys_name);
|
||||
dprintf("sys_name: %s\n", aa->info.sys_name);
|
||||
if (!aa->container)
|
||||
close_aa(aa);
|
||||
while (aa->info.devs) {
|
||||
|
@ -273,8 +273,7 @@ static void add_disk_to_container(struct supertype *st, struct mdinfo *sd)
|
|||
.state = 0,
|
||||
};
|
||||
|
||||
dprintf("%s: add %d:%d to container\n",
|
||||
__func__, sd->disk.major, sd->disk.minor);
|
||||
dprintf("add %d:%d to container\n", sd->disk.major, sd->disk.minor);
|
||||
|
||||
sd->next = st->devs;
|
||||
st->devs = sd;
|
||||
|
@ -325,8 +324,8 @@ static void remove_disk_from_container(struct supertype *st, struct mdinfo *sd)
|
|||
.raid_disk = -1,
|
||||
.state = 0,
|
||||
};
|
||||
dprintf("%s: remove %d:%d from container\n",
|
||||
__func__, sd->disk.major, sd->disk.minor);
|
||||
dprintf("remove %d:%d from container\n",
|
||||
sd->disk.major, sd->disk.minor);
|
||||
|
||||
st->update_tail = &update;
|
||||
st->ss->remove_from_super(st, &dk);
|
||||
|
@ -540,7 +539,7 @@ static void manage_member(struct mdstat_ent *mdstat,
|
|||
/* prevent the kernel from activating the disk(s) before we
|
||||
* finish adding them
|
||||
*/
|
||||
dprintf("%s: freezing %s\n", __func__, a->info.sys_name);
|
||||
dprintf("freezing %s\n", a->info.sys_name);
|
||||
sysfs_set_str(&a->info, NULL, "sync_action", "frozen");
|
||||
|
||||
/* Add device to array and set offset/size/slot.
|
||||
|
@ -565,8 +564,7 @@ static void manage_member(struct mdstat_ent *mdstat,
|
|||
if (sysfs_set_str(&a->info, NULL, "sync_action", "recover")
|
||||
== 0)
|
||||
newa->prev_action = recover;
|
||||
dprintf("%s: recovery started on %s\n", __func__,
|
||||
a->info.sys_name);
|
||||
dprintf("recovery started on %s\n", a->info.sys_name);
|
||||
out:
|
||||
while (newdev) {
|
||||
d = newdev->next;
|
||||
|
@ -713,7 +711,7 @@ static void manage_new(struct mdstat_ent *mdstat,
|
|||
new->metadata_fd = sysfs_open2(new->info.sys_name, NULL, "metadata_version");
|
||||
new->sync_completed_fd = sysfs_open2(new->info.sys_name, NULL, "sync_completed");
|
||||
|
||||
dprintf("%s: inst: %s action: %d state: %d\n", __func__, inst,
|
||||
dprintf("inst: %s action: %d state: %d\n", inst,
|
||||
new->action_fd, new->info.state_fd);
|
||||
|
||||
if (sigterm)
|
||||
|
|
4
mdadm.c
4
mdadm.c
|
@ -1617,9 +1617,7 @@ static int scan_assemble(struct supertype *ss,
|
|||
a->autof = c->autof;
|
||||
}
|
||||
if (map_lock(&map))
|
||||
pr_err("%s: failed to get "
|
||||
"exclusive lock on mapfile\n",
|
||||
__func__);
|
||||
pr_err("failed to get exclusive lock on mapfile\n");
|
||||
do {
|
||||
failures = 0;
|
||||
successes = 0;
|
||||
|
|
8
mdadm.h
8
mdadm.h
|
@ -1440,9 +1440,13 @@ static inline char *to_subarray(struct mdstat_ent *ent, char *container)
|
|||
|
||||
#ifdef DEBUG
|
||||
#define dprintf(fmt, arg...) \
|
||||
fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##arg)
|
||||
#define dprintf_cont(fmt, arg...) \
|
||||
fprintf(stderr, fmt, ##arg)
|
||||
#else
|
||||
#define dprintf(fmt, arg...) \
|
||||
({ if (0) fprintf(stderr, "%s: %s: " fmt, Name, __func__, ##arg); 0; })
|
||||
#define dprintf_cont(fmt, arg...) \
|
||||
({ if (0) fprintf(stderr, fmt, ##arg); 0; })
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
@ -1457,7 +1461,11 @@ static inline int xasprintf(char **strp, const char *fmt, ...) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#define pr_err(fmt, args...) fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##args)
|
||||
#else
|
||||
#define pr_err(fmt, args...) fprintf(stderr, "%s: "fmt, Name, ##args)
|
||||
#endif
|
||||
#define cont_err(fmt ...) fprintf(stderr, " " fmt)
|
||||
|
||||
void *xmalloc(size_t len);
|
||||
|
|
25
monitor.c
25
monitor.c
|
@ -42,11 +42,11 @@ static void add_fd(fd_set *fds, int *maxfd, int fd)
|
|||
if (fd < 0)
|
||||
return;
|
||||
if (fstat(fd, &st) == -1) {
|
||||
dprintf("%s: Invalid fd %d\n", __func__, fd);
|
||||
dprintf("Invalid fd %d\n", fd);
|
||||
return;
|
||||
}
|
||||
if (st.st_nlink == 0) {
|
||||
dprintf("%s: fd %d was deleted\n", __func__, fd);
|
||||
dprintf("fd %d was deleted\n", fd);
|
||||
return;
|
||||
}
|
||||
if (fd > *maxfd)
|
||||
|
@ -82,8 +82,7 @@ static void read_resync_start(int fd, unsigned long long *v)
|
|||
|
||||
n = read_attr(buf, 30, fd);
|
||||
if (n <= 0) {
|
||||
dprintf("%s: Failed to read resync_start (%d)\n",
|
||||
__func__, fd);
|
||||
dprintf("Failed to read resync_start (%d)\n", fd);
|
||||
return;
|
||||
}
|
||||
if (strncmp(buf, "none", 4) == 0)
|
||||
|
@ -260,8 +259,8 @@ static int read_and_act(struct active_array *a)
|
|||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
dprintf("%s(%d): %ld.%06ld state:%s prev:%s action:%s prev: %s start:%llu\n",
|
||||
__func__, a->info.container_member,
|
||||
dprintf("(%d): %ld.%06ld state:%s prev:%s action:%s prev: %s start:%llu\n",
|
||||
a->info.container_member,
|
||||
tv.tv_sec, tv.tv_usec,
|
||||
array_states[a->curr_state],
|
||||
array_states[a->prev_state],
|
||||
|
@ -422,21 +421,21 @@ static int read_and_act(struct active_array *a)
|
|||
a->last_checkpoint = sync_completed;
|
||||
|
||||
a->container->ss->sync_metadata(a->container);
|
||||
dprintf("%s(%d): state:%s action:%s next(", __func__, a->info.container_member,
|
||||
dprintf("(%d): state:%s action:%s next(", a->info.container_member,
|
||||
array_states[a->curr_state], sync_actions[a->curr_action]);
|
||||
|
||||
/* Effect state changes in the array */
|
||||
if (a->next_state != bad_word) {
|
||||
dprintf(" state:%s", array_states[a->next_state]);
|
||||
dprintf_cont(" state:%s", array_states[a->next_state]);
|
||||
write_attr(array_states[a->next_state], a->info.state_fd);
|
||||
}
|
||||
if (a->next_action != bad_action) {
|
||||
write_attr(sync_actions[a->next_action], a->action_fd);
|
||||
dprintf(" action:%s", sync_actions[a->next_action]);
|
||||
dprintf_cont(" action:%s", sync_actions[a->next_action]);
|
||||
}
|
||||
for (mdi = a->info.devs; mdi ; mdi = mdi->next) {
|
||||
if (mdi->next_state & DS_UNBLOCK) {
|
||||
dprintf(" %d:-blocked", mdi->disk.raid_disk);
|
||||
dprintf_cont(" %d:-blocked", mdi->disk.raid_disk);
|
||||
write_attr("-blocked", mdi->state_fd);
|
||||
}
|
||||
|
||||
|
@ -449,7 +448,7 @@ static int read_and_act(struct active_array *a)
|
|||
*/
|
||||
remove_result = write_attr("remove", mdi->state_fd);
|
||||
if (remove_result > 0) {
|
||||
dprintf(" %d:removed", mdi->disk.raid_disk);
|
||||
dprintf_cont(" %d:removed", mdi->disk.raid_disk);
|
||||
close(mdi->state_fd);
|
||||
close(mdi->recovery_fd);
|
||||
mdi->state_fd = -1;
|
||||
|
@ -458,10 +457,10 @@ static int read_and_act(struct active_array *a)
|
|||
}
|
||||
if (mdi->next_state & DS_INSYNC) {
|
||||
write_attr("+in_sync", mdi->state_fd);
|
||||
dprintf(" %d:+in_sync", mdi->disk.raid_disk);
|
||||
dprintf_cont(" %d:+in_sync", mdi->disk.raid_disk);
|
||||
}
|
||||
}
|
||||
dprintf(" )\n");
|
||||
dprintf_cont(" )\n");
|
||||
|
||||
/* move curr_ to prev_ */
|
||||
a->prev_state = a->curr_state;
|
||||
|
|
178
super-ddf.c
178
super-ddf.c
|
@ -541,15 +541,15 @@ static int init_super_ddf_bvd(struct supertype *st,
|
|||
static void pr_state(struct ddf_super *ddf, const char *msg)
|
||||
{
|
||||
unsigned int i;
|
||||
dprintf("%s/%s: ", __func__, msg);
|
||||
dprintf("%s: ", msg);
|
||||
for (i = 0; i < be16_to_cpu(ddf->active->max_vd_entries); i++) {
|
||||
if (all_ff(ddf->virt->entries[i].guid))
|
||||
continue;
|
||||
dprintf("%u(s=%02x i=%02x) ", i,
|
||||
dprintf_cont("%u(s=%02x i=%02x) ", i,
|
||||
ddf->virt->entries[i].state,
|
||||
ddf->virt->entries[i].init_state);
|
||||
}
|
||||
dprintf("\n");
|
||||
dprintf_cont("\n");
|
||||
}
|
||||
#else
|
||||
static void pr_state(const struct ddf_super *ddf, const char *msg) {}
|
||||
|
@ -825,11 +825,11 @@ static int load_ddf_header(int fd, unsigned long long lba,
|
|||
return 0;
|
||||
|
||||
if (!be32_eq(hdr->magic, DDF_HEADER_MAGIC)) {
|
||||
pr_err("%s: bad header magic\n", __func__);
|
||||
pr_err("bad header magic\n");
|
||||
return 0;
|
||||
}
|
||||
if (!be32_eq(calc_crc(hdr, 512), hdr->crc)) {
|
||||
pr_err("%s: bad CRC\n", __func__);
|
||||
pr_err("bad CRC\n");
|
||||
return 0;
|
||||
}
|
||||
if (memcmp(anchor->guid, hdr->guid, DDF_GUID_LEN) != 0 ||
|
||||
|
@ -839,7 +839,7 @@ static int load_ddf_header(int fd, unsigned long long lba,
|
|||
hdr->type != type ||
|
||||
memcmp(anchor->pad2, hdr->pad2, 512 -
|
||||
offsetof(struct ddf_header, pad2)) != 0) {
|
||||
pr_err("%s: header mismatch\n", __func__);
|
||||
pr_err("header mismatch\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1055,8 +1055,7 @@ static int load_ddf_local(int fd, struct ddf_super *super,
|
|||
if (posix_memalign((void**)&dl, 512,
|
||||
sizeof(*dl) +
|
||||
(super->max_part) * sizeof(dl->vlist[0])) != 0) {
|
||||
pr_err("%s could not allocate disk info buffer\n",
|
||||
__func__);
|
||||
pr_err("could not allocate disk info buffer\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1116,8 +1115,7 @@ static int load_ddf_local(int fd, struct ddf_super *super,
|
|||
continue;
|
||||
if (posix_memalign((void**)&dl->spare, 512,
|
||||
super->conf_rec_len*512) != 0) {
|
||||
pr_err("%s could not allocate spare info buf\n",
|
||||
__func__);
|
||||
pr_err("could not allocate spare info buf\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1148,16 +1146,14 @@ static int load_ddf_local(int fd, struct ddf_super *super,
|
|||
if (posix_memalign((void**)&vcl, 512,
|
||||
(super->conf_rec_len*512 +
|
||||
offsetof(struct vcl, conf))) != 0) {
|
||||
pr_err("%s could not allocate vcl buf\n",
|
||||
__func__);
|
||||
pr_err("could not allocate vcl buf\n");
|
||||
return 1;
|
||||
}
|
||||
vcl->next = super->conflist;
|
||||
vcl->block_sizes = NULL; /* FIXME not for CONCAT */
|
||||
vcl->conf.sec_elmnt_count = vd->sec_elmnt_count;
|
||||
if (alloc_other_bvds(super, vcl) != 0) {
|
||||
pr_err("%s could not allocate other bvds\n",
|
||||
__func__);
|
||||
pr_err("could not allocate other bvds\n");
|
||||
free(vcl);
|
||||
return 1;
|
||||
};
|
||||
|
@ -1865,8 +1861,8 @@ static int find_index_in_bvd(const struct ddf_super *ddf,
|
|||
j++;
|
||||
}
|
||||
}
|
||||
dprintf("%s: couldn't find BVD member %u (total %u)\n",
|
||||
__func__, n, be16_to_cpu(conf->prim_elmnt_count));
|
||||
dprintf("couldn't find BVD member %u (total %u)\n",
|
||||
n, be16_to_cpu(conf->prim_elmnt_count));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1897,8 +1893,8 @@ static struct vd_config *find_vdcr(struct ddf_super *ddf, unsigned int inst,
|
|||
goto bad;
|
||||
}
|
||||
if (v->other_bvds == NULL) {
|
||||
pr_err("%s: BUG: other_bvds is NULL, nsec=%u\n",
|
||||
__func__, conf->sec_elmnt_count);
|
||||
pr_err("BUG: other_bvds is NULL, nsec=%u\n",
|
||||
conf->sec_elmnt_count);
|
||||
goto bad;
|
||||
}
|
||||
nsec = n / be16_to_cpu(conf->prim_elmnt_count);
|
||||
|
@ -1915,13 +1911,13 @@ static struct vd_config *find_vdcr(struct ddf_super *ddf, unsigned int inst,
|
|||
if (!find_index_in_bvd(ddf, conf,
|
||||
n - nsec*conf->sec_elmnt_count, n_bvd))
|
||||
goto bad;
|
||||
dprintf("%s: found disk %u as member %u in bvd %d of array %u\n"
|
||||
, __func__, n, *n_bvd, ibvd, inst);
|
||||
dprintf("found disk %u as member %u in bvd %d of array %u\n",
|
||||
n, *n_bvd, ibvd, inst);
|
||||
*vcl = v;
|
||||
return conf;
|
||||
}
|
||||
bad:
|
||||
pr_err("%s: Could't find disk %d in array %u\n", __func__, n, inst);
|
||||
pr_err("Could't find disk %d in array %u\n", n, inst);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -2342,7 +2338,7 @@ static int init_super_ddf(struct supertype *st,
|
|||
data_offset);
|
||||
|
||||
if (posix_memalign((void**)&ddf, 512, sizeof(*ddf)) != 0) {
|
||||
pr_err("%s could not allocate superblock\n", __func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 0;
|
||||
}
|
||||
memset(ddf, 0, sizeof(*ddf));
|
||||
|
@ -2477,7 +2473,7 @@ static int init_super_ddf(struct supertype *st,
|
|||
strcpy((char*)ddf->controller.vendor_data, homehost);
|
||||
|
||||
if (posix_memalign((void**)&pd, 512, pdsize) != 0) {
|
||||
pr_err("%s could not allocate pd\n", __func__);
|
||||
pr_err("could not allocate pd\n");
|
||||
return 0;
|
||||
}
|
||||
ddf->phys = pd;
|
||||
|
@ -2493,7 +2489,7 @@ static int init_super_ddf(struct supertype *st,
|
|||
memset(pd->entries[i].guid, 0xff, DDF_GUID_LEN);
|
||||
|
||||
if (posix_memalign((void**)&vd, 512, vdsize) != 0) {
|
||||
pr_err("%s could not allocate vd\n", __func__);
|
||||
pr_err("could not allocate vd\n");
|
||||
return 0;
|
||||
}
|
||||
ddf->virt = vd;
|
||||
|
@ -2672,7 +2668,7 @@ static int init_super_ddf_bvd(struct supertype *st,
|
|||
/* Now create a new vd_config */
|
||||
if (posix_memalign((void**)&vcl, 512,
|
||||
(offsetof(struct vcl, conf) + ddf->conf_rec_len * 512)) != 0) {
|
||||
pr_err("%s could not allocate vd_config\n", __func__);
|
||||
pr_err("could not allocate vd_config\n");
|
||||
return 0;
|
||||
}
|
||||
vcl->vcnum = venum;
|
||||
|
@ -2687,15 +2683,14 @@ static int init_super_ddf_bvd(struct supertype *st,
|
|||
vc->chunk_shift = chunk_to_shift(info->chunk_size);
|
||||
if (layout_md2ddf(info, vc) == -1 ||
|
||||
be16_to_cpu(vc->prim_elmnt_count) > ddf->mppe) {
|
||||
pr_err("%s: unsupported RAID level/layout %d/%d with %d disks\n",
|
||||
__func__, info->level, info->layout, info->raid_disks);
|
||||
pr_err("unsupported RAID level/layout %d/%d with %d disks\n",
|
||||
info->level, info->layout, info->raid_disks);
|
||||
free(vcl);
|
||||
return 0;
|
||||
}
|
||||
vc->sec_elmnt_seq = 0;
|
||||
if (alloc_other_bvds(ddf, vcl) != 0) {
|
||||
pr_err("%s could not allocate other bvds\n",
|
||||
__func__);
|
||||
pr_err("could not allocate other bvds\n");
|
||||
free(vcl);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2814,8 +2809,8 @@ static void add_to_super_ddf_bvd(struct supertype *st,
|
|||
cpu_to_be16(DDF_Global_Spare));
|
||||
be16_set(ddf->phys->entries[dl->pdnum].type,
|
||||
cpu_to_be16(DDF_Active_in_VD));
|
||||
dprintf("%s: added disk %d/%08x to VD %d/%s as disk %d\n",
|
||||
__func__, dl->pdnum, be32_to_cpu(dl->disk.refnum),
|
||||
dprintf("added disk %d/%08x to VD %d/%s as disk %d\n",
|
||||
dl->pdnum, be32_to_cpu(dl->disk.refnum),
|
||||
ddf->currentconf->vcnum, guid_str(vc->guid),
|
||||
dk->raid_disk);
|
||||
ddf_set_updates_pending(ddf, vc);
|
||||
|
@ -2846,15 +2841,14 @@ static void _set_config_size(struct phys_disk_entry *pde, const struct dl *dl)
|
|||
if (t < cfs) {
|
||||
__u64 wsp = cfs - t;
|
||||
if (wsp > 1024*1024*2ULL && wsp > dl->size / 16) {
|
||||
pr_err("%s: %x:%x: workspace size 0x%llx too big, ignoring\n",
|
||||
__func__, dl->major, dl->minor,
|
||||
(unsigned long long)wsp);
|
||||
pr_err("%x:%x: workspace size 0x%llx too big, ignoring\n",
|
||||
dl->major, dl->minor, (unsigned long long)wsp);
|
||||
} else
|
||||
cfs = t;
|
||||
}
|
||||
pde->config_size = cpu_to_be64(cfs);
|
||||
dprintf("%s: %x:%x config_size %llx, DDF structure is %llx blocks\n",
|
||||
__func__, dl->major, dl->minor,
|
||||
dprintf("%x:%x config_size %llx, DDF structure is %llx blocks\n",
|
||||
dl->major, dl->minor,
|
||||
(unsigned long long)cfs, (unsigned long long)(dl->size-cfs));
|
||||
}
|
||||
|
||||
|
@ -2886,23 +2880,20 @@ static int add_to_super_ddf(struct supertype *st,
|
|||
fstat(fd, &stb);
|
||||
n = find_unused_pde(ddf);
|
||||
if (n == DDF_NOTFOUND) {
|
||||
pr_err("%s: No free slot in array, cannot add disk\n",
|
||||
__func__);
|
||||
pr_err("No free slot in array, cannot add disk\n");
|
||||
return 1;
|
||||
}
|
||||
pde = &ddf->phys->entries[n];
|
||||
get_dev_size(fd, NULL, &size);
|
||||
if (size <= 32*1024*1024) {
|
||||
pr_err("%s: device size must be at least 32MB\n",
|
||||
__func__);
|
||||
pr_err("device size must be at least 32MB\n");
|
||||
return 1;
|
||||
}
|
||||
size >>= 9;
|
||||
|
||||
if (posix_memalign((void**)&dd, 512,
|
||||
sizeof(*dd) + sizeof(dd->vlist[0]) * ddf->max_part) != 0) {
|
||||
pr_err("%s could allocate buffer for new disk, aborting\n",
|
||||
__func__);
|
||||
pr_err("could allocate buffer for new disk, aborting\n");
|
||||
return 1;
|
||||
}
|
||||
dd->major = major(stb.st_rdev);
|
||||
|
@ -3925,8 +3916,7 @@ static int store_super_ddf(struct supertype *st, int fd)
|
|||
int ofd, ret;
|
||||
|
||||
if (fstat(fd, &sta) == -1 || !S_ISBLK(sta.st_mode)) {
|
||||
pr_err("%s: file descriptor for invalid device\n",
|
||||
__func__);
|
||||
pr_err("file descriptor for invalid device\n");
|
||||
return 1;
|
||||
}
|
||||
for (dl = ddf->dlist; dl; dl = dl->next)
|
||||
|
@ -3934,7 +3924,7 @@ static int store_super_ddf(struct supertype *st, int fd)
|
|||
dl->minor == (int)minor(sta.st_rdev))
|
||||
break;
|
||||
if (!dl) {
|
||||
pr_err("%s: couldn't find disk %d/%d\n", __func__,
|
||||
pr_err("couldn't find disk %d/%d\n",
|
||||
(int)major(sta.st_rdev),
|
||||
(int)minor(sta.st_rdev));
|
||||
return 1;
|
||||
|
@ -3988,7 +3978,7 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
|
|||
*/
|
||||
|
||||
if (!be32_eq(first->active->seq, second->active->seq)) {
|
||||
dprintf("%s: sequence number mismatch %u<->%u\n", __func__,
|
||||
dprintf("sequence number mismatch %u<->%u\n",
|
||||
be32_to_cpu(first->active->seq),
|
||||
be32_to_cpu(second->active->seq));
|
||||
return 0;
|
||||
|
@ -4010,7 +4000,7 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
|
|||
if (vl1->other_bvds != NULL &&
|
||||
vl1->conf.sec_elmnt_seq !=
|
||||
vl2->conf.sec_elmnt_seq) {
|
||||
dprintf("%s: adding BVD %u\n", __func__,
|
||||
dprintf("adding BVD %u\n",
|
||||
vl2->conf.sec_elmnt_seq);
|
||||
add_other_bvd(vl1, &vl2->conf,
|
||||
first->conf_rec_len*512);
|
||||
|
@ -4021,8 +4011,7 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
|
|||
if (posix_memalign((void **)&vl1, 512,
|
||||
(first->conf_rec_len*512 +
|
||||
offsetof(struct vcl, conf))) != 0) {
|
||||
pr_err("%s could not allocate vcl buf\n",
|
||||
__func__);
|
||||
pr_err("could not allocate vcl buf\n");
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
@ -4030,8 +4019,7 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
|
|||
vl1->block_sizes = NULL;
|
||||
memcpy(&vl1->conf, &vl2->conf, first->conf_rec_len*512);
|
||||
if (alloc_other_bvds(first, vl1) != 0) {
|
||||
pr_err("%s could not allocate other bvds\n",
|
||||
__func__);
|
||||
pr_err("could not allocate other bvds\n");
|
||||
free(vl1);
|
||||
return 3;
|
||||
}
|
||||
|
@ -4040,7 +4028,7 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
|
|||
vl1->conf.guid, DDF_GUID_LEN))
|
||||
break;
|
||||
vl1->vcnum = vd;
|
||||
dprintf("%s: added config for VD %u\n", __func__, vl1->vcnum);
|
||||
dprintf("added config for VD %u\n", vl1->vcnum);
|
||||
first->conflist = vl1;
|
||||
}
|
||||
|
||||
|
@ -4054,8 +4042,7 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
|
|||
if (posix_memalign((void **)&dl1, 512,
|
||||
sizeof(*dl1) + (first->max_part) * sizeof(dl1->vlist[0]))
|
||||
!= 0) {
|
||||
pr_err("%s could not allocate disk info buffer\n",
|
||||
__func__);
|
||||
pr_err("could not allocate disk info buffer\n");
|
||||
return 3;
|
||||
}
|
||||
memcpy(dl1, dl2, sizeof(*dl1));
|
||||
|
@ -4070,8 +4057,7 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
|
|||
if (dl2->spare) {
|
||||
if (posix_memalign((void **)&dl1->spare, 512,
|
||||
first->conf_rec_len*512) != 0) {
|
||||
pr_err("%s could not allocate spare info buf\n",
|
||||
__func__);
|
||||
pr_err("could not allocate spare info buf\n");
|
||||
return 3;
|
||||
}
|
||||
memcpy(dl1->spare, dl2->spare, first->conf_rec_len*512);
|
||||
|
@ -4090,7 +4076,7 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst)
|
|||
}
|
||||
}
|
||||
first->dlist = dl1;
|
||||
dprintf("%s: added disk %d: %08x\n", __func__, dl1->pdnum,
|
||||
dprintf("added disk %d: %08x\n", dl1->pdnum,
|
||||
be32_to_cpu(dl1->disk.refnum));
|
||||
}
|
||||
|
||||
|
@ -4113,10 +4099,10 @@ static int ddf_open_new(struct supertype *c, struct active_array *a, char *inst)
|
|||
static const char faulty[] = "faulty";
|
||||
|
||||
if (all_ff(ddf->virt->entries[n].guid)) {
|
||||
pr_err("%s: subarray %d doesn't exist\n", __func__, n);
|
||||
pr_err("subarray %d doesn't exist\n", n);
|
||||
return -ENODEV;
|
||||
}
|
||||
dprintf("%s: new subarray %d, GUID: %s\n", __func__, n,
|
||||
dprintf("new subarray %d, GUID: %s\n", n,
|
||||
guid_str(ddf->virt->entries[n].guid));
|
||||
for (dev = a->info.devs; dev; dev = dev->next) {
|
||||
for (dl = ddf->dlist; dl; dl = dl->next)
|
||||
|
@ -4124,16 +4110,15 @@ static int ddf_open_new(struct supertype *c, struct active_array *a, char *inst)
|
|||
dl->minor == dev->disk.minor)
|
||||
break;
|
||||
if (!dl || dl->pdnum < 0) {
|
||||
pr_err("%s: device %d/%d of subarray %d not found in meta data\n",
|
||||
__func__, dev->disk.major, dev->disk.minor, n);
|
||||
pr_err("device %d/%d of subarray %d not found in meta data\n",
|
||||
dev->disk.major, dev->disk.minor, n);
|
||||
return -1;
|
||||
}
|
||||
if ((be16_to_cpu(ddf->phys->entries[dl->pdnum].state) &
|
||||
(DDF_Online|DDF_Missing|DDF_Failed)) != DDF_Online) {
|
||||
pr_err("%s: new subarray %d contains broken device %d/%d (%02x)\n",
|
||||
__func__, n, dl->major, dl->minor,
|
||||
be16_to_cpu(
|
||||
ddf->phys->entries[dl->pdnum].state));
|
||||
pr_err("new subarray %d contains broken device %d/%d (%02x)\n",
|
||||
n, dl->major, dl->minor,
|
||||
be16_to_cpu(ddf->phys->entries[dl->pdnum].state));
|
||||
if (write(dev->state_fd, faulty, sizeof(faulty)-1) !=
|
||||
sizeof(faulty) - 1)
|
||||
pr_err("Write to state_fd failed\n");
|
||||
|
@ -4357,7 +4342,7 @@ static void ddf_set_disk(struct active_array *a, int n, int state)
|
|||
struct dl *dl;
|
||||
int update = 0;
|
||||
|
||||
dprintf("%s: %d to %x\n", __func__, n, state);
|
||||
dprintf("%d to %x\n", n, state);
|
||||
if (vc == NULL) {
|
||||
dprintf("ddf: cannot find instance %d!!\n", inst);
|
||||
return;
|
||||
|
@ -4367,8 +4352,7 @@ static void ddf_set_disk(struct active_array *a, int n, int state)
|
|||
if (mdi->disk.raid_disk == n)
|
||||
break;
|
||||
if (!mdi) {
|
||||
pr_err("%s: cannot find raid disk %d\n",
|
||||
__func__, n);
|
||||
pr_err("cannot find raid disk %d\n", n);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4379,9 +4363,8 @@ static void ddf_set_disk(struct active_array *a, int n, int state)
|
|||
mdi->disk.minor == dl->minor)
|
||||
break;
|
||||
if (!dl) {
|
||||
pr_err("%s: cannot find raid disk %d (%d/%d)\n",
|
||||
__func__, n,
|
||||
mdi->disk.major, mdi->disk.minor);
|
||||
pr_err("cannot find raid disk %d (%d/%d)\n",
|
||||
n, mdi->disk.major, mdi->disk.minor);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4389,11 +4372,11 @@ static void ddf_set_disk(struct active_array *a, int n, int state)
|
|||
if (pd < 0 || pd != dl->pdnum) {
|
||||
/* disk doesn't currently exist or has changed.
|
||||
* If it is now in_sync, insert it. */
|
||||
dprintf("%s: phys disk not found for %d: %d/%d ref %08x\n",
|
||||
__func__, dl->pdnum, dl->major, dl->minor,
|
||||
dprintf("phys disk not found for %d: %d/%d ref %08x\n",
|
||||
dl->pdnum, dl->major, dl->minor,
|
||||
be32_to_cpu(dl->disk.refnum));
|
||||
dprintf("%s: array %u disk %u ref %08x pd %d\n",
|
||||
__func__, inst, n_bvd,
|
||||
dprintf("array %u disk %u ref %08x pd %d\n",
|
||||
inst, n_bvd,
|
||||
be32_to_cpu(vc->phys_refnum[n_bvd]), pd);
|
||||
if ((state & DS_INSYNC) && ! (state & DS_FAULTY) &&
|
||||
dl->pdnum >= 0) {
|
||||
|
@ -4480,13 +4463,11 @@ static int _kill_subarray_ddf(struct ddf_super *ddf, const char *guid)
|
|||
unsigned int vdnum, i;
|
||||
vdnum = find_vde_by_guid(ddf, guid);
|
||||
if (vdnum == DDF_NOTFOUND) {
|
||||
pr_err("%s: could not find VD %s\n", __func__,
|
||||
guid_str(guid));
|
||||
pr_err("could not find VD %s\n", guid_str(guid));
|
||||
return -1;
|
||||
}
|
||||
if (del_from_conflist(&ddf->conflist, guid) == 0) {
|
||||
pr_err("%s: could not find conf %s\n", __func__,
|
||||
guid_str(guid));
|
||||
pr_err("could not find conf %s\n", guid_str(guid));
|
||||
return -1;
|
||||
}
|
||||
for (dl = ddf->dlist; dl; dl = dl->next)
|
||||
|
@ -4496,7 +4477,7 @@ static int _kill_subarray_ddf(struct ddf_super *ddf, const char *guid)
|
|||
DDF_GUID_LEN))
|
||||
dl->vlist[i] = NULL;
|
||||
memset(ddf->virt->entries[vdnum].guid, 0xff, DDF_GUID_LEN);
|
||||
dprintf("%s: deleted %s\n", __func__, guid_str(guid));
|
||||
dprintf("deleted %s\n", guid_str(guid));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4513,14 +4494,13 @@ static int kill_subarray_ddf(struct supertype *st)
|
|||
|
||||
ddf->currentconf = NULL;
|
||||
if (!victim) {
|
||||
pr_err("%s: nothing to kill\n", __func__);
|
||||
pr_err("nothing to kill\n");
|
||||
return -1;
|
||||
}
|
||||
conf = &victim->conf;
|
||||
vdnum = find_vde_by_guid(ddf, conf->guid);
|
||||
if (vdnum == DDF_NOTFOUND) {
|
||||
pr_err("%s: could not find VD %s\n", __func__,
|
||||
guid_str(conf->guid));
|
||||
pr_err("could not find VD %s\n", guid_str(conf->guid));
|
||||
return -1;
|
||||
}
|
||||
if (st->update_tail) {
|
||||
|
@ -4529,8 +4509,7 @@ static int kill_subarray_ddf(struct supertype *st)
|
|||
+ sizeof(struct virtual_entry);
|
||||
vd = xmalloc(len);
|
||||
if (vd == NULL) {
|
||||
pr_err("%s: failed to allocate %d bytes\n", __func__,
|
||||
len);
|
||||
pr_err("failed to allocate %d bytes\n", len);
|
||||
return -1;
|
||||
}
|
||||
memset(vd, 0 , len);
|
||||
|
@ -4565,7 +4544,7 @@ static void copy_matching_bvd(struct ddf_super *ddf,
|
|||
return;
|
||||
}
|
||||
}
|
||||
pr_err("%s: no match for BVD %d of %s in update\n", __func__,
|
||||
pr_err("no match for BVD %d of %s in update\n",
|
||||
conf->sec_elmnt_seq, guid_str(conf->guid));
|
||||
}
|
||||
|
||||
|
@ -4637,8 +4616,8 @@ static void ddf_process_virt_update(struct supertype *st,
|
|||
} else {
|
||||
ent = find_vde_by_guid(ddf, vd->entries[0].guid);
|
||||
if (ent != DDF_NOTFOUND) {
|
||||
dprintf("%s: VD %s exists already in slot %d\n",
|
||||
__func__, guid_str(vd->entries[0].guid),
|
||||
dprintf("VD %s exists already in slot %d\n",
|
||||
guid_str(vd->entries[0].guid),
|
||||
ent);
|
||||
return;
|
||||
}
|
||||
|
@ -4650,8 +4629,8 @@ static void ddf_process_virt_update(struct supertype *st,
|
|||
cpu_to_be16(
|
||||
1 + be16_to_cpu(
|
||||
ddf->virt->populated_vdes));
|
||||
dprintf("%s: added VD %s in slot %d(s=%02x i=%02x)\n",
|
||||
__func__, guid_str(vd->entries[0].guid), ent,
|
||||
dprintf("added VD %s in slot %d(s=%02x i=%02x)\n",
|
||||
guid_str(vd->entries[0].guid), ent,
|
||||
ddf->virt->entries[ent].state,
|
||||
ddf->virt->entries[ent].init_state);
|
||||
}
|
||||
|
@ -4788,15 +4767,15 @@ static void ddf_process_conf_update(struct supertype *st,
|
|||
vc = (struct vd_config*)update->buf;
|
||||
len = ddf->conf_rec_len * 512;
|
||||
if ((unsigned int)update->len != len * vc->sec_elmnt_count) {
|
||||
pr_err("%s: %s: insufficient data (%d) for %u BVDs\n",
|
||||
__func__, guid_str(vc->guid), update->len,
|
||||
pr_err("%s: insufficient data (%d) for %u BVDs\n",
|
||||
guid_str(vc->guid), update->len,
|
||||
vc->sec_elmnt_count);
|
||||
return;
|
||||
}
|
||||
for (vcl = ddf->conflist; vcl ; vcl = vcl->next)
|
||||
if (memcmp(vcl->conf.guid, vc->guid, DDF_GUID_LEN) == 0)
|
||||
break;
|
||||
dprintf("%s: conf update for %s (%s)\n", __func__,
|
||||
dprintf("conf update for %s (%s)\n",
|
||||
guid_str(vc->guid), (vcl ? "old" : "new"));
|
||||
if (vcl) {
|
||||
/* An update, just copy the phys_refnum and lba_offset
|
||||
|
@ -4964,7 +4943,7 @@ static int raid10_degraded(struct mdinfo *info)
|
|||
for (d = info->devs; d; d = d->next) {
|
||||
i = d->disk.raid_disk / n_prim;
|
||||
if (i >= n_bvds) {
|
||||
pr_err("%s: BUG: invalid raid disk\n", __func__);
|
||||
pr_err("BUG: invalid raid disk\n");
|
||||
goto out;
|
||||
}
|
||||
if (d->state_fd > 0)
|
||||
|
@ -4973,12 +4952,11 @@ static int raid10_degraded(struct mdinfo *info)
|
|||
ret = 2;
|
||||
for (i = 0; i < n_bvds; i++)
|
||||
if (!found[i]) {
|
||||
dprintf("%s: BVD %d/%d failed\n", __func__, i, n_bvds);
|
||||
dprintf("BVD %d/%d failed\n", i, n_bvds);
|
||||
ret = 0;
|
||||
goto out;
|
||||
} else if (found[i] < n_prim) {
|
||||
dprintf("%s: BVD %d/%d degraded\n", __func__, i,
|
||||
n_bvds);
|
||||
dprintf("BVD %d/%d degraded\n", i, n_bvds);
|
||||
ret = 1;
|
||||
}
|
||||
out:
|
||||
|
@ -5027,7 +5005,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
|||
working ++;
|
||||
}
|
||||
|
||||
dprintf("%s: working=%d (%d) level=%d\n", __func__, working,
|
||||
dprintf("working=%d (%d) level=%d\n", working,
|
||||
a->info.array.raid_disks,
|
||||
a->info.array.level);
|
||||
if (working == a->info.array.raid_disks)
|
||||
|
@ -5212,8 +5190,8 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
|||
&& dl->minor == di->disk.minor)
|
||||
break;
|
||||
if (!dl || dl->pdnum < 0) {
|
||||
pr_err("%s: BUG: can't find disk %d (%d/%d)\n",
|
||||
__func__, di->disk.raid_disk,
|
||||
pr_err("BUG: can't find disk %d (%d/%d)\n",
|
||||
di->disk.raid_disk,
|
||||
di->disk.major, di->disk.minor);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -77,8 +77,7 @@ static int load_gpt(struct supertype *st, int fd, char *devname)
|
|||
free_gpt(st);
|
||||
|
||||
if (posix_memalign((void**)&super, 4096, 32*512) != 0) {
|
||||
pr_err("%s could not allocate superblock\n",
|
||||
__func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
207
super-intel.c
207
super-intel.c
|
@ -1386,7 +1386,7 @@ static int imsm_check_attributes(__u32 attributes)
|
|||
}
|
||||
|
||||
if (not_supported)
|
||||
dprintf("%s (IMSM): Unknown attributes : %x\n", Name, not_supported);
|
||||
dprintf("(IMSM): Unknown attributes : %x\n", not_supported);
|
||||
|
||||
ret_val = 0;
|
||||
}
|
||||
|
@ -2192,7 +2192,7 @@ static __u8 imsm_num_data_members(struct imsm_dev *dev, int second_map)
|
|||
case 5:
|
||||
return map->num_members - 1;
|
||||
default:
|
||||
dprintf("%s: unsupported raid level\n", __func__);
|
||||
dprintf("unsupported raid level\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -2449,7 +2449,7 @@ static int imsm_create_metadata_checkpoint_update(
|
|||
|
||||
int update_memory_size = 0;
|
||||
|
||||
dprintf("imsm_create_metadata_checkpoint_update(enter)\n");
|
||||
dprintf("(enter)\n");
|
||||
|
||||
if (u == NULL)
|
||||
return 0;
|
||||
|
@ -2461,14 +2461,12 @@ static int imsm_create_metadata_checkpoint_update(
|
|||
|
||||
*u = xcalloc(1, update_memory_size);
|
||||
if (*u == NULL) {
|
||||
dprintf("error: cannot get memory for "
|
||||
"imsm_create_metadata_checkpoint_update update\n");
|
||||
dprintf("error: cannot get memory\n");
|
||||
return 0;
|
||||
}
|
||||
(*u)->type = update_general_migration_checkpoint;
|
||||
(*u)->curr_migr_unit = __le32_to_cpu(super->migr_rec->curr_migr_unit);
|
||||
dprintf("imsm_create_metadata_checkpoint_update: prepared for %u\n",
|
||||
(*u)->curr_migr_unit);
|
||||
dprintf("prepared for %u\n", (*u)->curr_migr_unit);
|
||||
|
||||
return update_memory_size;
|
||||
}
|
||||
|
@ -2603,9 +2601,7 @@ static unsigned long long imsm_component_size_aligment_check(int level,
|
|||
*/
|
||||
component_size_alligment = component_size % (chunk_size/512);
|
||||
|
||||
dprintf("imsm_component_size_aligment_check(Level: %i, "
|
||||
"chunk_size = %i, component_size = %llu), "
|
||||
"component_size_alligment = %u\n",
|
||||
dprintf("(Level: %i, chunk_size = %i, component_size = %llu), component_size_alligment = %u\n",
|
||||
level, chunk_size, component_size,
|
||||
component_size_alligment);
|
||||
|
||||
|
@ -2613,7 +2609,7 @@ static unsigned long long imsm_component_size_aligment_check(int level,
|
|||
dprintf("imsm: reported component size alligned from %llu ",
|
||||
component_size);
|
||||
component_size -= component_size_alligment;
|
||||
dprintf("to %llu (%i).\n",
|
||||
dprintf_cont("to %llu (%i).\n",
|
||||
component_size, component_size_alligment);
|
||||
}
|
||||
|
||||
|
@ -2933,7 +2929,7 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
|
|||
*/
|
||||
max_enough = max(max_enough, enough);
|
||||
}
|
||||
dprintf("%s: enough: %d\n", __func__, max_enough);
|
||||
dprintf("enough: %d\n", max_enough);
|
||||
info->container_enough = max_enough;
|
||||
|
||||
if (super->disks) {
|
||||
|
@ -3661,7 +3657,7 @@ static int load_imsm_mpb(int fd, struct intel_super *super, char *devname)
|
|||
free(anchor);
|
||||
|
||||
if (posix_memalign(&super->migr_rec_buf, 512, MIGR_REC_BUF_SIZE) != 0) {
|
||||
pr_err("%s could not allocate migr_rec buffer\n", __func__);
|
||||
pr_err("could not allocate migr_rec buffer\n");
|
||||
free(super->buf);
|
||||
return 2;
|
||||
}
|
||||
|
@ -3961,8 +3957,8 @@ static int __prep_thunderdome(struct intel_super **table, int tbl_size,
|
|||
|
||||
if (tbl_mpb->family_num == mpb->family_num) {
|
||||
if (tbl_mpb->check_sum == mpb->check_sum) {
|
||||
dprintf("%s: mpb from %d:%d matches %d:%d\n",
|
||||
__func__, super->disks->major,
|
||||
dprintf("mpb from %d:%d matches %d:%d\n",
|
||||
super->disks->major,
|
||||
super->disks->minor,
|
||||
table[i]->disks->major,
|
||||
table[i]->disks->minor);
|
||||
|
@ -3979,8 +3975,8 @@ static int __prep_thunderdome(struct intel_super **table, int tbl_size,
|
|||
*/
|
||||
struct intel_disk *idisk;
|
||||
|
||||
dprintf("%s: mpb from %d:%d replaces %d:%d\n",
|
||||
__func__, super->disks->major,
|
||||
dprintf("mpb from %d:%d replaces %d:%d\n",
|
||||
super->disks->major,
|
||||
super->disks->minor,
|
||||
table[i]->disks->major,
|
||||
table[i]->disks->minor);
|
||||
|
@ -4008,8 +4004,8 @@ static int __prep_thunderdome(struct intel_super **table, int tbl_size,
|
|||
idisk->disk.status |= CONFIGURED_DISK;
|
||||
}
|
||||
|
||||
dprintf("%s: mpb from %d:%d prefer %d:%d\n",
|
||||
__func__, super->disks->major,
|
||||
dprintf("mpb from %d:%d prefer %d:%d\n",
|
||||
super->disks->major,
|
||||
super->disks->minor,
|
||||
table[i]->disks->major,
|
||||
table[i]->disks->minor);
|
||||
|
@ -4068,12 +4064,12 @@ validate_members(struct intel_super *super, struct intel_disk *disk_list,
|
|||
idisk->owner == IMSM_UNKNOWN_OWNER)
|
||||
ok_count++;
|
||||
else
|
||||
dprintf("%s: '%.16s' owner %d != %d\n",
|
||||
__func__, disk->serial, idisk->owner,
|
||||
dprintf("'%.16s' owner %d != %d\n",
|
||||
disk->serial, idisk->owner,
|
||||
owner);
|
||||
} else {
|
||||
dprintf("%s: unknown disk %x [%d]: %.16s\n",
|
||||
__func__, __le32_to_cpu(mpb->family_num), i,
|
||||
dprintf("unknown disk %x [%d]: %.16s\n",
|
||||
__le32_to_cpu(mpb->family_num), i,
|
||||
disk->serial);
|
||||
break;
|
||||
}
|
||||
|
@ -4129,8 +4125,8 @@ imsm_thunderdome(struct intel_super **super_list, int len)
|
|||
s = NULL;
|
||||
|
||||
if (!s)
|
||||
dprintf("%s: marking family: %#x from %d:%d offline\n",
|
||||
__func__, mpb->family_num,
|
||||
dprintf("marking family: %#x from %d:%d offline\n",
|
||||
mpb->family_num,
|
||||
super_table[i]->disks->major,
|
||||
super_table[i]->disks->minor);
|
||||
super_table[i] = s;
|
||||
|
@ -4673,8 +4669,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
|
|||
}
|
||||
if (posix_memalign(&super->migr_rec_buf, 512,
|
||||
MIGR_REC_BUF_SIZE) != 0) {
|
||||
pr_err("%s could not allocate migr_rec buffer\n",
|
||||
__func__);
|
||||
pr_err("could not allocate migr_rec buffer\n");
|
||||
free(super->buf);
|
||||
free(super);
|
||||
free(mpb_new);
|
||||
|
@ -4832,11 +4827,11 @@ static int init_super_imsm(struct supertype *st, mdu_array_info_t *info,
|
|||
super = NULL;
|
||||
}
|
||||
if (!super) {
|
||||
pr_err("%s could not allocate superblock\n", __func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 0;
|
||||
}
|
||||
if (posix_memalign(&super->migr_rec_buf, 512, MIGR_REC_BUF_SIZE) != 0) {
|
||||
pr_err("%s could not allocate migr_rec buffer\n", __func__);
|
||||
pr_err("could not allocate migr_rec buffer\n");
|
||||
free(super->buf);
|
||||
free(super);
|
||||
return 0;
|
||||
|
@ -5098,8 +5093,7 @@ static int remove_from_super_imsm(struct supertype *st, mdu_disk_info_t *dk)
|
|||
* is prepared.
|
||||
*/
|
||||
if (!st->update_tail) {
|
||||
pr_err("%s shall be used in mdmon context only"
|
||||
"(line %d).\n", __func__, __LINE__);
|
||||
pr_err("shall be used in mdmon context only\n");
|
||||
return 1;
|
||||
}
|
||||
dd = xcalloc(1, sizeof(*dd));
|
||||
|
@ -5158,8 +5152,8 @@ static int write_super_imsm_spares(struct intel_super *super, int doclose)
|
|||
spare->check_sum = __cpu_to_le32(sum);
|
||||
|
||||
if (store_imsm_mpb(d->fd, spare)) {
|
||||
pr_err("%s: failed for device %d:%d %s\n",
|
||||
__func__, d->major, d->minor, strerror(errno));
|
||||
pr_err("failed for device %d:%d %s\n",
|
||||
d->major, d->minor, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
if (doclose) {
|
||||
|
@ -5252,8 +5246,8 @@ static int write_super_imsm(struct supertype *st, int doclose)
|
|||
|
||||
if (store_imsm_mpb(d->fd, mpb))
|
||||
fprintf(stderr,
|
||||
"%s: failed for device %d:%d (fd: %d)%s\n",
|
||||
__func__, d->major, d->minor,
|
||||
"failed for device %d:%d (fd: %d)%s\n",
|
||||
d->major, d->minor,
|
||||
d->fd, strerror(errno));
|
||||
|
||||
if (doclose) {
|
||||
|
@ -5408,7 +5402,7 @@ static int validate_geometry_imsm_container(struct supertype *st, int level,
|
|||
#if DEBUG
|
||||
char str[256];
|
||||
fd2devname(fd, str);
|
||||
dprintf("validate_geometry_imsm_container: fd: %d %s orom: %p rv: %d raiddisk: %d\n",
|
||||
dprintf("fd: %d %s orom: %p rv: %d raiddisk: %d\n",
|
||||
fd, str, super->orom, rv, raiddisks);
|
||||
#endif
|
||||
/* no orom/efi or non-intel hba of the disk */
|
||||
|
@ -5742,27 +5736,27 @@ count_volumes_list(struct md_list *devlist, char *homehost,
|
|||
tmpdev->container = 0;
|
||||
dfd = dev_open(devname, O_RDONLY|O_EXCL);
|
||||
if (dfd < 0) {
|
||||
dprintf(": cannot open device %s: %s\n",
|
||||
dprintf("cannot open device %s: %s\n",
|
||||
devname, strerror(errno));
|
||||
tmpdev->used = 2;
|
||||
} else if (fstat(dfd, &stb)< 0) {
|
||||
/* Impossible! */
|
||||
dprintf(": fstat failed for %s: %s\n",
|
||||
dprintf("fstat failed for %s: %s\n",
|
||||
devname, strerror(errno));
|
||||
tmpdev->used = 2;
|
||||
} else if ((stb.st_mode & S_IFMT) != S_IFBLK) {
|
||||
dprintf(": %s is not a block device.\n",
|
||||
dprintf("%s is not a block device.\n",
|
||||
devname);
|
||||
tmpdev->used = 2;
|
||||
} else if (must_be_container(dfd)) {
|
||||
struct supertype *cst;
|
||||
cst = super_by_fd(dfd, NULL);
|
||||
if (cst == NULL) {
|
||||
dprintf(": cannot recognize container type %s\n",
|
||||
dprintf("cannot recognize container type %s\n",
|
||||
devname);
|
||||
tmpdev->used = 2;
|
||||
} else if (tst->ss != st->ss) {
|
||||
dprintf(": non-imsm container - ignore it: %s\n",
|
||||
dprintf("non-imsm container - ignore it: %s\n",
|
||||
devname);
|
||||
tmpdev->used = 2;
|
||||
} else if (!tst->ss->load_container ||
|
||||
|
@ -5776,11 +5770,11 @@ count_volumes_list(struct md_list *devlist, char *homehost,
|
|||
} else {
|
||||
tmpdev->st_rdev = stb.st_rdev;
|
||||
if (tst->ss->load_super(tst,dfd, NULL)) {
|
||||
dprintf(": no RAID superblock on %s\n",
|
||||
dprintf("no RAID superblock on %s\n",
|
||||
devname);
|
||||
tmpdev->used = 2;
|
||||
} else if (tst->ss->compare_super == NULL) {
|
||||
dprintf(": Cannot assemble %s metadata on %s\n",
|
||||
dprintf("Cannot assemble %s metadata on %s\n",
|
||||
tst->ss->name, devname);
|
||||
tmpdev->used = 2;
|
||||
}
|
||||
|
@ -5817,7 +5811,7 @@ count_volumes_list(struct md_list *devlist, char *homehost,
|
|||
* Or, if we are auto assembling, we just ignore the second
|
||||
* for now.
|
||||
*/
|
||||
dprintf(": superblock on %s doesn't match others - assembly aborted\n",
|
||||
dprintf("superblock on %s doesn't match others - assembly aborted\n",
|
||||
devname);
|
||||
goto loop;
|
||||
}
|
||||
|
@ -5839,7 +5833,7 @@ count_volumes_list(struct md_list *devlist, char *homehost,
|
|||
if (iter->array.state & (1<<MD_SB_BLOCK_VOLUME)) {
|
||||
/* do not assemble arrays with unsupported
|
||||
configurations */
|
||||
dprintf(": Cannot activate member %s.\n",
|
||||
dprintf("Cannot activate member %s.\n",
|
||||
iter->text_version);
|
||||
} else
|
||||
count++;
|
||||
|
@ -5847,11 +5841,11 @@ count_volumes_list(struct md_list *devlist, char *homehost,
|
|||
sysfs_free(head);
|
||||
|
||||
} else {
|
||||
dprintf(" no valid super block on device list: err: %d %p\n",
|
||||
dprintf("No valid super block on device list: err: %d %p\n",
|
||||
err, st->sb);
|
||||
}
|
||||
} else {
|
||||
dprintf(" no more devices to examin\n");
|
||||
dprintf("no more devices to examine\n");
|
||||
}
|
||||
|
||||
for (tmpdev = devlist; tmpdev; tmpdev = tmpdev->next) {
|
||||
|
@ -6584,7 +6578,7 @@ static void update_recovery_start(struct intel_super *super,
|
|||
* IMSM_ORD_REBUILD, so assume they are missing and the
|
||||
* disk_ord_tbl was not correctly updated
|
||||
*/
|
||||
dprintf("%s: failed to locate out-of-sync disk\n", __func__);
|
||||
dprintf("failed to locate out-of-sync disk\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6905,8 +6899,7 @@ static int imsm_open_new(struct supertype *c, struct active_array *a,
|
|||
struct imsm_super *mpb = super->anchor;
|
||||
|
||||
if (atoi(inst) >= mpb->num_raid_devs) {
|
||||
pr_err("%s: subarry index %d, out of range\n",
|
||||
__func__, atoi(inst));
|
||||
pr_err("subarry index %d, out of range\n", atoi(inst));
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -7319,7 +7312,7 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
|
|||
case IMSM_T_STATE_NORMAL: /* transition to normal state */
|
||||
dprintf("normal: ");
|
||||
if (is_rebuilding(dev)) {
|
||||
dprintf("while rebuilding");
|
||||
dprintf_cont("while rebuilding");
|
||||
/* check if recovery is really finished */
|
||||
for (mdi = a->info.devs; mdi ; mdi = mdi->next)
|
||||
if (mdi->recovery_start != MaxSector) {
|
||||
|
@ -7327,8 +7320,8 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
|
|||
break;
|
||||
}
|
||||
if (recovery_not_finished) {
|
||||
dprintf("\nimsm: Rebuild has not finished yet, "
|
||||
"state not changed");
|
||||
dprintf_cont("\n");
|
||||
dprintf("Rebuild has not finished yet, state not changed");
|
||||
if (a->last_checkpoint < mdi->recovery_start) {
|
||||
a->last_checkpoint = mdi->recovery_start;
|
||||
super->updates_pending++;
|
||||
|
@ -7343,7 +7336,7 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
|
|||
break;
|
||||
}
|
||||
if (is_gen_migration(dev)) {
|
||||
dprintf("while general migration");
|
||||
dprintf_cont("while general migration");
|
||||
if (a->last_checkpoint >= a->info.component_size)
|
||||
end_migration(dev, super, map_state);
|
||||
else
|
||||
|
@ -7355,26 +7348,26 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
|
|||
}
|
||||
break;
|
||||
case IMSM_T_STATE_DEGRADED: /* transition to degraded state */
|
||||
dprintf("degraded: ");
|
||||
dprintf_cont("degraded: ");
|
||||
if ((map->map_state != map_state) &&
|
||||
!dev->vol.migr_state) {
|
||||
dprintf("mark degraded");
|
||||
dprintf_cont("mark degraded");
|
||||
map->map_state = map_state;
|
||||
super->updates_pending++;
|
||||
a->last_checkpoint = 0;
|
||||
break;
|
||||
}
|
||||
if (is_rebuilding(dev)) {
|
||||
dprintf("while rebuilding.");
|
||||
dprintf_cont("while rebuilding.");
|
||||
if (map->map_state != map_state) {
|
||||
dprintf(" Map state change");
|
||||
dprintf_cont(" Map state change");
|
||||
end_migration(dev, super, map_state);
|
||||
super->updates_pending++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (is_gen_migration(dev)) {
|
||||
dprintf("while general migration");
|
||||
dprintf_cont("while general migration");
|
||||
if (a->last_checkpoint >= a->info.component_size)
|
||||
end_migration(dev, super, map_state);
|
||||
else {
|
||||
|
@ -7385,22 +7378,22 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
|
|||
break;
|
||||
}
|
||||
if (is_initializing(dev)) {
|
||||
dprintf("while initialization.");
|
||||
dprintf_cont("while initialization.");
|
||||
map->map_state = map_state;
|
||||
super->updates_pending++;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case IMSM_T_STATE_FAILED: /* transition to failed state */
|
||||
dprintf("failed: ");
|
||||
dprintf_cont("failed: ");
|
||||
if (is_gen_migration(dev)) {
|
||||
dprintf("while general migration");
|
||||
dprintf_cont("while general migration");
|
||||
map->map_state = map_state;
|
||||
super->updates_pending++;
|
||||
break;
|
||||
}
|
||||
if (map->map_state != map_state) {
|
||||
dprintf("mark failed");
|
||||
dprintf_cont("mark failed");
|
||||
end_migration(dev, super, map_state);
|
||||
super->updates_pending++;
|
||||
a->last_checkpoint = 0;
|
||||
|
@ -7408,10 +7401,9 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
dprintf("state %i\n", map_state);
|
||||
dprintf_cont("state %i\n", map_state);
|
||||
}
|
||||
dprintf("\n");
|
||||
|
||||
dprintf_cont("\n");
|
||||
}
|
||||
|
||||
static int store_imsm_mpb(int fd, struct imsm_super *mpb)
|
||||
|
@ -7473,7 +7465,7 @@ static struct dl *imsm_readd(struct intel_super *super, int idx, struct active_a
|
|||
dl = NULL;
|
||||
|
||||
if (dl)
|
||||
dprintf("%s: found %x:%x\n", __func__, dl->major, dl->minor);
|
||||
dprintf("found %x:%x\n", dl->major, dl->minor);
|
||||
|
||||
return dl;
|
||||
}
|
||||
|
@ -7840,8 +7832,7 @@ static int remove_disk_super(struct intel_super *super, int major, int minor)
|
|||
super->disks = dl->next;
|
||||
dl->next = NULL;
|
||||
__free_imsm_disk(dl);
|
||||
dprintf("%s: removed %x:%x\n",
|
||||
__func__, major, minor);
|
||||
dprintf("removed %x:%x\n", major, minor);
|
||||
break;
|
||||
}
|
||||
prev = dl;
|
||||
|
@ -7867,9 +7858,8 @@ static int add_remove_disk_update(struct intel_super *super)
|
|||
disk_cfg->next = super->disks;
|
||||
super->disks = disk_cfg;
|
||||
check_degraded = 1;
|
||||
dprintf("%s: added %x:%x\n",
|
||||
__func__, disk_cfg->major,
|
||||
disk_cfg->minor);
|
||||
dprintf("added %x:%x\n",
|
||||
disk_cfg->major, disk_cfg->minor);
|
||||
} else if (disk_cfg->action == DISK_REMOVE) {
|
||||
dprintf("Disk remove action processed: %x.%x\n",
|
||||
disk_cfg->major, disk_cfg->minor);
|
||||
|
@ -7901,7 +7891,7 @@ static int apply_reshape_migration_update(struct imsm_update_reshape_migration *
|
|||
void **tofree = NULL;
|
||||
int ret_val = 0;
|
||||
|
||||
dprintf("apply_reshape_migration_update()\n");
|
||||
dprintf("(enter)\n");
|
||||
if ((u->subdev < 0) ||
|
||||
(u->subdev > 1)) {
|
||||
dprintf("imsm: Error: Wrong subdev: %i\n", u->subdev);
|
||||
|
@ -8021,7 +8011,7 @@ static int apply_size_change_update(struct imsm_update_size_change *u,
|
|||
struct intel_dev *id;
|
||||
int ret_val = 0;
|
||||
|
||||
dprintf("apply_size_change_update()\n");
|
||||
dprintf("(enter)\n");
|
||||
if ((u->subdev < 0) ||
|
||||
(u->subdev > 1)) {
|
||||
dprintf("imsm: Error: Wrong subdev: %i\n", u->subdev);
|
||||
|
@ -8038,8 +8028,7 @@ static int apply_size_change_update(struct imsm_update_size_change *u,
|
|||
/* calculate new size
|
||||
*/
|
||||
blocks_per_member = u->new_size / used_disks;
|
||||
dprintf("imsm: apply_size_change_update(size: %llu, "
|
||||
"blocks per member: %llu)\n",
|
||||
dprintf("(size: %llu, blocks per member: %llu)\n",
|
||||
u->new_size, blocks_per_member);
|
||||
set_blocks_per_member(map, blocks_per_member);
|
||||
imsm_set_array_size(dev, u->new_size);
|
||||
|
@ -8182,7 +8171,7 @@ static int apply_reshape_container_disks_update(struct imsm_update_reshape *u,
|
|||
int ret_val = 0;
|
||||
unsigned int dev_id;
|
||||
|
||||
dprintf("imsm: apply_reshape_container_disks_update()\n");
|
||||
dprintf("(enter)\n");
|
||||
|
||||
/* enable spares to use in array */
|
||||
for (i = 0; i < delta_disks; i++) {
|
||||
|
@ -8423,8 +8412,7 @@ static void imsm_process_update(struct supertype *st,
|
|||
struct imsm_update_general_migration_checkpoint *u =
|
||||
(void *)update->buf;
|
||||
|
||||
dprintf("imsm: process_update() "
|
||||
"for update_general_migration_checkpoint called\n");
|
||||
dprintf("called for update_general_migration_checkpoint\n");
|
||||
|
||||
/* find device under general migration */
|
||||
for (id = super->devlist ; id; id = id->next) {
|
||||
|
@ -8493,15 +8481,14 @@ static void imsm_process_update(struct supertype *st,
|
|||
|
||||
/* handle racing creates: first come first serve */
|
||||
if (u->dev_idx < mpb->num_raid_devs) {
|
||||
dprintf("%s: subarray %d already defined\n",
|
||||
__func__, u->dev_idx);
|
||||
dprintf("subarray %d already defined\n", u->dev_idx);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
/* check update is next in sequence */
|
||||
if (u->dev_idx != mpb->num_raid_devs) {
|
||||
dprintf("%s: can not create array %d expected index %d\n",
|
||||
__func__, u->dev_idx, mpb->num_raid_devs);
|
||||
dprintf("can not create array %d expected index %d\n",
|
||||
u->dev_idx, mpb->num_raid_devs);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
|
@ -8526,14 +8513,14 @@ static void imsm_process_update(struct supertype *st,
|
|||
continue;
|
||||
|
||||
if (disks_overlap(super, i, u)) {
|
||||
dprintf("%s: arrays overlap\n", __func__);
|
||||
dprintf("arrays overlap\n");
|
||||
goto create_error;
|
||||
}
|
||||
}
|
||||
|
||||
/* check that prepare update was successful */
|
||||
if (!update->space) {
|
||||
dprintf("%s: prepare update failed\n", __func__);
|
||||
dprintf("prepare update failed\n");
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
|
@ -8545,7 +8532,7 @@ static void imsm_process_update(struct supertype *st,
|
|||
for (i = 0; i < new_map->num_members; i++) {
|
||||
dl = serial_to_dl(inf[i].serial, super);
|
||||
if (!dl) {
|
||||
dprintf("%s: disk disappeared\n", __func__);
|
||||
dprintf("disk disappeared\n");
|
||||
goto create_error;
|
||||
}
|
||||
}
|
||||
|
@ -8696,8 +8683,7 @@ static int imsm_prepare_update(struct supertype *st,
|
|||
case update_general_migration_checkpoint:
|
||||
if (update->len < (int)sizeof(struct imsm_update_general_migration_checkpoint))
|
||||
return 0;
|
||||
dprintf("imsm: prepare_update() "
|
||||
"for update_general_migration_checkpoint called\n");
|
||||
dprintf("called for update_general_migration_checkpoint\n");
|
||||
break;
|
||||
case update_takeover: {
|
||||
struct imsm_update_takeover *u = (void *)update->buf;
|
||||
|
@ -8746,7 +8732,7 @@ static int imsm_prepare_update(struct supertype *st,
|
|||
if (update->len < (int)sizeof(*u))
|
||||
return 0;
|
||||
|
||||
dprintf("imsm: imsm_prepare_update() for update_reshape\n");
|
||||
dprintf("for update_reshape\n");
|
||||
|
||||
for (dl = super->devlist; dl; dl = dl->next) {
|
||||
int size = sizeof_imsm_dev(dl->dev, 1);
|
||||
|
@ -8781,7 +8767,7 @@ static int imsm_prepare_update(struct supertype *st,
|
|||
if (update->len < (int)sizeof(*u))
|
||||
return 0;
|
||||
|
||||
dprintf("imsm: imsm_prepare_update() for update_reshape\n");
|
||||
dprintf("for update_reshape\n");
|
||||
|
||||
/* add space for bigger array in update
|
||||
*/
|
||||
|
@ -8943,8 +8929,7 @@ static void imsm_delete(struct intel_super *super, struct dl **dlp, unsigned ind
|
|||
int i, j, num_members;
|
||||
__u32 ord;
|
||||
|
||||
dprintf("%s: deleting device[%d] from imsm_super\n",
|
||||
__func__, index);
|
||||
dprintf("deleting device[%d] from imsm_super\n", index);
|
||||
|
||||
/* shift all indexes down one */
|
||||
for (iter = super->disks; iter; iter = iter->next)
|
||||
|
@ -9680,9 +9665,9 @@ static int imsm_reshape_is_allowed_on_container(struct supertype *st,
|
|||
ret_val = 1;
|
||||
|
||||
if (ret_val)
|
||||
dprintf("\tContainer operation allowed\n");
|
||||
dprintf("Container operation allowed\n");
|
||||
else
|
||||
dprintf("\tError: %i\n", ret_val);
|
||||
dprintf("Error: %i\n", ret_val);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
@ -9720,8 +9705,7 @@ static int imsm_create_metadata_update_for_reshape(
|
|||
int delta_disks = 0;
|
||||
struct mdinfo *dev;
|
||||
|
||||
dprintf("imsm_update_metadata_for_reshape(enter) raid_disks = %i\n",
|
||||
geo->raid_disks);
|
||||
dprintf("(enter) raid_disks = %i\n", geo->raid_disks);
|
||||
|
||||
delta_disks = geo->raid_disks - old_raid_disks;
|
||||
|
||||
|
@ -9775,12 +9759,12 @@ abort:
|
|||
|
||||
dprintf("imsm: reshape update preparation :");
|
||||
if (i == delta_disks) {
|
||||
dprintf(" OK\n");
|
||||
dprintf_cont(" OK\n");
|
||||
*updatep = u;
|
||||
return update_memory_size;
|
||||
}
|
||||
free(u);
|
||||
dprintf(" Error\n");
|
||||
dprintf_cont(" Error\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -9799,8 +9783,7 @@ static int imsm_create_metadata_update_for_size_change(
|
|||
int update_memory_size = 0;
|
||||
struct imsm_update_size_change *u = NULL;
|
||||
|
||||
dprintf("imsm_create_metadata_update_for_size_change(enter)"
|
||||
" New size = %llu\n", geo->size);
|
||||
dprintf("(enter) New size = %llu\n", geo->size);
|
||||
|
||||
/* size of all update data without anchor */
|
||||
update_memory_size = sizeof(struct imsm_update_size_change);
|
||||
|
@ -9832,8 +9815,7 @@ static int imsm_create_metadata_update_for_migration(
|
|||
struct imsm_dev *dev;
|
||||
int previous_level = -1;
|
||||
|
||||
dprintf("imsm_create_metadata_update_for_migration(enter)"
|
||||
" New Level = %i\n", geo->level);
|
||||
dprintf("(enter) New Level = %i\n", geo->level);
|
||||
|
||||
/* size of all update data without anchor */
|
||||
update_memory_size = sizeof(struct imsm_update_reshape_migration);
|
||||
|
@ -10179,7 +10161,7 @@ static int imsm_reshape_super(struct supertype *st, unsigned long long size,
|
|||
int ret_val = 1;
|
||||
struct geo_params geo;
|
||||
|
||||
dprintf("imsm: reshape_super called.\n");
|
||||
dprintf("(enter)\n");
|
||||
|
||||
memset(&geo, 0, sizeof(struct geo_params));
|
||||
|
||||
|
@ -10193,8 +10175,8 @@ static int imsm_reshape_super(struct supertype *st, unsigned long long size,
|
|||
if (delta_disks != UnSet)
|
||||
geo.raid_disks += delta_disks;
|
||||
|
||||
dprintf("\tfor level : %i\n", geo.level);
|
||||
dprintf("\tfor raid_disks : %i\n", geo.raid_disks);
|
||||
dprintf("for level : %i\n", geo.level);
|
||||
dprintf("for raid_disks : %i\n", geo.raid_disks);
|
||||
|
||||
if (experimental() == 0)
|
||||
return ret_val;
|
||||
|
@ -10331,21 +10313,18 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
|
|||
unsigned long long position_to_set = to_complete / ndata;
|
||||
|
||||
if (fd < 0) {
|
||||
dprintf("imsm: wait_for_reshape_imsm() "
|
||||
"cannot open reshape_position\n");
|
||||
dprintf("cannot open reshape_position\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (sysfs_fd_get_ll(fd, &completed) < 0) {
|
||||
dprintf("imsm: wait_for_reshape_imsm() "
|
||||
"cannot read reshape_position (no reshape in progres)\n");
|
||||
dprintf("cannot read reshape_position (no reshape in progres)\n");
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (completed > position_to_set) {
|
||||
dprintf("imsm: wait_for_reshape_imsm() "
|
||||
"wrong next position to set %llu (%llu)\n",
|
||||
dprintf("wrong next position to set %llu (%llu)\n",
|
||||
to_complete, position_to_set);
|
||||
close(fd);
|
||||
return -1;
|
||||
|
@ -10353,8 +10332,7 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
|
|||
dprintf("Position set: %llu\n", position_to_set);
|
||||
if (sysfs_set_num(sra, NULL, "sync_max",
|
||||
position_to_set) != 0) {
|
||||
dprintf("imsm: wait_for_reshape_imsm() "
|
||||
"cannot set reshape position to %llu\n",
|
||||
dprintf("cannot set reshape position to %llu\n",
|
||||
position_to_set);
|
||||
close(fd);
|
||||
return -1;
|
||||
|
@ -10368,8 +10346,7 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
|
|||
strncmp(action, "reshape", 7) != 0)
|
||||
break;
|
||||
if (sysfs_fd_get_ll(fd, &completed) < 0) {
|
||||
dprintf("imsm: wait_for_reshape_imsm() "
|
||||
"cannot read reshape_position (in loop)\n");
|
||||
dprintf("cannot read reshape_position (in loop)\n");
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -81,8 +81,7 @@ static int load_super_mbr(struct supertype *st, int fd, char *devname)
|
|||
free_mbr(st);
|
||||
|
||||
if (posix_memalign((void**)&super, 512, 512) != 0) {
|
||||
pr_err("%s could not allocate superblock\n",
|
||||
__func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -119,8 +118,7 @@ static int store_mbr(struct supertype *st, int fd)
|
|||
struct MBR *old, *super;
|
||||
|
||||
if (posix_memalign((void**)&old, 512, 512) != 0) {
|
||||
pr_err("%s could not allocate superblock\n",
|
||||
__func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
6
super0.c
6
super0.c
|
@ -713,7 +713,7 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
|
|||
|
||||
if (posix_memalign((void**)&sb, 4096,
|
||||
MD_SB_BYTES + ROUND_UP(sizeof(bitmap_super_t), 4096)) != 0) {
|
||||
pr_err("%s could not allocate superblock\n", __func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 0;
|
||||
}
|
||||
memset(sb, 0, MD_SB_BYTES + sizeof(bitmap_super_t));
|
||||
|
@ -929,7 +929,7 @@ static int compare_super0(struct supertype *st, struct supertype *tst)
|
|||
if (posix_memalign((void**)&first, 4096,
|
||||
MD_SB_BYTES +
|
||||
ROUND_UP(sizeof(struct bitmap_super_s), 4096)) != 0) {
|
||||
pr_err("%s could not allocate superblock\n", __func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 1;
|
||||
}
|
||||
memcpy(first, second, MD_SB_BYTES + sizeof(struct bitmap_super_s));
|
||||
|
@ -997,7 +997,7 @@ static int load_super0(struct supertype *st, int fd, char *devname)
|
|||
if (posix_memalign((void**)&super, 4096,
|
||||
MD_SB_BYTES +
|
||||
ROUND_UP(sizeof(bitmap_super_t), 4096)) != 0) {
|
||||
pr_err("%s could not allocate superblock\n", __func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
9
super1.c
9
super1.c
|
@ -811,7 +811,7 @@ static int examine_badblocks_super1(struct supertype *st, int fd, char *devname)
|
|||
|
||||
size = __le32_to_cpu(sb->bblog_size)* 512;
|
||||
if (posix_memalign((void**)&bbl, 4096, size) != 0) {
|
||||
pr_err("%s could not allocate badblocks list\n", __func__);
|
||||
pr_err("could not allocate badblocks list\n");
|
||||
return 0;
|
||||
}
|
||||
offset = __le64_to_cpu(sb->super_offset) +
|
||||
|
@ -1328,7 +1328,7 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
|
|||
int sbsize;
|
||||
|
||||
if (posix_memalign((void**)&sb, 4096, SUPER1_SIZE) != 0) {
|
||||
pr_err("%s could not allocate superblock\n", __func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 0;
|
||||
}
|
||||
memset(sb, 0, SUPER1_SIZE);
|
||||
|
@ -1726,7 +1726,7 @@ static int compare_super1(struct supertype *st, struct supertype *tst)
|
|||
|
||||
if (!first) {
|
||||
if (posix_memalign((void**)&first, 4096, SUPER1_SIZE) != 0) {
|
||||
pr_err("%s could not allocate superblock\n", __func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 1;
|
||||
}
|
||||
memcpy(first, second, SUPER1_SIZE);
|
||||
|
@ -1837,8 +1837,7 @@ static int load_super1(struct supertype *st, int fd, char *devname)
|
|||
}
|
||||
|
||||
if (posix_memalign((void**)&super, 4096, SUPER1_SIZE) != 0) {
|
||||
pr_err("%s could not allocate superblock\n",
|
||||
__func__);
|
||||
pr_err("could not allocate superblock\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
8
sysfs.c
8
sysfs.c
|
@ -413,8 +413,8 @@ int sysfs_set_str(struct mdinfo *sra, struct mdinfo *dev,
|
|||
n = write(fd, val, strlen(val));
|
||||
close(fd);
|
||||
if (n != strlen(val)) {
|
||||
dprintf("%s: failed to write '%s' to '%s' (%s)\n",
|
||||
Name, val, fname, strerror(errno));
|
||||
dprintf("failed to write '%s' to '%s' (%s)\n",
|
||||
val, fname, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -450,8 +450,8 @@ int sysfs_uevent(struct mdinfo *sra, char *event)
|
|||
n = write(fd, event, strlen(event));
|
||||
close(fd);
|
||||
if (n != (int)strlen(event)) {
|
||||
dprintf("%s: failed to write '%s' to '%s' (%s)\n",
|
||||
Name, event, fname, strerror(errno));
|
||||
dprintf("failed to write '%s' to '%s' (%s)\n",
|
||||
event, fname, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue