Commit 2d0f25cb authored by Heinz Mauelshagen's avatar Heinz Mauelshagen Committed by Mike Snitzer

dm: remove unnecessary braces from single statement blocks

Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
parent 0ef0b471
......@@ -630,11 +630,10 @@ static bool block_bitmap_op(struct dm_integrity_c *ic, struct page_list *bitmap,
end_bit %= PAGE_SIZE * 8;
repeat:
if (page < end_page) {
if (page < end_page)
this_end_bit = PAGE_SIZE * 8 - 1;
} else {
else
this_end_bit = end_bit;
}
data = lowmem_page_address(bitmap[page].page);
......@@ -1251,13 +1250,12 @@ static bool add_new_range(struct dm_integrity_c *ic, struct dm_integrity_range *
struct dm_integrity_range *range = container_of(*n, struct dm_integrity_range, node);
parent = *n;
if (new_range->logical_sector + new_range->n_sectors <= range->logical_sector) {
if (new_range->logical_sector + new_range->n_sectors <= range->logical_sector)
n = &range->node.rb_left;
} else if (new_range->logical_sector >= range->logical_sector + range->n_sectors) {
else if (new_range->logical_sector >= range->logical_sector + range->n_sectors)
n = &range->node.rb_right;
} else {
else
return false;
}
}
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
while (n) {
struct journal_node *j = container_of(n, struct journal_node, node);
if (sector == j->sector) {
if (sector == j->sector)
found = j - ic->journal_tree;
}
if (sector < j->sector) {
*next_sector = j->sector;
n = j->node.rb_left;
} else {
} else
n = j->node.rb_right;
}
}
return found;
......@@ -1501,9 +1498,8 @@ static int dm_integrity_rw_tag(struct dm_integrity_c *ic, unsigned char *tag, se
*metadata_offset = 0;
}
if (unlikely(!is_power_of_2(ic->tag_size))) {
if (unlikely(!is_power_of_2(ic->tag_size)))
hash_offset = (hash_offset + to_copy) % ic->tag_size;
}
total_size -= to_copy;
} while (unlikely(total_size));
......@@ -2104,14 +2100,12 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio,
smp_mb();
if (unlikely(waitqueue_active(&ic->copy_to_journal_wait)))
wake_up(&ic->copy_to_journal_wait);
if (READ_ONCE(ic->free_sectors) <= ic->free_sectors_threshold) {
if (READ_ONCE(ic->free_sectors) <= ic->free_sectors_threshold)
queue_work(ic->commit_wq, &ic->commit_work);
} else {
else
schedule_autocommit(ic);
}
} else {
} else
remove_range(ic, &dio->range);
}
if (unlikely(bio->bi_iter.bi_size)) {
sector_t area, offset;
......@@ -2569,9 +2563,8 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned int write_start
mempool_free(io, &ic->journal_io_mempool);
goto skip_io;
}
for (l = j; l < k; l++) {
for (l = j; l < k; l++)
remove_journal_node(ic, &section_node[l]);
}
}
spin_unlock_irq(&ic->endio_wait.lock);
......@@ -2598,9 +2591,8 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned int write_start
journal_entry_set_unused(je2);
r = dm_integrity_rw_tag(ic, journal_entry_tag(ic, je2), &metadata_block, &metadata_offset,
ic->tag_size, TAG_WRITE);
if (unlikely(r)) {
if (unlikely(r))
dm_integrity_io_error(ic, "reading tags", r);
}
}
atomic_inc(&comp.in_flight);
......@@ -2711,9 +2703,9 @@ static void integrity_recalc(struct work_struct *w)
n_sectors = range.n_sectors;
if (ic->mode == 'B') {
if (block_bitmap_op(ic, ic->recalc_bitmap, logical_sector, n_sectors, BITMAP_OP_TEST_ALL_CLEAR)) {
if (block_bitmap_op(ic, ic->recalc_bitmap, logical_sector, n_sectors, BITMAP_OP_TEST_ALL_CLEAR))
goto advance_and_next;
}
while (block_bitmap_op(ic, ic->recalc_bitmap, logical_sector,
ic->sectors_per_block, BITMAP_OP_TEST_ALL_CLEAR)) {
logical_sector += ic->sectors_per_block;
......@@ -2732,9 +2724,9 @@ static void integrity_recalc(struct work_struct *w)
if (unlikely(++super_counter == RECALC_WRITE_SUPER)) {
recalc_write_super(ic);
if (ic->mode == 'B') {
if (ic->mode == 'B')
queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, ic->bitmap_flush_interval);
}
super_counter = 0;
}
......@@ -4417,9 +4409,9 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv
log2_blocks_per_bitmap_bit = log2_sectors_per_bitmap_bit - ic->sb->log2_sectors_per_block;
ic->log2_blocks_per_bitmap_bit = log2_blocks_per_bitmap_bit;
if (should_write_sb) {
if (should_write_sb)
ic->sb->log2_blocks_per_bitmap_bit = log2_blocks_per_bitmap_bit;
}
n_bitmap_bits = ((ic->provided_data_sectors >> ic->sb->log2_sectors_per_block)
+ (((sector_t)1 << log2_blocks_per_bitmap_bit) - 1)) >> log2_blocks_per_bitmap_bit;
ic->n_bitmap_blocks = DIV_ROUND_UP(n_bitmap_bits, BITMAP_BLOCK_SIZE * 8);
......
......@@ -601,12 +601,10 @@ static void dm_stat_for_entry(struct dm_stat *s, size_t entry,
while (lo + 1 < hi) {
unsigned int mid = (lo + hi) / 2;
if (s->histogram_boundaries[mid - 1] > duration) {
if (s->histogram_boundaries[mid - 1] > duration)
hi = mid;
} else {
else
lo = mid;
}
}
p->histogram[lo]++;
}
......@@ -900,9 +898,8 @@ static int dm_stats_print(struct dm_stats *stats, int id,
if (s->n_histogram_entries) {
unsigned int i;
for (i = 0; i < s->n_histogram_entries + 1; i++) {
for (i = 0; i < s->n_histogram_entries + 1; i++)
DMEMIT("%s%llu", !i ? " " : ":", shared->tmp.histogram[i]);
}
}
DMEMIT("\n");
......
......@@ -369,14 +369,12 @@ static void stripe_status(struct dm_target *ti, status_type_t type,
switch (type) {
case STATUSTYPE_INFO:
DMEMIT("%d ", sc->stripes);
for (i = 0; i < sc->stripes; i++) {
for (i = 0; i < sc->stripes; i++)
DMEMIT("%s ", sc->stripe[i].dev->name);
}
DMEMIT("1 ");
for (i = 0; i < sc->stripes; i++) {
DMEMIT("%c", atomic_read(&(sc->stripe[i].error_count)) ?
'D' : 'A');
}
for (i = 0; i < sc->stripes; i++)
DMEMIT("%c", atomic_read(&(sc->stripe[i].error_count)) ? 'D' : 'A');
break;
case STATUSTYPE_TABLE:
......
......@@ -1536,9 +1536,9 @@ static int __find_block(struct dm_thin_device *td, dm_block_t block,
dm_block_t keys[2] = { td->id, block };
struct dm_btree_info *info;
if (can_issue_io) {
if (can_issue_io)
info = &pmd->info;
} else
else
info = &pmd->nb_info;
r = dm_btree_lookup(info, pmd->root, keys, &value);
......
......@@ -1984,9 +1984,8 @@ static void writecache_writeback(struct work_struct *work)
goto restart;
}
if (wc->overwrote_committed) {
if (wc->overwrote_committed)
writecache_wait_for_ios(wc, WRITE);
}
n_walked = 0;
INIT_LIST_HEAD(&skipped);
......@@ -2015,9 +2014,9 @@ static void writecache_writeback(struct work_struct *work)
} else
e = container_of(wc->lru.prev, struct wc_entry, lru);
BUG_ON(e->write_in_progress);
if (unlikely(!writecache_entry_is_committed(wc, e))) {
if (unlikely(!writecache_entry_is_committed(wc, e)))
writecache_flush(wc);
}
node = rb_prev(&e->rb_node);
if (node) {
f = container_of(node, struct wc_entry, rb_node);
......
......@@ -133,9 +133,8 @@ void exit_ro_spine(struct ro_spine *s)
{
int i;
for (i = 0; i < s->count; i++) {
for (i = 0; i < s->count; i++)
unlock_block(s->info, s->nodes[i]);
}
}
int ro_step(struct ro_spine *s, dm_block_t new_child)
......@@ -184,9 +183,8 @@ void exit_shadow_spine(struct shadow_spine *s)
{
int i;
for (i = 0; i < s->count; i++) {
for (i = 0; i < s->count; i++)
unlock_block(s->info, s->nodes[i]);
}
}
int shadow_step(struct shadow_spine *s, dm_block_t b,
......
......@@ -95,9 +95,8 @@ static int sm_disk_set_count(struct dm_space_map *sm, dm_block_t b,
struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
r = sm_ll_insert(&smd->ll, b, count, &nr_allocations);
if (!r) {
if (!r)
smd->nr_allocated_this_transaction += nr_allocations;
}
return r;
}
......@@ -138,22 +137,20 @@ static int sm_disk_new_block(struct dm_space_map *sm, dm_block_t *b)
* Any block we allocate has to be free in both the old and current ll.
*/
r = sm_ll_find_common_free_block(&smd->old_ll, &smd->ll, smd->begin, smd->ll.nr_blocks, b);
if (r == -ENOSPC) {
if (r == -ENOSPC)
/*
* There's no free block between smd->begin and the end of the metadata device.
* We search before smd->begin in case something has been freed.
*/
r = sm_ll_find_common_free_block(&smd->old_ll, &smd->ll, 0, smd->begin, b);
}
if (r)
return r;
smd->begin = *b + 1;
r = sm_ll_inc(&smd->ll, *b, *b + 1, &nr_allocations);
if (!r) {
if (!r)
smd->nr_allocated_this_transaction += nr_allocations;
}
return r;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment