From: Heinz Mauelshagen <heinzm@xxxxxxxxxx> Signed-off-by: heinzm <heinzm@xxxxxxxxxx> --- drivers/md/md-bitmap.c | 5 +++-- drivers/md/md-cluster.c | 5 +++-- drivers/md/md.c | 31 ++++++++++++++++--------------- drivers/md/raid10.c | 18 +++++++++--------- 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index 65e77a7e3656..e739efe2249d 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -2188,8 +2188,9 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks, blocks = old_counts.chunks << old_counts.chunkshift; pr_warn("Could not pre-allocate in-memory bitmap for cluster raid\n"); break; - } else - bitmap->counts.bp[page].count += 1; + } + + bitmap->counts.bp[page].count += 1; } } diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index 762160e81ce8..e115603ff0d9 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -174,8 +174,9 @@ static int dlm_lock_sync_interruptible(struct dlm_lock_resource *res, int mode, pr_info("failed to cancel previous lock request " "%s return %d\n", res->name, ret); return -EPERM; - } else - res->sync_locking_done = false; + } + + res->sync_locking_done = false; if (res->lksb.sb_status == 0) res->mode = mode; return res->lksb.sb_status; diff --git a/drivers/md/md.c b/drivers/md/md.c index e19edfe62516..37f1323306aa 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2180,7 +2180,6 @@ super_1_rdev_size_change(struct md_rdev *rdev, sector_t num_sectors) sb_start &= ~(sector_t)(4*2 - 1); bm_space = super_1_choose_bm_space(dev_size); - /* Space that can be used to store date needs to decrease * superblock bitmap space and bad block space(4K) */ @@ -3200,8 +3199,9 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len) if (err) { rdev->raid_disk = -1; return err; - } else - sysfs_notify_dirent_safe(rdev->sysfs_state); + } + + sysfs_notify_dirent_safe(rdev->sysfs_state); /* failure here is OK */; sysfs_link_rdev(rdev->mddev, rdev); /* don't wakeup anyone, leave that to userspace. */ @@ -7359,13 +7359,12 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info) */ if (mddev->pers->check_reshape == NULL) return -EINVAL; - else { - mddev->new_layout = info->layout; - rv = mddev->pers->check_reshape(mddev); - if (rv) - mddev->new_layout = mddev->layout; - return rv; - } + + mddev->new_layout = info->layout; + rv = mddev->pers->check_reshape(mddev); + if (rv) + mddev->new_layout = mddev->layout; + return rv; } if (info->size >= 0 && mddev->dev_sectors / 2 != info->size) rv = update_size(mddev, (sector_t)info->size * 2); @@ -7689,16 +7688,18 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, if (mddev->pers) { mdu_disk_info_t info; - if (copy_from_user(&info, argp, sizeof(info))) + if (copy_from_user(&info, argp, sizeof(info))) { err = -EFAULT; - else if (!(info.state & (1<<MD_DISK_SYNC))) + goto unlock; + } + + if (!(info.state & (1<<MD_DISK_SYNC))) /* Need to clear read-only for this */ break; - else - err = md_add_new_disk(mddev, &info); + + err = md_add_new_disk(mddev, &info); goto unlock; } - break; } /* diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index dbad26fcca12..7ab011cdb995 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2325,6 +2325,7 @@ static void end_reshape_read(struct bio *bio) static void end_sync_request(struct r10bio *r10_bio) { struct mddev *mddev = r10_bio->mddev; + struct r10bio *r10_bio2; while (atomic_dec_and_test(&r10_bio->remaining)) { if (r10_bio->master_bio == NULL) { @@ -2338,16 +2339,15 @@ static void end_sync_request(struct r10bio *r10_bio) put_buf(r10_bio); md_done_sync(mddev, s, 1); break; - } else { - struct r10bio *r10_bio2 = (struct r10bio *)r10_bio->master_bio; - - if (test_bit(R10BIO_MadeGood, &r10_bio->state) || - test_bit(R10BIO_WriteError, &r10_bio->state)) - reschedule_retry(r10_bio); - else - put_buf(r10_bio); - r10_bio = r10_bio2; } + + r10_bio2 = (struct r10bio *)r10_bio->master_bio; + if (test_bit(R10BIO_MadeGood, &r10_bio->state) || + test_bit(R10BIO_WriteError, &r10_bio->state)) + reschedule_retry(r10_bio); + else + put_buf(r10_bio); + r10_bio = r10_bio2; } } -- 2.39.2