From: Heinz Mauelshagen <heinzm@xxxxxxxxxx> Also, add curly braces where appropriate. Signed-off-by: heinzm <heinzm@xxxxxxxxxx> --- drivers/md/md-autodetect.c | 3 +- drivers/md/md-faulty.c | 10 +++++-- drivers/md/md.c | 20 ++++++++----- drivers/md/md.h | 3 +- drivers/md/raid10.c | 11 ++++---- drivers/md/raid5.c | 57 +++++++++++++++++++++----------------- 6 files changed, 61 insertions(+), 43 deletions(-) diff --git a/drivers/md/md-autodetect.c b/drivers/md/md-autodetect.c index 46090cdd02ba..e8acb3021094 100644 --- a/drivers/md/md-autodetect.c +++ b/drivers/md/md-autodetect.c @@ -237,7 +237,8 @@ static int __init raid_setup(char *str) int wlen; if (comma) wlen = (comma-str)-pos; - else wlen = (len-1)-pos; + else + wlen = (len-1)-pos; if (!strncmp(str, "noautodetect", wlen)) raid_noautodetect = 1; diff --git a/drivers/md/md-faulty.c b/drivers/md/md-faulty.c index 8493432a732e..33cb00115777 100644 --- a/drivers/md/md-faulty.c +++ b/drivers/md/md-faulty.c @@ -125,10 +125,12 @@ static void add_sector(struct faulty_conf *conf, sector_t start, int mode) { int i; int n = conf->nfaults; - for (i = 0; i < conf->nfaults; i++) + for (i = 0; i < conf->nfaults; i++) { if (conf->faults[i] == start) { switch (mode) { - case NoPersist: conf->modes[i] = mode; return; + case NoPersist: + conf->modes[i] = mode; + return; case WritePersistent: if (conf->modes[i] == ReadPersistent || conf->modes[i] == ReadFixable) @@ -152,6 +154,7 @@ static void add_sector(struct faulty_conf *conf, sector_t start, int mode) } } else if (conf->modes[i] == NoPersist) n = i; + } if (n >= MaxFault) return; @@ -271,7 +274,8 @@ static int faulty_reshape(struct mddev *mddev) } } else if (mode < Modes) { conf->period[mode] = count; - if (!count) count++; + if (!count) + count++; atomic_set(&conf->counters[mode], count); } else return -EINVAL; diff --git a/drivers/md/md.c b/drivers/md/md.c index f8d44832339e..24e55e2cf4db 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1634,7 +1634,8 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ * and it is safe to read 4k, so we do that */ ret = read_disk_sb(rdev, 4096); - if (ret) return ret; + if (ret) + return ret; sb = page_address(rdev->sb_page); @@ -4599,13 +4600,16 @@ bitmap_store(struct mddev *mddev, const char *buf, size_t len) /* buf should be <chunk> <chunk> ... or <chunk>-<chunk> ... (range) */ while (*buf) { chunk = end_chunk = simple_strtoul(buf, &end, 0); - if (buf == end) break; + if (buf == end) + break; if (*end == '-') { /* range */ buf = end + 1; end_chunk = simple_strtoul(buf, &end, 0); - if (buf == end) break; + if (buf == end) + break; } - if (*end && !isspace(*end)) break; + if (*end && !isspace(*end)) + break; md_bitmap_dirty_bits(mddev->bitmap, chunk, end_chunk); buf = skip_spaces(end); } @@ -4975,7 +4979,8 @@ sync_speed_show(struct mddev *mddev, char *page) return sprintf(page, "none\n"); resync = mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active); dt = (jiffies - mddev->resync_mark) / HZ; - if (!dt) dt++; + if (!dt) + dt++; db = resync - mddev->resync_mark_cnt; return sprintf(page, "%lu\n", db/dt/2); /* K/sec */ } @@ -7525,7 +7530,7 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, case RAID_VERSION: err = get_version(argp); goto out; - default:; + default: } /* @@ -8117,7 +8122,8 @@ static int status_resync(struct seq_file *seq, struct mddev *mddev) * The '+1' avoids division by zero if db is very small. */ dt = ((jiffies - mddev->resync_mark) / HZ); - if (!dt) dt++; + if (!dt) + dt++; curr_mark_cnt = mddev->curr_mark_cnt; recovery_active = atomic_read(&mddev->recovery_active); diff --git a/drivers/md/md.h b/drivers/md/md.h index 9408cfbd92db..a885bbcebe2d 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -720,7 +720,8 @@ struct md_io_acct { static inline void safe_put_page(struct page *p) { - if (p) put_page(p); + if (p) + put_page(p); } extern int register_md_personality(struct md_personality *p); diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index a26a3764b234..7a15f794b839 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3335,11 +3335,12 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) md_bitmap_end_sync(mddev->bitmap, mddev->curr_resync, &sync_blocks, 1); - else for (i = 0; i < conf->geo.raid_disks; i++) { - sector_t sect = - raid10_find_virt(conf, mddev->curr_resync, i); - md_bitmap_end_sync(mddev->bitmap, sect, - &sync_blocks, 1); + else { + for (i = 0; i < conf->geo.raid_disks; i++) { + sector_t sect = + raid10_find_virt(conf, mddev->curr_resync, i); + md_bitmap_end_sync(mddev->bitmap, sect, &sync_blocks, 1); + } } } else { /* completed sync */ diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 1d5db89acb8d..00151c850a35 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3215,7 +3215,8 @@ sector_t raid5_compute_blocknr(struct stripe_head *sh, int i, int previous) if (i == sh->pd_idx) return 0; switch (conf->level) { - case 4: break; + case 4: + break; case 5: switch (algorithm) { case ALGORITHM_LEFT_ASYMMETRIC: @@ -3712,7 +3713,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, sh->dev[i].page = sh->dev[i].orig_page; } - if (bi) bitmap_end = 1; + if (bi) + bitmap_end = 1; while (bi && bi->bi_iter.bi_sector < sh->dev[i].sector + RAID5_STRIPE_SECTORS(conf)) { struct bio *bi2 = r5_next_bio(conf, bi, sh->dev[i].sector); @@ -4202,30 +4204,33 @@ static int handle_stripe_dirtying(struct r5conf *conf, pr_debug("force RCW rmw_level=%u, recovery_cp=%llu sh->sector=%llu\n", conf->rmw_level, (unsigned long long)recovery_cp, (unsigned long long)sh->sector); - } else for (i = disks; i--; ) { - /* would I have to read this buffer for read_modify_write */ - struct r5dev *dev = &sh->dev[i]; - if (((dev->towrite && !delay_towrite(conf, dev, s)) || - i == sh->pd_idx || i == sh->qd_idx || - test_bit(R5_InJournal, &dev->flags)) && - !test_bit(R5_LOCKED, &dev->flags) && - !(uptodate_for_rmw(dev) || - test_bit(R5_Wantcompute, &dev->flags))) { - if (test_bit(R5_Insync, &dev->flags)) - rmw++; - else - rmw += 2*disks; /* cannot read it */ - } - /* Would I have to read this buffer for reconstruct_write */ - if (!test_bit(R5_OVERWRITE, &dev->flags) && - i != sh->pd_idx && i != sh->qd_idx && - !test_bit(R5_LOCKED, &dev->flags) && - !(test_bit(R5_UPTODATE, &dev->flags) || - test_bit(R5_Wantcompute, &dev->flags))) { - if (test_bit(R5_Insync, &dev->flags)) - rcw++; - else - rcw += 2*disks; + } else { + for (i = disks; i--; ) { + /* would I have to read this buffer for read_modify_write */ + struct r5dev *dev = &sh->dev[i]; + if (((dev->towrite && !delay_towrite(conf, dev, s)) || + i == sh->pd_idx || i == sh->qd_idx || + test_bit(R5_InJournal, &dev->flags)) && + !test_bit(R5_LOCKED, &dev->flags) && + !(uptodate_for_rmw(dev) || + test_bit(R5_Wantcompute, &dev->flags))) { + if (test_bit(R5_Insync, &dev->flags)) + rmw++; + else + rmw += 2*disks; /* cannot read it */ + } + + /* Would I have to read this buffer for reconstruct_write */ + if (!test_bit(R5_OVERWRITE, &dev->flags) && + i != sh->pd_idx && i != sh->qd_idx && + !test_bit(R5_LOCKED, &dev->flags) && + !(test_bit(R5_UPTODATE, &dev->flags) || + test_bit(R5_Wantcompute, &dev->flags))) { + if (test_bit(R5_Insync, &dev->flags)) + rcw++; + else + rcw += 2*disks; + } } } -- 2.39.2