summaryrefslogtreecommitdiffstats
path: root/Grow.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-12-14 20:14:33 +1100
committerNeil Brown <neilb@suse.de>2007-12-14 20:14:33 +1100
commit3da92f272d017b1817b13f37f41c1ed4d6117291 (patch)
treeb0013cdf438a640150e13388ebf7d64992be3737 /Grow.c
parent64557c33917a6f661d091e36ab00065d4107dcee (diff)
downloadmdadm-3da92f272d017b1817b13f37f41c1ed4d6117291.tar.gz
mdadm-3da92f272d017b1817b13f37f41c1ed4d6117291.tar.xz
mdadm-3da92f272d017b1817b13f37f41c1ed4d6117291.zip
Drop the superblock arg from all metadata methods.
It is now in the 'supertype'
Diffstat (limited to 'Grow.c')
-rw-r--r--Grow.c61
1 files changed, 27 insertions, 34 deletions
diff --git a/Grow.c b/Grow.c
index 0aa7287..e07e2c0 100644
--- a/Grow.c
+++ b/Grow.c
@@ -47,7 +47,6 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
*/
struct mdinfo info;
- void *super = NULL;
struct stat stb;
int nfd, fd2;
int d, nd;
@@ -103,10 +102,9 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
fprintf(stderr, Name ": cannot open device file %s\n", dv);
return 1;
}
- if (super)
- st->ss->free_super(st, super);
- super= NULL;
- if (st->ss->load_super(st, fd2, &super, NULL)) {
+ st->ss->free_super(st);
+
+ if (st->ss->load_super(st, fd2, NULL)) {
fprintf(stderr, Name ": cannot find super block on %s\n", dv);
close(fd2);
return 1;
@@ -122,10 +120,10 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
info.disk.minor = minor(stb.st_rdev);
info.disk.raid_disk = d;
info.disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE);
- st->ss->update_super(st, &info, super, "linear-grow-new", newdev,
+ st->ss->update_super(st, &info, "linear-grow-new", newdev,
0, 0, NULL);
- if (st->ss->store_super(st, nfd, super)) {
+ if (st->ss->store_super(st, nfd)) {
fprintf(stderr, Name ": Cannot store new superblock on %s\n",
newdev);
close(nfd);
@@ -168,7 +166,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
fprintf(stderr, Name ": cannot open device file %s\n", dv);
return 1;
}
- if (st->ss->load_super(st, fd2, &super, NULL)) {
+ if (st->ss->load_super(st, fd2, NULL)) {
fprintf(stderr, Name ": cannot find super block on %s\n", dv);
close(fd);
return 1;
@@ -178,10 +176,10 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
info.array.active_disks = nd+1;
info.array.working_disks = nd+1;
- st->ss->update_super(st, &info, super, "linear-grow-update", dv,
+ st->ss->update_super(st, &info, "linear-grow-update", dv,
0, 0, NULL);
- if (st->ss->store_super(st, fd2, super)) {
+ if (st->ss->store_super(st, fd2)) {
fprintf(stderr, Name ": Cannot store new superblock on %s\n", dv);
close(fd2);
return 1;
@@ -303,17 +301,16 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
continue;
dv = map_dev(disk.major, disk.minor, 1);
if (dv) {
- void *super;
int fd2 = dev_open(dv, O_RDWR);
if (fd2 < 0)
continue;
- if (st->ss->load_super(st, fd2, &super, NULL)==0) {
+ if (st->ss->load_super(st, fd2, NULL)==0) {
if (st->ss->add_internal_bitmap(
- st, super,
+ st,
&chunk, delay, write_behind,
bitmapsize, 0, major)
)
- st->ss->write_bitmap(st, fd2, super);
+ st->ss->write_bitmap(st, fd2);
else {
fprintf(stderr, Name ": failed to create internal bitmap - chunksize problem.\n");
close(fd2);
@@ -333,7 +330,6 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
int bitmap_fd;
int d;
int max_devs = st->max_devs;
- void *super = NULL;
/* try to load a superblock */
for (d=0; d<max_devs; d++) {
@@ -350,9 +346,9 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
if (!dv) continue;
fd2 = dev_open(dv, O_RDONLY);
if (fd2 >= 0 &&
- st->ss->load_super(st, fd2, &super, NULL) == 0) {
+ st->ss->load_super(st, fd2, NULL) == 0) {
close(fd2);
- st->ss->uuid_from_super(st, uuid, super);
+ st->ss->uuid_from_super(st, uuid);
break;
}
close(fd2);
@@ -438,7 +434,6 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
int d, i, spares;
int nrdisks;
int err;
- void *super = NULL;
struct sysarray *sra;
struct sysdev *sd;
@@ -704,7 +699,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
}
/* Find a superblock */
- if (st->ss->load_super(st, fdlist[0], &super, NULL)) {
+ if (st->ss->load_super(st, fdlist[0], NULL)) {
fprintf(stderr, Name ": %s: Cannot find a superblock\n",
devname);
goto abort;
@@ -712,7 +707,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
memcpy(bsb.magic, "md_backup_data-1", 16);
- st->ss->uuid_from_super(st, (int*)&bsb.set_uuid, super);
+ st->ss->uuid_from_super(st, (int*)&bsb.set_uuid);
bsb.mtime = __cpu_to_le64(time(0));
bsb.arraystart = 0;
bsb.length = __cpu_to_le64(last_block);
@@ -882,7 +877,6 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
old_disks = info->array.raid_disks - info->delta_disks;
for (i=old_disks-(backup_file?1:0); i<cnt; i++) {
- void *super = NULL;
struct mdinfo dinfo;
struct mdp_backup_super bsb;
char buf[4096];
@@ -903,12 +897,12 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
fd = fdlist[i];
if (fd < 0)
continue;
- if (st->ss->load_super(st, fd, &super, NULL))
+ if (st->ss->load_super(st, fd, NULL))
continue;
- st->ss->getinfo_super(st, &dinfo, super);
- st->ss->free_super(st, super);
- super = NULL;
+ st->ss->getinfo_super(st, &dinfo);
+ st->ss->free_super(st);
+
if (lseek64(fd,
(dinfo.data_offset + dinfo.component_size - 8) <<9,
0) < 0)
@@ -946,12 +940,11 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
for(j=0; j<info->array.raid_disks; j++) {
if (fdlist[j] < 0)
continue;
- if (st->ss->load_super(st, fdlist[j], &super, NULL))
+ if (st->ss->load_super(st, fdlist[j], NULL))
/* FIXME should be this be an error */
continue;
- st->ss->getinfo_super(st, &dinfo, super);
- st->ss->free_super(st, super);
- super = NULL;
+ st->ss->getinfo_super(st, &dinfo);
+ st->ss->free_super(st);
offsets[j] = dinfo.data_offset;
}
printf(Name ": restoring critical section\n");
@@ -971,15 +964,15 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
for (j=0; j<info->array.raid_disks; j++) {
if (fdlist[j] < 0) continue;
- if (st->ss->load_super(st, fdlist[j], &super, NULL))
+ if (st->ss->load_super(st, fdlist[j], NULL))
continue;
- st->ss->getinfo_super(st, &dinfo, super);
+ st->ss->getinfo_super(st, &dinfo);
dinfo.reshape_progress = __le64_to_cpu(bsb.length);
- st->ss->update_super(st, &dinfo, super,
+ st->ss->update_super(st, &dinfo,
"_reshape_progress",
NULL,0, 0, NULL);
- st->ss->store_super(st, fdlist[j], super);
- st->ss->free_super(st, super);
+ st->ss->store_super(st, fdlist[j]);
+ st->ss->free_super(st);
}
/* And we are done! */