dm: fix trailing statements
authorHeinz Mauelshagen <heinzm@redhat.com>
Mon, 30 Jan 2023 21:13:54 +0000 (22:13 +0100)
committerMike Snitzer <snitzer@kernel.org>
Tue, 14 Feb 2023 19:23:06 +0000 (14:23 -0500)
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm-flakey.c
drivers/md/dm-integrity.c
drivers/md/dm-io.c
drivers/md/dm-snap-persistent.c
drivers/md/dm-snap.c
drivers/md/dm-table.c
drivers/md/dm-verity-target.c
drivers/md/dm-writecache.c

index 1f469161998e252c5a48a8aa58c57803c526e2ae..51116e9008e518f7ea48d3c614ba9fa785625c2d 100644 (file)
@@ -357,8 +357,7 @@ static int flakey_map(struct dm_target *ti, struct bio *bio)
                if (test_bit(DROP_WRITES, &fc->flags)) {
                        bio_endio(bio);
                        return DM_MAPIO_SUBMITTED;
-               }
-               else if (test_bit(ERROR_WRITES, &fc->flags)) {
+               } else if (test_bit(ERROR_WRITES, &fc->flags)) {
                        bio_io_error(bio);
                        return DM_MAPIO_SUBMITTED;
                }
index 46167422164eb9e3e132e16cfc8ca175c8bf15d0..524fecad05633ef1bde8faab8ec5ef16edc883f0 100644 (file)
@@ -679,16 +679,18 @@ repeat:
        } else if (mode == BITMAP_OP_CLEAR) {
                if (!bit && this_end_bit == PAGE_SIZE * 8 - 1)
                        clear_page(data);
-               else while (bit <= this_end_bit) {
-                       if (!(bit % BITS_PER_LONG) && this_end_bit >= bit + BITS_PER_LONG - 1) {
-                               do {
-                                       data[bit / BITS_PER_LONG] = 0;
-                                       bit += BITS_PER_LONG;
-                               } while (this_end_bit >= bit + BITS_PER_LONG - 1);
-                               continue;
+               else {
+                       while (bit <= this_end_bit) {
+                               if (!(bit % BITS_PER_LONG) && this_end_bit >= bit + BITS_PER_LONG - 1) {
+                                       do {
+                                               data[bit / BITS_PER_LONG] = 0;
+                                               bit += BITS_PER_LONG;
+                                       } while (this_end_bit >= bit + BITS_PER_LONG - 1);
+                                       continue;
+                               }
+                               __clear_bit(bit, data);
+                               bit++;
                        }
-                       __clear_bit(bit, data);
-                       bit++;
                }
        } else {
                BUG();
@@ -2010,23 +2012,23 @@ retry_kmap:
                                unsigned int tag_todo = ic->tag_size;
                                char *tag_ptr = journal_entry_tag(ic, je);
 
-                               if (bip) do {
-                                       struct bio_vec biv = bvec_iter_bvec(bip->bip_vec, bip->bip_iter);
-                                       unsigned int tag_now = min(biv.bv_len, tag_todo);
-                                       char *tag_addr;
-                                       BUG_ON(PageHighMem(biv.bv_page));
-                                       tag_addr = bvec_virt(&biv);
-                                       if (likely(dio->op == REQ_OP_WRITE))
-                                               memcpy(tag_ptr, tag_addr, tag_now);
-                                       else
-                                               memcpy(tag_addr, tag_ptr, tag_now);
-                                       bvec_iter_advance(bip->bip_vec, &bip->bip_iter, tag_now);
-                                       tag_ptr += tag_now;
-                                       tag_todo -= tag_now;
-                               } while (unlikely(tag_todo)); else {
-                                       if (likely(dio->op == REQ_OP_WRITE))
-                                               memset(tag_ptr, 0, tag_todo);
-                               }
+                               if (bip) {
+                                       do {
+                                               struct bio_vec biv = bvec_iter_bvec(bip->bip_vec, bip->bip_iter);
+                                               unsigned int tag_now = min(biv.bv_len, tag_todo);
+                                               char *tag_addr;
+                                               BUG_ON(PageHighMem(biv.bv_page));
+                                               tag_addr = bvec_virt(&biv);
+                                               if (likely(dio->op == REQ_OP_WRITE))
+                                                       memcpy(tag_ptr, tag_addr, tag_now);
+                                               else
+                                                       memcpy(tag_addr, tag_ptr, tag_now);
+                                               bvec_iter_advance(bip->bip_vec, &bip->bip_iter, tag_now);
+                                               tag_ptr += tag_now;
+                                               tag_todo -= tag_now;
+                                       } while (unlikely(tag_todo));
+                               } else if (likely(dio->op == REQ_OP_WRITE))
+                                       memset(tag_ptr, 0, tag_todo);
                        }
 
                        if (likely(dio->op == REQ_OP_WRITE)) {
index 628c5a13d010ea41fe228e5a211c0bedab0f3b4f..c7abcc2deca335cfa23da3bc123c0afa31b3a099 100644 (file)
@@ -359,18 +359,20 @@ static void do_region(const blk_opf_t opf, unsigned int region,
                        num_sectors = min_t(sector_t, special_cmd_max_sectors, remaining);
                        bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT;
                        remaining -= num_sectors;
-               } else while (remaining) {
-                       /*
-                        * Try and add as many pages as possible.
-                        */
-                       dp->get_page(dp, &page, &len, &offset);
-                       len = min(len, to_bytes(remaining));
-                       if (!bio_add_page(bio, page, len, offset))
-                               break;
-
-                       offset = 0;
-                       remaining -= to_sector(len);
-                       dp->next_page(dp);
+               } else {
+                       while (remaining) {
+                               /*
+                                * Try and add as many pages as possible.
+                                */
+                               dp->get_page(dp, &page, &len, &offset);
+                               len = min(len, to_bytes(remaining));
+                               if (!bio_add_page(bio, page, len, offset))
+                                       break;
+
+                               offset = 0;
+                               remaining -= to_sector(len);
+                               dp->next_page(dp);
+                       }
                }
 
                atomic_inc(&io->count);
index fde50b014f3a95e87cb3913c40478835f6131b6a..40efa1af692ca0dfc0ce21b6fb9cb166b72e258f 100644 (file)
@@ -518,15 +518,17 @@ static int read_exceptions(struct pstore *ps,
                if (unlikely(prefetch_area < ps->current_area))
                        prefetch_area = ps->current_area;
 
-               if (DM_PREFETCH_CHUNKS) do {
-                       chunk_t pf_chunk = area_location(ps, prefetch_area);
-                       if (unlikely(pf_chunk >= dm_bufio_get_device_size(client)))
-                               break;
-                       dm_bufio_prefetch(client, pf_chunk, 1);
-                       prefetch_area++;
-                       if (unlikely(!prefetch_area))
-                               break;
-               } while (prefetch_area <= ps->current_area + DM_PREFETCH_CHUNKS);
+               if (DM_PREFETCH_CHUNKS) {
+                       do {
+                               chunk_t pf_chunk = area_location(ps, prefetch_area);
+                               if (unlikely(pf_chunk >= dm_bufio_get_device_size(client)))
+                                       break;
+                               dm_bufio_prefetch(client, pf_chunk, 1);
+                               prefetch_area++;
+                               if (unlikely(!prefetch_area))
+                                       break;
+                       } while (prefetch_area <= ps->current_area + DM_PREFETCH_CHUNKS);
+               }
 
                chunk = area_location(ps, ps->current_area);
 
index 2896f733a0d00c28324ba2dc6e08988574330a2c..6078c5386afa63cacaa25cfb50dadd15d6375b8d 100644 (file)
@@ -2345,8 +2345,7 @@ static void snapshot_status(struct dm_target *ti, status_type_t type,
                                       (unsigned long long)sectors_allocated,
                                       (unsigned long long)total_sectors,
                                       (unsigned long long)metadata_sectors);
-                       }
-                       else
+                       } else
                                DMEMIT("Unknown");
                }
 
index 1a70ad3644e79b3735b037c7311d925b8f4e6c53..ead5cecd7781309843c8b5f34a7e52105fe16547 100644 (file)
@@ -1974,8 +1974,7 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
                blk_queue_flag_set(QUEUE_FLAG_DAX, q);
                if (dm_table_supports_dax(t, device_not_dax_synchronous_capable))
                        set_dax_synchronous(t->md->dax_dev);
-       }
-       else
+       } else
                blk_queue_flag_clear(QUEUE_FLAG_DAX, q);
 
        if (dm_table_any_dev_attr(t, device_dax_write_cache_enabled, NULL))
