summaryrefslogtreecommitdiffstats
path: root/Grow.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2016-05-12 20:37:44 +0200
committerJes Sorensen <Jes.Sorensen@redhat.com>2016-05-12 21:27:18 +0200
commit4ed129aca7fd26dd134eecd6fea91dc83ae23aa0 (patch)
treeba0d15e23410a92dba68407eefa4af25d8cdf60c /Grow.c
parentmdadm: Make add_internal_bitmap() return 0 on success (diff)
downloadmdadm-4ed129aca7fd26dd134eecd6fea91dc83ae23aa0.tar.xz
mdadm-4ed129aca7fd26dd134eecd6fea91dc83ae23aa0.zip
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>
Diffstat (limited to 'Grow.c')
-rwxr-xr-xGrow.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/Grow.c b/Grow.c
index cdd9d05b..fc454b86 100755
--- a/Grow.c
+++ b/Grow.c
@@ -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);