summaryrefslogtreecommitdiffstats
path: root/Grow.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2007-12-14 20:14:00 +1100
committerNeil Brown <neilb@suse.de>2007-12-14 20:14:00 +1100
commitdf37ffc0393b919ba5607bb48b2eaf2f9a1832d7 (patch)
treeda5119c602aa6e1c40248b5a9c8312aedceaeedb /Grow.c
parent2faf1f5f635419a922cf0072c435a23a78b793a7 (diff)
downloadmdadm-df37ffc0393b919ba5607bb48b2eaf2f9a1832d7.tar.gz
mdadm-df37ffc0393b919ba5607bb48b2eaf2f9a1832d7.tar.xz
mdadm-df37ffc0393b919ba5607bb48b2eaf2f9a1832d7.zip
Allow metadata handlers to free their own superblock.
As the metadata handler allocates the superblock, it should free it too. DDF will have a more complex 'superblock' which needs more complex freeing.
Diffstat (limited to 'Grow.c')
-rw-r--r--Grow.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Grow.c b/Grow.c
index 82533de..793e551 100644
--- a/Grow.c
+++ b/Grow.c
@@ -103,7 +103,8 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
fprintf(stderr, Name ": cannot open device file %s\n", dv);
return 1;
}
- if (super) free(super);
+ if (super)
+ st->ss->free_super(super);
super= NULL;
if (st->ss->load_super(st, fd2, &super, NULL)) {
fprintf(stderr, Name ": cannot find super block on %s\n", dv);
@@ -906,7 +907,8 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
continue;
st->ss->getinfo_super(&dinfo, super);
- free(super); super = NULL;
+ st->ss->free_super(super);
+ super = NULL;
if (lseek64(fd,
(dinfo.data_offset + dinfo.component_size - 8) <<9,
0) < 0)
@@ -948,7 +950,8 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
/* FIXME should be this be an error */
continue;
st->ss->getinfo_super(&dinfo, super);
- free(super); super = NULL;
+ st->ss->free_super(super);
+ super = NULL;
offsets[j] = dinfo.data_offset;
}
printf(Name ": restoring critical section\n");
@@ -974,7 +977,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
dinfo.reshape_progress = __le64_to_cpu(bsb.length);
st->ss->update_super(&dinfo, super, "_reshape_progress",NULL,0, 0, NULL);
st->ss->store_super(st, fdlist[j], super);
- free(super);
+ st->ss->free_super(super);
}
/* And we are done! */