index c9d937053910e04031d3faedac180660a181f838..99a5b0dc99afa2206e1ee844bccfb705c9fa5dc4 100644 (file)
@@ -332,10 +332,8 @@ static int verity_verify_level(struct dm_verity *v, struct dm_verity_io *io,
                         */
                        r = -EAGAIN;
                        goto release_ret_r;
-               }
-               else if (verity_fec_decode(v, io,
-                                          DM_VERITY_BLOCK_TYPE_METADATA,
-                                          hash_block, data, NULL) == 0)
+               } else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_METADATA,
+                                            hash_block, data, NULL) == 0)
                        aux->hash_verified = 1;
                else if (verity_handle_err(v,
                                           DM_VERITY_BLOCK_TYPE_METADATA,
index 738533b82b1e5c1f46b71d8244bf236ac7e98a99..055b18e320cdb394ba0f169af2f3e6ad2897e2cc 100644 (file)
@@ -941,7 +941,8 @@ static void writecache_suspend(struct dm_target *ti)
        wc_lock(wc);
        if (flush_on_suspend)
                wc->writeback_all--;
-       while (writecache_wait_for_writeback(wc));
+       while (writecache_wait_for_writeback(wc))
+               ;
 
        if (WC_MODE_PMEM(wc))
                persistent_memory_flush_cache(wc->memory_map, wc->memory_map_size);
@@ -2090,7 +2091,8 @@ restart:
 
        if (unlikely(wc->writeback_all)) {
                wc_lock(wc);
-               while (writecache_wait_for_writeback(wc));
+               while (writecache_wait_for_writeback(wc))
+                       ;
                wc_unlock(wc);
        }
 }
@@ -2448,12 +2450,14 @@ static int writecache_ctr(struct dm_target *ti, unsigned int argc, char **argv)
                        if (WC_MODE_PMEM(wc)) {
                                wc->writeback_fua = true;
                                wc->writeback_fua_set = true;
-                       } else goto invalid_optional;
+                       } else
+                               goto invalid_optional;
                } else if (!strcasecmp(string, "nofua")) {
                        if (WC_MODE_PMEM(wc)) {
                                wc->writeback_fua = false;
                                wc->writeback_fua_set = true;
-                       } else goto invalid_optional;
+                       } else
+                               goto invalid_optional;
                } else if (!strcasecmp(string, "metadata_only")) {
                        wc->metadata_only = true;
                } else if (!strcasecmp(string, "pause_writeback") && opt_params >= 1) {