diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2016-05-12 20:37:44 +0200 |
---|---|---|
committer | Jes Sorensen <Jes.Sorensen@redhat.com> | 2016-05-12 21:27:18 +0200 |
commit | 4ed129aca7fd26dd134eecd6fea91dc83ae23aa0 (patch) | |
tree | ba0d15e23410a92dba68407eefa4af25d8cdf60c /Grow.c | |
parent | mdadm: Make add_internal_bitmap() return 0 on success (diff) | |
download | mdadm-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-x | Grow.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -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); |