Grow: Simplify error paths in Grow_addbitmap()

This gets rid of some repeated exit paths, making the code a little
cleaner.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
This commit is contained in:
Jes Sorensen 2016-05-12 14:37:44 -04:00
parent 2ec2b7e9d5
commit 4ed129aca7
1 changed files with 10 additions and 10 deletions

20
Grow.c
View File

@ -423,22 +423,22 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
continue;
rv = st->ss->load_super(st, fd2, NULL);
if (!rv) {
if (!st->ss->add_internal_bitmap(
st, &s->bitmap_chunk, c->delay,
s->write_behind, bitmapsize,
offset_setable, major))
st->ss->write_bitmap(st, fd2, NodeNumUpdate);
else {
rv = st->ss->add_internal_bitmap(
st, &s->bitmap_chunk, c->delay,
s->write_behind, bitmapsize,
offset_setable, major);
if (!rv) {
st->ss->write_bitmap(st, fd2,
NodeNumUpdate);
} else {
pr_err("failed to create internal bitmap - chunksize problem.\n");
close(fd2);
return 1;
}
} else {
pr_err("failed to load super-block.\n");
close(fd2);
return 1;
}
close(fd2);
if (rv)
return 1;
}
if (offset_setable) {
st->ss->getinfo_super(st, mdi, NULL);