Skip to content

Commit 2d0f25c

Browse files
mauelshaMike Snitzer
authored andcommitted
dm: remove unnecessary braces from single statement blocks
Signed-off-by: Heinz Mauelshagen <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 0ef0b47 commit 2d0f25c

File tree

7 files changed

+37
-56
lines changed

7 files changed

+37
-56
lines changed

drivers/md/dm-integrity.c

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,10 @@ static bool block_bitmap_op(struct dm_integrity_c *ic, struct page_list *bitmap,
630630
end_bit %= PAGE_SIZE * 8;
631631

632632
repeat:
633-
if (page < end_page) {
633+
if (page < end_page)
634634
this_end_bit = PAGE_SIZE * 8 - 1;
635-
} else {
635+
else
636636
this_end_bit = end_bit;
637-
}
638637

639638
data = lowmem_page_address(bitmap[page].page);
640639

@@ -1251,13 +1250,12 @@ static bool add_new_range(struct dm_integrity_c *ic, struct dm_integrity_range *
12511250
struct dm_integrity_range *range = container_of(*n, struct dm_integrity_range, node);
12521251

12531252
parent = *n;
1254-
if (new_range->logical_sector + new_range->n_sectors <= range->logical_sector) {
1253+
if (new_range->logical_sector + new_range->n_sectors <= range->logical_sector)
12551254
n = &range->node.rb_left;
1256-
} else if (new_range->logical_sector >= range->logical_sector + range->n_sectors) {
1255+
else if (new_range->logical_sector >= range->logical_sector + range->n_sectors)
12571256
n = &range->node.rb_right;
1258-
} else {
1257+
else
12591258
return false;
1260-
}
12611259
}
12621260

12631261
rb_link_node(&new_range->node, parent, n);
@@ -1364,15 +1362,14 @@ static unsigned int find_journal_node(struct dm_integrity_c *ic, sector_t sector
13641362
while (n) {
13651363
struct journal_node *j = container_of(n, struct journal_node, node);
13661364

1367-
if (sector == j->sector) {
1365+
if (sector == j->sector)
13681366
found = j - ic->journal_tree;
1369-
}
1367+
13701368
if (sector < j->sector) {
13711369
*next_sector = j->sector;
13721370
n = j->node.rb_left;
1373-
} else {
1371+
} else
13741372
n = j->node.rb_right;
1375-
}
13761373
}
13771374

13781375
return found;
@@ -1501,9 +1498,8 @@ static int dm_integrity_rw_tag(struct dm_integrity_c *ic, unsigned char *tag, se
15011498
*metadata_offset = 0;
15021499
}
15031500

1504-
if (unlikely(!is_power_of_2(ic->tag_size))) {
1501+
if (unlikely(!is_power_of_2(ic->tag_size)))
15051502
hash_offset = (hash_offset + to_copy) % ic->tag_size;
1506-
}
15071503

15081504
total_size -= to_copy;
15091505
} while (unlikely(total_size));
@@ -2104,14 +2100,12 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio,
21042100
smp_mb();
21052101
if (unlikely(waitqueue_active(&ic->copy_to_journal_wait)))
21062102
wake_up(&ic->copy_to_journal_wait);
2107-
if (READ_ONCE(ic->free_sectors) <= ic->free_sectors_threshold) {
2103+
if (READ_ONCE(ic->free_sectors) <= ic->free_sectors_threshold)
21082104
queue_work(ic->commit_wq, &ic->commit_work);
2109-
} else {
2105+
else
21102106
schedule_autocommit(ic);
2111-
}
2112-
} else {
2107+
} else
21132108
remove_range(ic, &dio->range);
2114-
}
21152109

21162110
if (unlikely(bio->bi_iter.bi_size)) {
21172111
sector_t area, offset;
@@ -2569,9 +2563,8 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned int write_start
25692563
mempool_free(io, &ic->journal_io_mempool);
25702564
goto skip_io;
25712565
}
2572-
for (l = j; l < k; l++) {
2566+
for (l = j; l < k; l++)
25732567
remove_journal_node(ic, &section_node[l]);
2574-
}
25752568
}
25762569
spin_unlock_irq(&ic->endio_wait.lock);
25772570

