File 0042-Grow-Grow_addbitmap-reduce-indentation.patch of Package mdadm.7129
From dac1b1115fe46898498920c67f851a5d1d89bc2a Mon Sep 17 00:00:00 2001
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Date: Thu, 12 May 2016 14:27:11 -0400
Subject: [PATCH 267/359] Grow: Grow_addbitmap() reduce indentation
References: bsc#1081910
This makes the code a little more readable.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Coly Li <colyli@suse.de>
---
Grow.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/Grow.c b/Grow.c
index f58c753..9da72cc 100755
--- a/Grow.c
+++ b/Grow.c
@@ -405,6 +405,8 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
for (d=0; d< st->max_devs; d++) {
mdu_disk_info_t disk;
char *dv;
+ int fd2;
+
disk.number = d;
if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
continue;
@@ -414,26 +416,24 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
if ((disk.state & (1<<MD_DISK_SYNC))==0)
continue;
dv = map_dev(disk.major, disk.minor, 1);
- if (dv) {
- int fd2 = dev_open(dv, O_RDWR);
- if (fd2 < 0)
- continue;
- if (st->ss->load_super(st, fd2, NULL)==0) {
- 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 {
- pr_err("failed to create internal bitmap - chunksize problem.\n");
- close(fd2);
- return 1;
- }
+ if (!dv)
+ continue;
+ fd2 = dev_open(dv, O_RDWR);
+ if (fd2 < 0)
+ continue;
+ if (st->ss->load_super(st, fd2, NULL)==0) {
+ 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 {
+ pr_err("failed to create internal bitmap - chunksize problem.\n");
+ close(fd2);
+ return 1;
}
- close(fd2);
}
+ close(fd2);
}
if (offset_setable) {
st->ss->getinfo_super(st, mdi, NULL);
--
2.16.1