@@ -2598,9 +2591,8 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned int write_start
25982591
journal_entry_set_unused(je2);
25992592
r = dm_integrity_rw_tag(ic, journal_entry_tag(ic, je2), &metadata_block, &metadata_offset,
26002593
ic->tag_size, TAG_WRITE);
2601-
if (unlikely(r)) {
2594+
if (unlikely(r))
26022595
dm_integrity_io_error(ic, "reading tags", r);
2603-
}
26042596
}
26052597

26062598
atomic_inc(&comp.in_flight);
@@ -2711,9 +2703,9 @@ static void integrity_recalc(struct work_struct *w)
27112703
n_sectors = range.n_sectors;
27122704

27132705
if (ic->mode == 'B') {
2714-
if (block_bitmap_op(ic, ic->recalc_bitmap, logical_sector, n_sectors, BITMAP_OP_TEST_ALL_CLEAR)) {
2706+
if (block_bitmap_op(ic, ic->recalc_bitmap, logical_sector, n_sectors, BITMAP_OP_TEST_ALL_CLEAR))
27152707
goto advance_and_next;
2716-
}
2708+
27172709
while (block_bitmap_op(ic, ic->recalc_bitmap, logical_sector,
27182710
ic->sectors_per_block, BITMAP_OP_TEST_ALL_CLEAR)) {
27192711
logical_sector += ic->sectors_per_block;
@@ -2732,9 +2724,9 @@ static void integrity_recalc(struct work_struct *w)
27322724

27332725
if (unlikely(++super_counter == RECALC_WRITE_SUPER)) {
27342726
recalc_write_super(ic);
2735-
if (ic->mode == 'B') {
2727+
if (ic->mode == 'B')
27362728
queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, ic->bitmap_flush_interval);
2737-
}
2729+
27382730
super_counter = 0;
27392731
}
27402732

@@ -4417,9 +4409,9 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv
44174409

44184410
log2_blocks_per_bitmap_bit = log2_sectors_per_bitmap_bit - ic->sb->log2_sectors_per_block;
44194411
ic->log2_blocks_per_bitmap_bit = log2_blocks_per_bitmap_bit;
4420-
if (should_write_sb) {
4412+
if (should_write_sb)
44214413
ic->sb->log2_blocks_per_bitmap_bit = log2_blocks_per_bitmap_bit;
4422-
}
4414+
44234415
n_bitmap_bits = ((ic->provided_data_sectors >> ic->sb->log2_sectors_per_block)
44244416
+ (((sector_t)1 << log2_blocks_per_bitmap_bit) - 1)) >> log2_blocks_per_bitmap_bit;
44254417
ic->n_bitmap_blocks = DIV_ROUND_UP(n_bitmap_bits, BITMAP_BLOCK_SIZE * 8);

drivers/md/dm-stats.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,12 +601,10 @@ static void dm_stat_for_entry(struct dm_stat *s, size_t entry,
601601
while (lo + 1 < hi) {
602602
unsigned int mid = (lo + hi) / 2;
603603

604-
if (s->histogram_boundaries[mid - 1] > duration) {
604+
if (s->histogram_boundaries[mid - 1] > duration)
605605
hi = mid;
606-
} else {
606+
else
607607
lo = mid;
608-
}
609-
610608
}
611609
p->histogram[lo]++;
612610
}
@@ -900,9 +898,8 @@ static int dm_stats_print(struct dm_stats *stats, int id,
900898
if (s->n_histogram_entries) {
901899
unsigned int i;
902900

903-
for (i = 0; i < s->n_histogram_entries + 1; i++) {
901+
for (i = 0; i < s->n_histogram_entries + 1; i++)
904902
DMEMIT("%s%llu", !i ? " " : ":", shared->tmp.histogram[i]);
905-
}
906903
}
907904
DMEMIT("\n");
908905

drivers/md/dm-stripe.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,14 +369,12 @@ static void stripe_status(struct dm_target *ti, status_type_t type,
369369
switch (type) {
370370
case STATUSTYPE_INFO:
371371
DMEMIT("%d ", sc->stripes);
372-
for (i = 0; i < sc->stripes; i++) {
372+
for (i = 0; i < sc->stripes; i++)
373373
DMEMIT("%s ", sc->stripe[i].dev->name);
374-
}
374+
375375
DMEMIT("1 ");
376-
for (i = 0; i < sc->stripes; i++) {
377-
DMEMIT("%c", atomic_read(&(sc->stripe[i].error_count)) ?
378-
'D' : 'A');
379-
}
376+
for (i = 0; i < sc->stripes; i++)
377+
DMEMIT("%c", atomic_read(&(sc->stripe[i].error_count)) ? 'D' : 'A');
380378
break;
381379

382380
case STATUSTYPE_TABLE:

drivers/md/dm-thin-metadata.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,9 +1536,9 @@ static int __find_block(struct dm_thin_device *td, dm_block_t block,
15361536
dm_block_t keys[2] = { td->id, block };
15371537
struct dm_btree_info *info;
15381538

1539-
if (can_issue_io) {
1539+
if (can_issue_io)
15401540
info = &pmd->info;
1541-
} else
1541+
else
15421542
info = &pmd->nb_info;
15431543

15441544
r = dm_btree_lookup(info, pmd->root, keys, &value);

drivers/md/dm-writecache.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,9 +1984,8 @@ static void writecache_writeback(struct work_struct *work)
19841984
goto restart;
19851985
}
19861986

1987-
if (wc->overwrote_committed) {
1987+
if (wc->overwrote_committed)
19881988
writecache_wait_for_ios(wc, WRITE);
1989-
}
19901989

19911990
n_walked = 0;
19921991
INIT_LIST_HEAD(&skipped);
@@ -2015,9 +2014,9 @@ static void writecache_writeback(struct work_struct *work)
20152014
} else
20162015
e = container_of(wc->lru.prev, struct wc_entry, lru);
20172016
BUG_ON(e->write_in_progress);
2018-
if (unlikely(!writecache_entry_is_committed(wc, e))) {
2017+
if (unlikely(!writecache_entry_is_committed(wc, e)))
20192018
writecache_flush(wc);
2020-
}
2019+
20212020
node = rb_prev(&e->rb_node);
20222021
if (node) {
20232022
f = container_of(node, struct wc_entry, rb_node);

drivers/md/persistent-data/dm-btree-spine.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,8 @@ void exit_ro_spine(struct ro_spine *s)
133133
{
134134
int i;
135135

136-
for (i = 0; i < s->count; i++) {
136+
for (i = 0; i < s->count; i++)
137137
unlock_block(s->info, s->nodes[i]);
138-
}
139138
}
140139

141140
int ro_step(struct ro_spine *s, dm_block_t new_child)
@@ -184,9 +183,8 @@ void exit_shadow_spine(struct shadow_spine *s)
184183
{
185184
int i;
186185

187-
for (i = 0; i < s->count; i++) {
186+
for (i = 0; i < s->count; i++)
188187
unlock_block(s->info, s->nodes[i]);
189-
}
190188
}
191189

192190
int shadow_step(struct shadow_spine *s, dm_block_t b,

drivers/md/persistent-data/dm-space-map-disk.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ static int sm_disk_set_count(struct dm_space_map *sm, dm_block_t b,
9595
struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
9696

9797
r = sm_ll_insert(&smd->ll, b, count, &nr_allocations);
98-
if (!r) {
98+
if (!r)
9999
smd->nr_allocated_this_transaction += nr_allocations;
100-
}
101100

102101
return r;
103102
}
@@ -138,22 +137,20 @@ static int sm_disk_new_block(struct dm_space_map *sm, dm_block_t *b)
138137
* Any block we allocate has to be free in both the old and current ll.
139138
*/
140139
r = sm_ll_find_common_free_block(&smd->old_ll, &smd->ll, smd->begin, smd->ll.nr_blocks, b);
141-
if (r == -ENOSPC) {
140+
if (r == -ENOSPC)
142141
/*
143142
* There's no free block between smd->begin and the end of the metadata device.
144143
* We search before smd->begin in case something has been freed.
145144
*/
146145
r = sm_ll_find_common_free_block(&smd->old_ll, &smd->ll, 0, smd->begin, b);
147-
}
148146

149147
if (r)
150148
return r;
151149

152150
smd->begin = *b + 1;
153151
r = sm_ll_inc(&smd->ll, *b, *b + 1, &nr_allocations);
154-
if (!r) {
152+
if (!r)
155153
smd->nr_allocated_this_transaction += nr_allocations;
156-
}
157154

158155
return r;
159156
}

0 commit comments

Comments
 (0)