Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm: add missing empty lines

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>

authored by

Heinz Mauelshagen and committed by
Mike Snitzer
0ef0b471 02f10ba1

+240 -27
+9
drivers/md/dm-bufio.c
··· 628 628 { 629 629 struct dm_buffer *b = bio->bi_private; 630 630 blk_status_t status = bio->bi_status; 631 + 631 632 bio_uninit(bio); 632 633 kfree(bio); 633 634 b->end_io(b, status); ··· 661 660 662 661 do { 663 662 unsigned int this_step = min((unsigned int)(PAGE_SIZE - offset_in_page(ptr)), len); 663 + 664 664 if (!bio_add_page(bio, virt_to_page(ptr), this_step, 665 665 offset_in_page(ptr))) { 666 666 bio_put(bio); ··· 784 782 static void __flush_write_list(struct list_head *write_list) 785 783 { 786 784 struct blk_plug plug; 785 + 787 786 blk_start_plug(&plug); 788 787 while (!list_empty(write_list)) { 789 788 struct dm_buffer *b = ··· 1182 1179 for (; n_blocks--; block++) { 1183 1180 int need_submit; 1184 1181 struct dm_buffer *b; 1182 + 1185 1183 b = __bufio_new(c, block, NF_PREFETCH, &need_submit, 1186 1184 &write_list); 1187 1185 if (unlikely(!list_empty(&write_list))) { ··· 1467 1463 __link_buffer(b, new_block, LIST_DIRTY); 1468 1464 } else { 1469 1465 sector_t old_block; 1466 + 1470 1467 wait_on_bit_lock_io(&b->state, B_WRITING, 1471 1468 TASK_UNINTERRUPTIBLE); 1472 1469 /* ··· 1558 1553 sector_t dm_bufio_get_device_size(struct dm_bufio_client *c) 1559 1554 { 1560 1555 sector_t s = bdev_nr_sectors(c->bdev); 1556 + 1561 1557 if (s >= c->start) 1562 1558 s -= c->start; 1563 1559 else ··· 1674 1668 static unsigned long get_retain_buffers(struct dm_bufio_client *c) 1675 1669 { 1676 1670 unsigned long retain_bytes = READ_ONCE(dm_bufio_retain_bytes); 1671 + 1677 1672 if (likely(c->sectors_per_block_bits >= 0)) 1678 1673 retain_bytes >>= c->sectors_per_block_bits + SECTOR_SHIFT; 1679 1674 else 1680 1675 retain_bytes /= c->block_size; 1676 + 1681 1677 return retain_bytes; 1682 1678 } 1683 1679 ··· 1814 1806 if (block_size <= KMALLOC_MAX_SIZE && 1815 1807 (block_size < PAGE_SIZE || !is_power_of_2(block_size))) { 1816 1808 unsigned int align = min(1U << __ffs(block_size), (unsigned int)PAGE_SIZE); 1809 + 1817 1810 snprintf(slab_name, sizeof slab_name, "dm_bufio_cache-%u", block_size); 1818 1811 c->slab_cache = kmem_cache_create(slab_name, block_size, align, 1819 1812 SLAB_RECLAIM_ACCOUNT, NULL);
+6
drivers/md/dm-cache-metadata.c
··· 535 535 bool may_format_device) 536 536 { 537 537 int r; 538 + 538 539 cmd->bm = dm_block_manager_create(cmd->bdev, DM_CACHE_METADATA_BLOCK_SIZE << SECTOR_SHIFT, 539 540 CACHE_MAX_CONCURRENT_LOCKS); 540 541 if (IS_ERR(cmd->bm)) { ··· 569 568 flags_mutator mutator) 570 569 { 571 570 uint32_t sb_flags = mutator(le32_to_cpu(disk_super->flags)); 571 + 572 572 disk_super->flags = cpu_to_le32(sb_flags); 573 573 } 574 574 ··· 734 732 static __le64 pack_value(dm_oblock_t block, unsigned int flags) 735 733 { 736 734 uint64_t value = from_oblock(block); 735 + 737 736 value <<= 16; 738 737 value = value | (flags & FLAGS_MASK); 739 738 return cpu_to_le64(value); ··· 744 741 { 745 742 uint64_t value = le64_to_cpu(value_le); 746 743 uint64_t b = value >> 16; 744 + 747 745 *block = to_oblock(b); 748 746 *flags = value & FLAGS_MASK; 749 747 } ··· 1258 1254 { 1259 1255 int r; 1260 1256 __le64 value = pack_value(oblock, M_VALID); 1257 + 1261 1258 __dm_bless_for_disk(&value); 1262 1259 1263 1260 r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock), ··· 1585 1580 { 1586 1581 int r; 1587 1582 unsigned int i; 1583 + 1588 1584 for (i = 0; i < nr_bits; i++) { 1589 1585 r = __dirty(cmd, to_cblock(i), test_bit(i, bits)); 1590 1586 if (r)
+3
drivers/md/dm-cache-policy-internal.h
··· 89 89 unsigned int maxlen, ssize_t *sz_ptr) 90 90 { 91 91 ssize_t sz = *sz_ptr; 92 + 92 93 if (p->emit_config_values) 93 94 return p->emit_config_values(p, result, maxlen, sz_ptr); 94 95 ··· 122 121 static inline unsigned long *alloc_bitset(unsigned int nr_entries) 123 122 { 124 123 size_t s = bitset_size_in_bytes(nr_entries); 124 + 125 125 return vzalloc(s); 126 126 } 127 127 128 128 static inline void clear_bitset(void *bitset, unsigned int nr_entries) 129 129 { 130 130 size_t s = bitset_size_in_bytes(nr_entries); 131 + 131 132 memset(bitset, 0, s); 132 133 } 133 134
+2
drivers/md/dm-cache-policy-smq.c
··· 624 624 static void h_insert(struct smq_hash_table *ht, struct entry *e) 625 625 { 626 626 unsigned int h = hash_64(from_oblock(e->oblock), ht->hash_bits); 627 + 627 628 __h_insert(ht, h, e); 628 629 } 629 630 ··· 1634 1633 static void smq_allow_migrations(struct dm_cache_policy *p, bool allow) 1635 1634 { 1636 1635 struct smq_policy *mq = to_smq_policy(p); 1636 + 1637 1637 mq->migrations_allowed = allow; 1638 1638 } 1639 1639
+11 -1
drivers/md/dm-cache-target.c
··· 534 534 static struct per_bio_data *get_per_bio_data(struct bio *bio) 535 535 { 536 536 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); 537 + 537 538 BUG_ON(!pb); 538 539 return pb; 539 540 } ··· 691 690 static bool is_discarded(struct cache *cache, dm_dblock_t b) 692 691 { 693 692 int r; 693 + 694 694 spin_lock_irq(&cache->lock); 695 695 r = test_bit(from_dblock(b), cache->discard_bitset); 696 696 spin_unlock_irq(&cache->lock); ··· 702 700 static bool is_discarded_oblock(struct cache *cache, dm_oblock_t b) 703 701 { 704 702 int r; 703 + 705 704 spin_lock_irq(&cache->lock); 706 705 r = test_bit(from_dblock(oblock_to_dblock(cache, b)), 707 706 cache->discard_bitset); ··· 817 814 static void issue_op(struct bio *bio, void *context) 818 815 { 819 816 struct cache *cache = context; 817 + 820 818 accounted_request(cache, bio); 821 819 } 822 820 ··· 1078 1074 static struct dm_cache_migration *ws_to_mg(struct work_struct *ws) 1079 1075 { 1080 1076 struct continuation *k = container_of(ws, struct continuation, ws); 1077 + 1081 1078 return container_of(k, struct dm_cache_migration, k); 1082 1079 } 1083 1080 ··· 1230 1225 static void mg_success(struct work_struct *ws) 1231 1226 { 1232 1227 struct dm_cache_migration *mg = ws_to_mg(ws); 1228 + 1233 1229 mg_complete(mg, mg->k.input == 0); 1234 1230 } 1235 1231 ··· 1369 1363 * Fallback to a real full copy after doing some tidying up. 1370 1364 */ 1371 1365 bool rb = bio_detain_shared(mg->cache, mg->op->oblock, mg->overwrite_bio); 1366 + 1372 1367 BUG_ON(rb); /* An exclussive lock must _not_ be held for this block */ 1373 1368 mg->overwrite_bio = NULL; 1374 1369 inc_io_migrations(mg->cache); ··· 1472 1465 static void invalidate_completed(struct work_struct *ws) 1473 1466 { 1474 1467 struct dm_cache_migration *mg = ws_to_mg(ws); 1468 + 1475 1469 invalidate_complete(mg, !mg->k.input); 1476 1470 } 1477 1471 1478 1472 static int invalidate_cblock(struct cache *cache, dm_cblock_t cblock) 1479 1473 { 1480 - int r = policy_invalidate_mapping(cache->policy, cblock); 1474 + int r; 1475 + 1476 + r = policy_invalidate_mapping(cache->policy, cblock); 1481 1477 if (!r) { 1482 1478 r = dm_cache_remove_mapping(cache->cmd, cblock); 1483 1479 if (r) {
+3
drivers/md/dm-crypt.c
··· 1257 1257 struct dm_crypt_request *dmreq) 1258 1258 { 1259 1259 u8 *ptr = iv_of_dmreq(cc, dmreq) + cc->iv_size + cc->iv_size; 1260 + 1260 1261 return (__le64 *) ptr; 1261 1262 } 1262 1263 ··· 1266 1265 { 1267 1266 u8 *ptr = iv_of_dmreq(cc, dmreq) + cc->iv_size + 1268 1267 cc->iv_size + sizeof(uint64_t); 1268 + 1269 1269 return (unsigned int *)ptr; 1270 1270 } 1271 1271 ··· 1743 1741 static void kcryptd_io_bio_endio(struct work_struct *work) 1744 1742 { 1745 1743 struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); 1744 + 1746 1745 bio_endio(io->base_bio); 1747 1746 } 1748 1747
+8 -2
drivers/md/dm-era-target.c
··· 112 112 struct writeset_metadata *m, dm_block_t block, 113 113 bool *result) 114 114 { 115 + int r; 115 116 dm_block_t old = m->root; 116 117 117 118 /* 118 119 * The bitset was flushed when it was archived, so we know there'll 119 120 * be no change to the root. 120 121 */ 121 - int r = dm_bitset_test_bit(info, m->root, block, &m->root, result); 122 + r = dm_bitset_test_bit(info, m->root, block, &m->root, result); 122 123 if (r) { 123 124 DMERR("%s: dm_bitset_test_bit failed", __func__); 124 125 return r; ··· 211 210 static int check_metadata_version(struct superblock_disk *disk) 212 211 { 213 212 uint32_t metadata_version = le32_to_cpu(disk->version); 213 + 214 214 if (metadata_version < MIN_ERA_VERSION || metadata_version > MAX_ERA_VERSION) { 215 215 DMERR("Era metadata version %u found, but only versions between %u and %u supported.", 216 216 metadata_version, MIN_ERA_VERSION, MAX_ERA_VERSION); ··· 411 409 static void setup_writeset_tree_info(struct era_metadata *md) 412 410 { 413 411 struct dm_btree_value_type *vt = &md->writeset_tree_info.value_type; 412 + 414 413 md->writeset_tree_info.tm = md->tm; 415 414 md->writeset_tree_info.levels = 1; 416 415 vt->context = md; ··· 422 419 } 423 420 424 421 static void setup_era_array_info(struct era_metadata *md) 425 - 426 422 { 427 423 struct dm_btree_value_type vt; 424 + 428 425 vt.context = NULL; 429 426 vt.size = sizeof(__le32); 430 427 vt.inc = NULL; ··· 1394 1391 static int in_worker0(struct era *era, int (*fn)(struct era_metadata *md)) 1395 1392 { 1396 1393 struct rpc rpc; 1394 + 1397 1395 rpc.fn0 = fn; 1398 1396 rpc.fn1 = NULL; 1399 1397 ··· 1405 1401 int (*fn)(struct era_metadata *md, void *ref), void *arg) 1406 1402 { 1407 1403 struct rpc rpc; 1404 + 1408 1405 rpc.fn0 = NULL; 1409 1406 rpc.fn1 = fn; 1410 1407 rpc.arg = arg; ··· 1717 1712 iterate_devices_callout_fn fn, void *data) 1718 1713 { 1719 1714 struct era *era = ti->private; 1715 + 1720 1716 return fn(ti, era->origin_dev, 0, get_dev_size(era->origin_dev), data); 1721 1717 } 1722 1718
+1
drivers/md/dm-flakey.c
··· 327 327 struct flakey_c *fc = ti->private; 328 328 unsigned int elapsed; 329 329 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); 330 + 330 331 pb->bio_submitted = false; 331 332 332 333 if (op_is_zone_mgmt(bio_op(bio)))
+71 -8
drivers/md/dm-integrity.c
··· 346 346 static void __DEBUG_bytes(__u8 *bytes, size_t len, const char *msg, ...) 347 347 { 348 348 va_list args; 349 + 349 350 va_start(args, msg); 350 351 vprintk(msg, args); 351 352 va_end(args); ··· 539 538 } 540 539 } else { 541 540 __u8 result[HASH_MAX_DIGESTSIZE]; 541 + 542 542 r = crypto_shash_final(desc, result); 543 543 if (unlikely(r < 0)) { 544 544 dm_integrity_io_error(ic, "crypto_shash_final", r); ··· 715 713 for (i = 0; i < n_bitmap_pages; i++) { 716 714 unsigned long *dst_data = lowmem_page_address(dst[i].page); 717 715 unsigned long *src_data = lowmem_page_address(src[i].page); 716 + 718 717 copy_page(dst_data, src_data); 719 718 } 720 719 } ··· 836 833 837 834 for (j = 0; j < ic->journal_section_entries; j++) { 838 835 struct journal_entry *je = access_journal_entry(ic, section, j); 836 + 839 837 r = crypto_shash_update(desc, (__u8 *)&je->u.sector, sizeof je->u.sector); 840 838 if (unlikely(r < 0)) { 841 839 dm_integrity_io_error(ic, "crypto_shash_update", r); ··· 900 896 static void complete_journal_op(void *context) 901 897 { 902 898 struct journal_completion *comp = context; 899 + 903 900 BUG_ON(!atomic_read(&comp->in_flight)); 904 901 if (likely(atomic_dec_and_test(&comp->in_flight))) 905 902 complete(&comp->comp); ··· 937 932 938 933 while (unlikely(pl_index == section_index)) { 939 934 unsigned int dummy; 935 + 940 936 if (likely(encrypt)) 941 937 rw_section_mac(ic, section, true); 942 938 section++; ··· 967 961 static void complete_journal_encrypt(struct crypto_async_request *req, int err) 968 962 { 969 963 struct journal_completion *comp = req->data; 964 + 970 965 if (unlikely(err)) { 971 966 if (likely(err == -EINPROGRESS)) { 972 967 complete(&comp->ic->crypto_backoff); ··· 981 974 static bool do_crypt(bool encrypt, struct skcipher_request *req, struct journal_completion *comp) 982 975 { 983 976 int r; 977 + 984 978 skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, 985 979 complete_journal_encrypt, comp); 986 980 if (likely(encrypt)) ··· 1057 1049 static void complete_journal_io(unsigned long error, void *context) 1058 1050 { 1059 1051 struct journal_completion *comp = context; 1052 + 1060 1053 if (unlikely(error != 0)) 1061 1054 dm_integrity_io_error(comp->ic, "writing journal", -EIO); 1062 1055 complete_journal_op(comp); ··· 1148 1139 commit_sections, &io_comp); 1149 1140 } else { 1150 1141 unsigned int to_end; 1142 + 1151 1143 io_comp.in_flight = (atomic_t)ATOMIC_INIT(2); 1152 1144 to_end = ic->journal_sections - commit_start; 1153 1145 if (ic->journal_io) { ··· 1238 1228 1239 1229 if (likely(check_waiting)) { 1240 1230 struct dm_integrity_range *range; 1231 + 1241 1232 list_for_each_entry(range, &ic->wait_list, wait_entry) { 1242 1233 if (unlikely(ranges_overlap(range, new_range))) 1243 1234 return false; ··· 1273 1262 struct dm_integrity_range *last_range = 1274 1263 list_first_entry(&ic->wait_list, struct dm_integrity_range, wait_entry); 1275 1264 struct task_struct *last_range_task; 1265 + 1276 1266 last_range_task = last_range->task; 1277 1267 list_del(&last_range->wait_entry); 1278 1268 if (!add_new_range(ic, last_range, false)) { ··· 1333 1321 1334 1322 while (*link) { 1335 1323 struct journal_node *j; 1324 + 1336 1325 parent = *link; 1337 1326 j = container_of(parent, struct journal_node, node); 1338 1327 if (sector < j->sector) ··· 1359 1346 { 1360 1347 struct rb_node *n = ic->journal_tree_root.rb_node; 1361 1348 unsigned int found = NOT_FOUND; 1349 + 1362 1350 *next_sector = (sector_t)-1; 1363 1351 while (n) { 1364 1352 struct journal_node *j = container_of(n, struct journal_node, node); 1353 + 1365 1354 if (sector == j->sector) { 1366 1355 found = j - ic->journal_tree; 1367 1356 } ··· 1523 1508 static void flush_notify(unsigned long error, void *fr_) 1524 1509 { 1525 1510 struct flush_request *fr = fr_; 1511 + 1526 1512 if (unlikely(error != 0)) 1527 1513 dm_integrity_io_error(fr->ic, "flushing disk cache", -EIO); 1528 1514 complete(&fr->comp); ··· 1532 1516 static void dm_integrity_flush_buffers(struct dm_integrity_c *ic, bool flush_data) 1533 1517 { 1534 1518 int r; 1535 - 1536 1519 struct flush_request fr; 1537 1520 1538 1521 if (!ic->meta_dev) ··· 1563 1548 static void sleep_on_endio_wait(struct dm_integrity_c *ic) 1564 1549 { 1565 1550 DECLARE_WAITQUEUE(wait, current); 1551 + 1566 1552 __add_wait_queue(&ic->endio_wait, &wait); 1567 1553 __set_current_state(TASK_UNINTERRUPTIBLE); 1568 1554 spin_unlock_irq(&ic->endio_wait.lock); ··· 1601 1585 1602 1586 static void do_endio(struct dm_integrity_c *ic, struct bio *bio) 1603 1587 { 1604 - int r = dm_integrity_failed(ic); 1588 + int r; 1589 + 1590 + r = dm_integrity_failed(ic); 1605 1591 if (unlikely(r) && !bio->bi_status) 1606 1592 bio->bi_status = errno_to_blk_status(r); 1607 1593 if (unlikely(ic->synchronous_mode) && bio_op(bio) == REQ_OP_WRITE) { 1608 1594 unsigned long flags; 1595 + 1609 1596 spin_lock_irqsave(&ic->endio_wait.lock, flags); 1610 1597 bio_list_add(&ic->synchronous_bios, bio); 1611 1598 queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0); ··· 1640 1621 schedule_autocommit(ic); 1641 1622 1642 1623 bio = dm_bio_from_per_bio_data(dio, sizeof(struct dm_integrity_io)); 1643 - 1644 1624 if (unlikely(dio->bi_status) && !bio->bi_status) 1645 1625 bio->bi_status = dio->bi_status; 1646 1626 if (likely(!bio->bi_status) && unlikely(bio_sectors(bio) != dio->range.n_sectors)) { ··· 1759 1741 unsigned int bi_size = dio->bio_details.bi_iter.bi_size; 1760 1742 unsigned int max_size = likely(checksums != checksums_onstack) ? PAGE_SIZE : HASH_MAX_DIGESTSIZE; 1761 1743 unsigned int max_blocks = max_size / ic->tag_size; 1744 + 1762 1745 memset(checksums, DISCARD_FILLER, max_size); 1763 1746 1764 1747 while (bi_size) { 1765 1748 unsigned int this_step_blocks = bi_size >> (SECTOR_SHIFT + ic->sb->log2_sectors_per_block); 1749 + 1766 1750 this_step_blocks = min(this_step_blocks, max_blocks); 1767 1751 r = dm_integrity_rw_tag(ic, checksums, &dio->metadata_block, &dio->metadata_offset, 1768 1752 this_step_blocks * ic->tag_size, TAG_WRITE); ··· 1840 1820 struct bio_vec biv; 1841 1821 struct bvec_iter iter; 1842 1822 unsigned int data_to_process = dio->range.n_sectors; 1823 + 1843 1824 sector_to_block(ic, data_to_process); 1844 1825 data_to_process *= ic->tag_size; 1845 1826 ··· 1887 1866 unsigned int log2_max_io_len = __fls(ti->max_io_len); 1888 1867 sector_t start_boundary = sec >> log2_max_io_len; 1889 1868 sector_t end_boundary = (sec + bio_sectors(bio) - 1) >> log2_max_io_len; 1869 + 1890 1870 if (start_boundary < end_boundary) { 1891 1871 sector_t len = ti->max_io_len - (sec & (ti->max_io_len - 1)); 1872 + 1892 1873 dm_accept_partial_bio(bio, len); 1893 1874 } 1894 1875 } ··· 1926 1903 if (ic->sectors_per_block > 1 && likely(dio->op != REQ_OP_DISCARD)) { 1927 1904 struct bvec_iter iter; 1928 1905 struct bio_vec bv; 1906 + 1929 1907 bio_for_each_segment(bv, bio, iter) { 1930 1908 if (unlikely(bv.bv_len & ((ic->sectors_per_block << SECTOR_SHIFT) - 1))) { 1931 1909 DMERR("Bio vector (%u,%u) is not aligned on %u-sector boundary", ··· 1940 1916 if (!ic->internal_hash) { 1941 1917 if (bip) { 1942 1918 unsigned int wanted_tag_size = bio_sectors(bio) >> ic->sb->log2_sectors_per_block; 1919 + 1943 1920 if (ic->log2_tag_size >= 0) 1944 1921 wanted_tag_size <<= ic->log2_tag_size; 1945 1922 else ··· 2042 2017 struct bio_vec biv = bvec_iter_bvec(bip->bip_vec, bip->bip_iter); 2043 2018 unsigned int tag_now = min(biv.bv_len, tag_todo); 2044 2019 char *tag_addr; 2020 + 2045 2021 BUG_ON(PageHighMem(biv.bv_page)); 2046 2022 tag_addr = bvec_virt(&biv); 2047 2023 if (likely(dio->op == REQ_OP_WRITE)) ··· 2071 2045 2072 2046 if (ic->internal_hash) { 2073 2047 unsigned int digest_size = crypto_shash_digestsize(ic->internal_hash); 2048 + 2074 2049 if (unlikely(digest_size > ic->tag_size)) { 2075 2050 char checksums_onstack[HASH_MAX_DIGESTSIZE]; 2051 + 2076 2052 integrity_sector_checksum(ic, logical_sector, (char *)js, checksums_onstack); 2077 2053 memcpy(journal_entry_tag(ic, je), checksums_onstack, ic->tag_size); 2078 2054 } else ··· 2134 2106 struct completion read_comp; 2135 2107 bool discard_retried = false; 2136 2108 bool need_sync_io = ic->internal_hash && dio->op == REQ_OP_READ; 2109 + 2137 2110 if (unlikely(dio->op == REQ_OP_DISCARD) && ic->mode != 'D') 2138 2111 need_sync_io = true; 2139 2112 ··· 2205 2176 goto journal_read_write; 2206 2177 } else { 2207 2178 sector_t next_sector; 2179 + 2208 2180 journal_read_pos = find_journal_node(ic, dio->range.logical_sector, &next_sector); 2209 2181 if (likely(journal_read_pos == NOT_FOUND)) { 2210 2182 if (unlikely(dio->range.n_sectors > next_sector - dio->range.logical_sector)) ··· 2213 2183 } else { 2214 2184 unsigned int i; 2215 2185 unsigned int jp = journal_read_pos + 1; 2186 + 2216 2187 for (i = ic->sectors_per_block; i < dio->range.n_sectors; i += ic->sectors_per_block, jp++) { 2217 2188 if (!test_journal_node(ic, jp, dio->range.logical_sector + i)) 2218 2189 break; ··· 2245 2214 */ 2246 2215 if (journal_read_pos != NOT_FOUND) { 2247 2216 sector_t next_sector; 2248 - unsigned int new_pos = find_journal_node(ic, dio->range.logical_sector, &next_sector); 2217 + unsigned int new_pos; 2218 + 2219 + new_pos = find_journal_node(ic, dio->range.logical_sector, &next_sector); 2249 2220 if (unlikely(new_pos != journal_read_pos)) { 2250 2221 remove_range_unlocked(ic, &dio->range); 2251 2222 goto retry; ··· 2256 2223 } 2257 2224 if (ic->mode == 'J' && likely(dio->op == REQ_OP_DISCARD) && !discard_retried) { 2258 2225 sector_t next_sector; 2259 - unsigned int new_pos = find_journal_node(ic, dio->range.logical_sector, &next_sector); 2226 + unsigned int new_pos; 2227 + 2228 + new_pos = find_journal_node(ic, dio->range.logical_sector, &next_sector); 2260 2229 if (unlikely(new_pos != NOT_FOUND) || 2261 2230 unlikely(next_sector < dio->range.logical_sector - dio->range.n_sectors)) { 2262 2231 remove_range_unlocked(ic, &dio->range); ··· 2412 2377 for (n = 0; n < commit_sections; n++) { 2413 2378 for (j = 0; j < ic->journal_section_entries; j++) { 2414 2379 struct journal_entry *je; 2380 + 2415 2381 je = access_journal_entry(ic, i, j); 2416 2382 io_wait_event(ic->copy_to_journal_wait, !journal_entry_is_inprogress(je)); 2417 2383 } 2418 2384 for (j = 0; j < ic->journal_section_sectors; j++) { 2419 2385 struct journal_sector *js; 2386 + 2420 2387 js = access_journal(ic, i, j); 2421 2388 js->commit_id = dm_integrity_commit_id(ic, i, j, ic->commit_seq); 2422 2389 } ··· 2444 2407 release_flush_bios: 2445 2408 while (flushes) { 2446 2409 struct bio *next = flushes->bi_next; 2410 + 2447 2411 flushes->bi_next = NULL; 2448 2412 do_endio(ic, flushes); 2449 2413 flushes = next; ··· 2456 2418 struct journal_io *io = context; 2457 2419 struct journal_completion *comp = io->comp; 2458 2420 struct dm_integrity_c *ic = comp->ic; 2421 + 2459 2422 remove_range(ic, &io->range); 2460 2423 mempool_free(io, &ic->journal_io_mempool); 2461 2424 if (unlikely(error != 0)) ··· 2468 2429 struct journal_entry *je) 2469 2430 { 2470 2431 unsigned int s = 0; 2432 + 2471 2433 do { 2472 2434 js->commit_id = je->last_bytes[s]; 2473 2435 js++; ··· 2521 2481 for (k = j + 1; k < ic->journal_section_entries; k++) { 2522 2482 struct journal_entry *je2 = access_journal_entry(ic, i, k); 2523 2483 sector_t sec2, area2, offset2; 2484 + 2524 2485 if (journal_entry_is_unused(je2)) 2525 2486 break; 2526 2487 BUG_ON(unlikely(journal_entry_is_inprogress(je2)) && !from_replay); ··· 2627 2586 { 2628 2587 struct dm_integrity_c *ic = container_of(w, struct dm_integrity_c, writer_work); 2629 2588 unsigned int write_start, write_sections; 2630 - 2631 2589 unsigned int prev_free_sectors; 2632 2590 2633 2591 spin_lock_irq(&ic->endio_wait.lock); ··· 2772 2732 2773 2733 if (ic->mode == 'B') { 2774 2734 sector_t start, end; 2735 + 2775 2736 start = (range.logical_sector >> 2776 2737 (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) << 2777 2738 (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit); ··· 2908 2867 wraparound_section(ic, &i); 2909 2868 for (j = 0; j < ic->journal_section_sectors; j++) { 2910 2869 struct journal_sector *js = access_journal(ic, i, j); 2870 + 2911 2871 BUILD_BUG_ON(sizeof(js->sectors) != JOURNAL_SECTOR_DATA); 2912 2872 memset(&js->sectors, 0, sizeof(js->sectors)); 2913 2873 js->commit_id = dm_integrity_commit_id(ic, i, j, commit_seq); 2914 2874 } 2915 2875 for (j = 0; j < ic->journal_section_entries; j++) { 2916 2876 struct journal_entry *je = access_journal_entry(ic, i, j); 2877 + 2917 2878 journal_entry_set_unused(je); 2918 2879 } 2919 2880 } ··· 2926 2883 static int find_commit_seq(struct dm_integrity_c *ic, unsigned int i, unsigned int j, commit_id_t id) 2927 2884 { 2928 2885 unsigned char k; 2886 + 2929 2887 for (k = 0; k < N_COMMIT_IDS; k++) { 2930 2888 if (dm_integrity_commit_id(ic, i, j, k) == id) 2931 2889 return k; ··· 2961 2917 DEBUG_bytes(lowmem_page_address(ic->journal_io[0].page), 64, "read journal"); 2962 2918 if (ic->journal_io) { 2963 2919 struct journal_completion crypt_comp; 2920 + 2964 2921 crypt_comp.ic = ic; 2965 2922 init_completion(&crypt_comp.comp); 2966 2923 crypt_comp.in_flight = (atomic_t)ATOMIC_INIT(0); ··· 2981 2936 for (j = 0; j < ic->journal_section_sectors; j++) { 2982 2937 int k; 2983 2938 struct journal_sector *js = access_journal(ic, i, j); 2939 + 2984 2940 k = find_commit_seq(ic, i, j, js->commit_id); 2985 2941 if (k < 0) 2986 2942 goto clear_journal; ··· 2991 2945 if (journal_empty) { 2992 2946 for (j = 0; j < ic->journal_section_entries; j++) { 2993 2947 struct journal_entry *je = access_journal_entry(ic, i, j); 2948 + 2994 2949 if (!journal_entry_is_unused(je)) { 2995 2950 journal_empty = false; 2996 2951 break; ··· 3064 3017 } else { 3065 3018 unsigned int s; 3066 3019 unsigned char erase_seq; 3020 + 3067 3021 clear_journal: 3068 3022 DEBUG_print("clearing journal\n"); 3069 3023 ··· 3274 3226 DEBUG_print("testing recalc: %x\n", ic->sb->flags); 3275 3227 if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)) { 3276 3228 __u64 recalc_pos = le64_to_cpu(ic->sb->recalc_sector); 3229 + 3277 3230 DEBUG_print("recalc pos: %llx / %llx\n", recalc_pos, ic->provided_data_sectors); 3278 3231 if (recalc_pos < ic->provided_data_sectors) { 3279 3232 queue_work(ic->recalc_wq, &ic->recalc_work); ··· 3315 3266 3316 3267 case STATUSTYPE_TABLE: { 3317 3268 __u64 watermark_percentage = (__u64)(ic->journal_entries - ic->free_sectors_threshold) * 100; 3269 + 3318 3270 watermark_percentage += ic->journal_entries / 2; 3319 3271 do_div(watermark_percentage, ic->journal_entries); 3320 3272 arg_count = 3; ··· 3475 3425 return -EINVAL; 3476 3426 } else { 3477 3427 __u64 meta_size = (ic->provided_data_sectors >> ic->sb->log2_sectors_per_block) * ic->tag_size; 3428 + 3478 3429 meta_size = (meta_size + ((1U << (ic->log2_buffer_sectors + SECTOR_SHIFT)) - 1)) 3479 3430 >> (ic->log2_buffer_sectors + SECTOR_SHIFT); 3480 3431 meta_size <<= ic->log2_buffer_sectors; ··· 3493 3442 { 3494 3443 if (!ic->meta_dev) { 3495 3444 int test_bit; 3445 + 3496 3446 ic->provided_data_sectors = 0; 3497 3447 for (test_bit = fls64(ic->meta_device_sectors) - 1; test_bit >= 3; test_bit--) { 3498 3448 __u64 prev_data_sectors = ic->provided_data_sectors; ··· 3556 3504 for (test_bit = fls(journal_sections) - 1; test_bit >= 0; test_bit--) { 3557 3505 __u32 prev_journal_sections = le32_to_cpu(ic->sb->journal_sections); 3558 3506 __u32 test_journal_sections = prev_journal_sections | (1U << test_bit); 3507 + 3559 3508 if (test_journal_sections > journal_sections) 3560 3509 continue; 3561 3510 ic->sb->journal_sections = cpu_to_le32(test_journal_sections); ··· 3633 3580 static void dm_integrity_free_journal_scatterlist(struct dm_integrity_c *ic, struct scatterlist **sl) 3634 3581 { 3635 3582 unsigned int i; 3583 + 3636 3584 for (i = 0; i < ic->journal_sections; i++) 3637 3585 kvfree(sl[i]); 3638 3586 kvfree(sl); ··· 3675 3621 for (idx = start_index; idx <= end_index; idx++) { 3676 3622 char *va = lowmem_page_address(pl[idx].page); 3677 3623 unsigned int start = 0, end = PAGE_SIZE; 3624 + 3678 3625 if (idx == start_index) 3679 3626 start = start_offset; 3680 3627 if (idx == end_index) ··· 3856 3801 sg_init_table(sg, ic->journal_pages + 1); 3857 3802 for (i = 0; i < ic->journal_pages; i++) { 3858 3803 char *va = lowmem_page_address(ic->journal_xor[i].page); 3804 + 3859 3805 clear_page(va); 3860 3806 sg_set_buf(&sg[i], va, PAGE_SIZE); 3861 3807 } ··· 3968 3912 3969 3913 for (i = 0; i < N_COMMIT_IDS; i++) { 3970 3914 unsigned int j; 3915 + 3971 3916 retest_commit_id: 3972 3917 for (j = 0; j < i; j++) { 3973 3918 if (ic->commit_ids[j] == ic->commit_ids[i]) { ··· 4113 4056 const char *opt_string; 4114 4057 unsigned int val; 4115 4058 unsigned long long llval; 4059 + 4116 4060 opt_string = dm_shift_arg(&as); 4117 4061 if (!opt_string) { 4118 4062 r = -EINVAL; ··· 4463 4405 4464 4406 if (ic->internal_hash) { 4465 4407 size_t recalc_tags_size; 4408 + 4466 4409 ic->recalc_wq = alloc_workqueue("dm-integrity-recalc", WQ_MEM_RECLAIM, 1); 4467 4410 if (!ic->recalc_wq) { 4468 4411 ti->error = "Cannot allocate workqueue"; ··· 4578 4519 goto bad; 4579 4520 } 4580 4521 if (ic->mode == 'B') { 4581 - unsigned int max_io_len = ((sector_t)ic->sectors_per_block << ic->log2_blocks_per_bitmap_bit) * (BITMAP_BLOCK_SIZE * 8); 4522 + unsigned int max_io_len; 4523 + 4524 + max_io_len = ((sector_t)ic->sectors_per_block << ic->log2_blocks_per_bitmap_bit) * (BITMAP_BLOCK_SIZE * 8); 4582 4525 if (!max_io_len) 4583 4526 max_io_len = 1U << 31; 4584 4527 DEBUG_print("max_io_len: old %u, new %u\n", ti->max_io_len, max_io_len); ··· 4654 4593 unsigned int i; 4655 4594 4656 4595 for (i = 0; i < ic->journal_sections; i++) { 4657 - struct skcipher_request *req = ic->sk_requests[i]; 4596 + struct skcipher_request *req; 4597 + 4598 + req = ic->sk_requests[i]; 4658 4599 if (req) { 4659 4600 kfree_sensitive(req->iv); 4660 4601 skcipher_request_free(req);
+1
drivers/md/dm-io.c
··· 197 197 static void list_next_page(struct dpages *dp) 198 198 { 199 199 struct page_list *pl = (struct page_list *) dp->context_ptr; 200 + 200 201 dp->context_ptr = pl->next; 201 202 dp->context_u = 0; 202 203 }
+14 -4
drivers/md/dm-ioctl.c
··· 92 92 93 93 while (n) { 94 94 struct hash_cell *hc = container_of(n, struct hash_cell, name_node); 95 - int c = strcmp(hc->name, str); 95 + int c; 96 + 97 + c = strcmp(hc->name, str); 96 98 if (!c) { 97 99 dm_get(hc->md); 98 100 return hc; ··· 111 109 112 110 while (n) { 113 111 struct hash_cell *hc = container_of(n, struct hash_cell, uuid_node); 114 - int c = strcmp(hc->uuid, str); 112 + int c; 113 + 114 + c = strcmp(hc->uuid, str); 115 115 if (!c) { 116 116 dm_get(hc->md); 117 117 return hc; ··· 153 149 154 150 while (*n) { 155 151 struct hash_cell *hc = container_of(*n, struct hash_cell, name_node); 156 - int c = strcmp(hc->name, new_hc->name); 152 + int c; 153 + 154 + c = strcmp(hc->name, new_hc->name); 157 155 BUG_ON(!c); 158 156 parent = *n; 159 157 n = c >= 0 ? &hc->name_node.rb_left : &hc->name_node.rb_right; ··· 178 172 179 173 while (*n) { 180 174 struct hash_cell *hc = container_of(*n, struct hash_cell, uuid_node); 181 - int c = strcmp(hc->uuid, new_hc->uuid); 175 + int c; 176 + 177 + c = strcmp(hc->uuid, new_hc->uuid); 182 178 BUG_ON(!c); 183 179 parent = *n; 184 180 n = c > 0 ? &hc->uuid_node.rb_left : &hc->uuid_node.rb_right; ··· 629 621 */ 630 622 for (n = rb_first(&name_rb_tree); n; n = rb_next(n)) { 631 623 void *uuid_ptr; 624 + 632 625 hc = container_of(n, struct hash_cell, name_node); 633 626 if (!filter_device(hc, param->name, param->uuid)) 634 627 continue; ··· 857 848 858 849 if (param->flags & DM_QUERY_INACTIVE_TABLE_FLAG) { 859 850 int srcu_idx; 851 + 860 852 table = dm_get_inactive_table(md, &srcu_idx); 861 853 if (table) { 862 854 if (!(dm_table_get_mode(table) & FMODE_WRITE))
+2
drivers/md/dm-kcopyd.c
··· 151 151 152 152 if (unlikely(t->total_period >= (1 << ACCOUNT_INTERVAL_SHIFT))) { 153 153 int shift = fls(t->total_period >> ACCOUNT_INTERVAL_SHIFT); 154 + 154 155 t->total_period >>= shift; 155 156 t->io_period >>= shift; 156 157 } ··· 679 678 static void dispatch_job(struct kcopyd_job *job) 680 679 { 681 680 struct dm_kcopyd_client *kc = job->kc; 681 + 682 682 atomic_inc(&kc->nr_jobs); 683 683 if (unlikely(!job->source.count)) 684 684 push(&kc->callback_jobs, job);
+6
drivers/md/dm-log.c
··· 655 655 static uint32_t core_get_region_size(struct dm_dirty_log *log) 656 656 { 657 657 struct log_c *lc = (struct log_c *) log->context; 658 + 658 659 return lc->region_size; 659 660 } 660 661 661 662 static int core_resume(struct dm_dirty_log *log) 662 663 { 663 664 struct log_c *lc = (struct log_c *) log->context; 665 + 664 666 lc->sync_search = 0; 665 667 return 0; 666 668 } ··· 670 668 static int core_is_clean(struct dm_dirty_log *log, region_t region) 671 669 { 672 670 struct log_c *lc = (struct log_c *) log->context; 671 + 673 672 return log_test_bit(lc->clean_bits, region); 674 673 } 675 674 676 675 static int core_in_sync(struct dm_dirty_log *log, region_t region, int block) 677 676 { 678 677 struct log_c *lc = (struct log_c *) log->context; 678 + 679 679 return log_test_bit(lc->sync_bits, region); 680 680 } 681 681 ··· 730 726 static void core_mark_region(struct dm_dirty_log *log, region_t region) 731 727 { 732 728 struct log_c *lc = (struct log_c *) log->context; 729 + 733 730 log_clear_bit(lc, lc->clean_bits, region); 734 731 } 735 732 736 733 static void core_clear_region(struct dm_dirty_log *log, region_t region) 737 734 { 738 735 struct log_c *lc = (struct log_c *) log->context; 736 + 739 737 if (likely(!lc->flush_failed)) 740 738 log_set_bit(lc, lc->clean_bits, region); 741 739 }
+3
drivers/md/dm-mpath.c
··· 137 137 138 138 if (r) { 139 139 unsigned long flags; 140 + 140 141 spin_lock_irqsave(&m->lock, flags); 141 142 r = test_bit(MPATHF_bit, &m->flags); 142 143 spin_unlock_irqrestore(&m->lock, flags); ··· 712 711 blk_start_plug(&plug); 713 712 while ((bio = bio_list_pop(&bios))) { 714 713 struct dm_mpath_io *mpio = get_mpio_from_bio(bio); 714 + 715 715 dm_bio_restore(get_bio_details_from_mpio(mpio), bio); 716 716 r = __multipath_map_bio(m, bio, mpio); 717 717 switch (r) { ··· 2124 2122 /* no paths available, for blk-mq: rely on IO mapping to delay requeue */ 2125 2123 if (!atomic_read(&m->nr_valid_paths)) { 2126 2124 unsigned long flags; 2125 + 2127 2126 spin_lock_irqsave(&m->lock, flags); 2128 2127 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) { 2129 2128 spin_unlock_irqrestore(&m->lock, flags);
+2
drivers/md/dm-rq.c
··· 128 128 { 129 129 if (unlikely(dm_stats_used(&md->stats))) { 130 130 struct dm_rq_target_io *tio = tio_from_request(orig); 131 + 131 132 tio->duration_jiffies = jiffies - tio->duration_jiffies; 132 133 dm_stats_account_io(&md->stats, rq_data_dir(orig), 133 134 blk_rq_pos(orig), tio->n_sectors, true, ··· 436 435 437 436 if (unlikely(dm_stats_used(&md->stats))) { 438 437 struct dm_rq_target_io *tio = tio_from_request(orig); 438 + 439 439 tio->duration_jiffies = jiffies; 440 440 tio->n_sectors = blk_rq_sectors(orig); 441 441 dm_stats_account_io(&md->stats, rq_data_dir(orig),
+3
drivers/md/dm-snap-persistent.c
··· 276 276 { 277 277 uint32_t stride = ps->exceptions_per_area + 1; 278 278 chunk_t next_free = ps->next_free; 279 + 279 280 if (sector_div(next_free, stride) == NUM_SNAPSHOT_HDR_CHUNKS) 280 281 ps->next_free++; 281 282 } ··· 522 521 if (DM_PREFETCH_CHUNKS) { 523 522 do { 524 523 chunk_t pf_chunk = area_location(ps, prefetch_area); 524 + 525 525 if (unlikely(pf_chunk >= dm_bufio_get_device_size(client))) 526 526 break; 527 527 dm_bufio_prefetch(client, pf_chunk, 1); ··· 881 879 882 880 if (options) { 883 881 char overflow = toupper(options[0]); 882 + 884 883 if (overflow == 'O') 885 884 store->userspace_supports_overflow = true; 886 885 else {
+7
drivers/md/dm-snap.c
··· 245 245 static void init_tracked_chunk(struct bio *bio) 246 246 { 247 247 struct dm_snap_tracked_chunk *c = dm_per_bio_data(bio, sizeof(struct dm_snap_tracked_chunk)); 248 + 248 249 INIT_HLIST_NODE(&c->node); 249 250 } 250 251 251 252 static bool is_bio_tracked(struct bio *bio) 252 253 { 253 254 struct dm_snap_tracked_chunk *c = dm_per_bio_data(bio, sizeof(struct dm_snap_tracked_chunk)); 255 + 254 256 return !hlist_unhashed(&c->node); 255 257 } 256 258 ··· 401 399 static void __insert_origin(struct origin *o) 402 400 { 403 401 struct list_head *sl = &_origins[origin_hash(o->bdev)]; 402 + 404 403 list_add_tail(&o->hash_list, sl); 405 404 } 406 405 ··· 421 418 static void __insert_dm_origin(struct dm_origin *o) 422 419 { 423 420 struct list_head *sl = &_dm_origins[origin_hash(o->dev->bdev)]; 421 + 424 422 list_add_tail(&o->hash_list, sl); 425 423 } 426 424 ··· 872 868 { 873 869 /* use a fixed size of 2MB */ 874 870 unsigned long mem = 2 * 1024 * 1024; 871 + 875 872 mem /= sizeof(struct hlist_bl_head); 876 873 877 874 return mem; ··· 1557 1552 * throttling is unlikely to negatively impact performance. 1558 1553 */ 1559 1554 DECLARE_WAITQUEUE(wait, current); 1555 + 1560 1556 __add_wait_queue(&s->in_progress_wait, &wait); 1561 1557 __set_current_state(TASK_UNINTERRUPTIBLE); 1562 1558 spin_unlock(&s->in_progress_wait.lock); ··· 2573 2567 if (o) { 2574 2568 if (limit) { 2575 2569 struct dm_snapshot *s; 2570 + 2576 2571 list_for_each_entry(s, &o->snapshots, list) 2577 2572 if (unlikely(!wait_for_in_progress(s, true))) 2578 2573 goto again;
+11 -2
drivers/md/dm-stats.c
··· 336 336 337 337 if (s->n_histogram_entries) { 338 338 unsigned long long *hi; 339 + 339 340 hi = dm_kvzalloc(s->histogram_alloc_size, NUMA_NO_NODE); 340 341 if (!hi) { 341 342 r = -ENOMEM; ··· 358 357 s->stat_percpu[cpu] = p; 359 358 if (s->n_histogram_entries) { 360 359 unsigned long long *hi; 360 + 361 361 hi = dm_kvzalloc(s->histogram_alloc_size, cpu_to_node(cpu)); 362 362 if (!hi) { 363 363 r = -ENOMEM; ··· 497 495 DMEMIT(" precise_timestamps"); 498 496 if (s->n_histogram_entries) { 499 497 unsigned int i; 498 + 500 499 DMEMIT(" histogram:"); 501 500 for (i = 0; i < s->n_histogram_entries; i++) { 502 501 if (i) ··· 570 567 */ 571 568 #if BITS_PER_LONG == 32 572 569 unsigned long flags; 570 + 573 571 local_irq_save(flags); 574 572 #else 575 573 preempt_disable(); ··· 582 578 atomic_inc(&shared->in_flight[idx]); 583 579 } else { 584 580 unsigned long long duration; 581 + 585 582 dm_stat_round(s, shared, p); 586 583 atomic_dec(&shared->in_flight[idx]); 587 584 p->sectors[idx] += len; ··· 597 592 } 598 593 if (s->n_histogram_entries) { 599 594 unsigned int lo = 0, hi = s->n_histogram_entries + 1; 595 + 600 596 while (lo + 1 < hi) { 601 597 unsigned int mid = (lo + hi) / 2; 598 + 602 599 if (s->histogram_boundaries[mid - 1] > duration) { 603 600 hi = mid; 604 601 } else { ··· 748 741 shared->tmp.time_in_queue += READ_ONCE(p->time_in_queue); 749 742 if (s->n_histogram_entries) { 750 743 unsigned int i; 744 + 751 745 for (i = 0; i < s->n_histogram_entries + 1; i++) 752 746 shared->tmp.histogram[i] += READ_ONCE(p->histogram[i]); 753 747 } ··· 783 775 local_irq_enable(); 784 776 if (s->n_histogram_entries) { 785 777 unsigned int i; 778 + 786 779 for (i = 0; i < s->n_histogram_entries + 1; i++) { 787 780 local_irq_disable(); 788 781 p = &s->stat_percpu[smp_processor_id()][x]; ··· 899 890 dm_jiffies_to_msec64(s, shared->tmp.io_ticks[WRITE])); 900 891 if (s->n_histogram_entries) { 901 892 unsigned int i; 893 + 902 894 for (i = 0; i < s->n_histogram_entries + 1; i++) { 903 895 DMEMIT("%s%llu", !i ? " " : ":", shared->tmp.histogram[i]); 904 896 } ··· 972 962 unsigned long long hi; 973 963 int s; 974 964 char ch; 965 + 975 966 s = sscanf(h, "%llu%c", &hi, &ch); 976 967 if (!s || (s == 2 && ch != ',')) 977 968 return -EINVAL; ··· 998 987 unsigned int divisor; 999 988 const char *program_id, *aux_data; 1000 989 unsigned int stat_flags = 0; 1001 - 1002 990 unsigned int n_histogram_entries = 0; 1003 991 unsigned long long *histogram_boundaries = NULL; 1004 - 1005 992 struct dm_arg_set as, as_backup; 1006 993 const char *a; 1007 994 unsigned int feature_args;
+1
drivers/md/dm-sysfs.c
··· 143 143 void dm_sysfs_exit(struct mapped_device *md) 144 144 { 145 145 struct kobject *kobj = dm_kobject(md); 146 + 146 147 kobject_put(kobj); 147 148 wait_for_completion(dm_get_completion_from_kobject(kobj)); 148 149 }
+1
drivers/md/dm-thin-metadata.c
··· 403 403 static int subtree_equal(void *context, const void *value1_le, const void *value2_le) 404 404 { 405 405 __le64 v1_le, v2_le; 406 + 406 407 memcpy(&v1_le, value1_le, sizeof(v1_le)); 407 408 memcpy(&v2_le, value2_le, sizeof(v2_le)); 408 409
+5
drivers/md/dm-thin.c
··· 1038 1038 static void free_discard_mapping(struct dm_thin_new_mapping *m) 1039 1039 { 1040 1040 struct thin_c *tc = m->tc; 1041 + 1041 1042 if (m->cell) 1042 1043 cell_defer_no_holder(tc, m->cell); 1043 1044 mempool_free(m, &tc->pool->mapping_pool); ··· 2413 2412 static void do_waker(struct work_struct *ws) 2414 2413 { 2415 2414 struct pool *pool = container_of(to_delayed_work(ws), struct pool, waker); 2415 + 2416 2416 wake_worker(pool); 2417 2417 queue_delayed_work(pool->wq, &pool->waker, COMMIT_PERIOD); 2418 2418 } ··· 2476 2474 static void do_noflush_start(struct work_struct *ws) 2477 2475 { 2478 2476 struct noflush_work *w = to_noflush(ws); 2477 + 2479 2478 w->tc->requeue_mode = true; 2480 2479 requeue_io(w->tc); 2481 2480 pool_work_complete(&w->pw); ··· 2485 2482 static void do_noflush_stop(struct work_struct *ws) 2486 2483 { 2487 2484 struct noflush_work *w = to_noflush(ws); 2485 + 2488 2486 w->tc->requeue_mode = false; 2489 2487 pool_work_complete(&w->pw); 2490 2488 } ··· 3245 3241 * delete after you've grown the device). 3246 3242 */ 3247 3243 dm_block_t quarter = get_metadata_dev_size_in_blocks(pt->metadata_dev->bdev) / 4; 3244 + 3248 3245 return min((dm_block_t)1024ULL /* 4M */, quarter); 3249 3246 } 3250 3247
+4
drivers/md/dm-verity-target.c
··· 114 114 do { 115 115 int r; 116 116 size_t this_step = min_t(size_t, len, PAGE_SIZE - offset_in_page(data)); 117 + 117 118 flush_kernel_vmap_range((void *)data, this_step); 118 119 sg_init_table(&sg, 1); 119 120 sg_set_page(&sg, vmalloc_to_page(data), this_step, offset_in_page(data)); ··· 684 683 for (i = v->levels - 2; i >= 0; i--) { 685 684 sector_t hash_block_start; 686 685 sector_t hash_block_end; 686 + 687 687 verity_hash_at_level(v, pw->block, i, &hash_block_start, NULL); 688 688 verity_hash_at_level(v, pw->block + pw->n_blocks - 1, i, &hash_block_end, NULL); 689 + 689 690 if (!i) { 690 691 unsigned int cluster = READ_ONCE(dm_verity_prefetch_cluster); 691 692 ··· 1370 1367 hash_position = v->hash_start; 1371 1368 for (i = v->levels - 1; i >= 0; i--) { 1372 1369 sector_t s; 1370 + 1373 1371 v->hash_level_block[i] = hash_position; 1374 1372 s = (v->data_blocks + ((sector_t)1 << ((i + 1) * v->hash_per_block_bits)) - 1) 1375 1373 >> ((i + 1) * v->hash_per_block_bits);
+27 -8
drivers/md/dm-writecache.c
··· 83 83 struct rb_node rb_node; 84 84 struct list_head lru; 85 85 unsigned short wc_list_contiguous; 86 - bool write_in_progress 87 86 #if BITS_PER_LONG == 64 88 - : 1 87 + bool write_in_progress : 1; 88 + unsigned long index : 47; 89 + #else 90 + bool write_in_progress; 91 + unsigned long index; 89 92 #endif 90 - ; 91 - unsigned long index 92 - #if BITS_PER_LONG == 64 93 - : 47 94 - #endif 95 - ; 96 93 unsigned long age; 97 94 #ifdef DM_WRITECACHE_HANDLE_HARDWARE_ERRORS 98 95 uint64_t original_sector; ··· 297 300 } 298 301 if (da != p) { 299 302 long i; 303 + 300 304 wc->memory_map = NULL; 301 305 pages = kvmalloc_array(p, sizeof(struct page *), GFP_KERNEL); 302 306 if (!pages) { ··· 307 309 i = 0; 308 310 do { 309 311 long daa; 312 + 310 313 daa = dax_direct_access(wc->ssd_dev->dax_dev, offset + i, 311 314 p - i, DAX_ACCESS, NULL, &pfn); 312 315 if (daa <= 0) { ··· 506 507 507 508 while (1) { 508 509 unsigned int j; 510 + 509 511 i = find_next_bit(wc->dirty_bitmap, bitmap_bits, i); 510 512 if (unlikely(i == bitmap_bits)) 511 513 break; ··· 637 637 638 638 while (1) { 639 639 struct wc_entry *e2; 640 + 640 641 if (flags & WFE_LOWEST_SEQ) 641 642 node = rb_prev(&e->rb_node); 642 643 else ··· 680 679 { 681 680 if (WC_MODE_SORT_FREELIST(wc)) { 682 681 struct rb_node **node = &wc->freetree.rb_node, *parent = NULL; 682 + 683 683 if (unlikely(!*node)) 684 684 wc->current_free = e; 685 685 while (*node) { ··· 720 718 721 719 if (WC_MODE_SORT_FREELIST(wc)) { 722 720 struct rb_node *next; 721 + 723 722 if (unlikely(!wc->current_free)) 724 723 return NULL; 725 724 e = wc->current_free; ··· 867 864 static void writecache_autocommit_timer(struct timer_list *t) 868 865 { 869 866 struct dm_writecache *wc = from_timer(wc, t, autocommit_timer); 867 + 870 868 if (!writecache_has_error(wc)) 871 869 queue_work(wc->writeback_wq, &wc->flush_work); 872 870 } ··· 967 963 return -ENOMEM; 968 964 for (b = 0; b < wc->n_blocks; b++) { 969 965 struct wc_entry *e = &wc->entries[b]; 966 + 970 967 e->index = b; 971 968 e->write_in_progress = false; 972 969 cond_resched(); ··· 1011 1006 r = writecache_read_metadata(wc, wc->metadata_sectors); 1012 1007 if (r) { 1013 1008 size_t sb_entries_offset; 1009 + 1014 1010 writecache_error(wc, r, "unable to read metadata: %d", r); 1015 1011 sb_entries_offset = offsetof(struct wc_memory_superblock, entries); 1016 1012 memset((char *)wc->memory_map + sb_entries_offset, -1, ··· 1041 1035 for (b = 0; b < wc->n_blocks; b++) { 1042 1036 struct wc_entry *e = &wc->entries[b]; 1043 1037 struct wc_memory_entry wme; 1038 + 1044 1039 if (writecache_has_error(wc)) { 1045 1040 e->original_sector = -1; 1046 1041 e->seq_count = -1; ··· 1063 1056 #endif 1064 1057 for (b = 0; b < wc->n_blocks; b++) { 1065 1058 struct wc_entry *e = &wc->entries[b]; 1059 + 1066 1060 if (!writecache_entry_is_committed(wc, e)) { 1067 1061 if (read_seq_count(wc, e) != -1) { 1068 1062 erase_this: ··· 1253 1245 1254 1246 do { 1255 1247 struct bio_vec bv = bio_iter_iovec(bio, bio->bi_iter); 1248 + 1256 1249 buf = bvec_kmap_local(&bv); 1257 1250 size = bv.bv_len; 1258 1251 if (unlikely(size > remaining_size)) ··· 1261 1252 1262 1253 if (rw == READ) { 1263 1254 int r; 1255 + 1264 1256 r = copy_mc_to_kernel(buf, data, size); 1265 1257 flush_dcache_page(bio_page(bio)); 1266 1258 if (unlikely(r)) { ··· 1389 1379 while (bio_size < bio->bi_iter.bi_size) { 1390 1380 if (!search_used) { 1391 1381 struct wc_entry *f = writecache_pop_from_freelist(wc, current_cache_sec); 1382 + 1392 1383 if (!f) 1393 1384 break; 1394 1385 write_original_sector_seq_count(wc, f, bio->bi_iter.bi_sector + ··· 1399 1388 } else { 1400 1389 struct wc_entry *f; 1401 1390 struct rb_node *next = rb_next(&e->rb_node); 1391 + 1402 1392 if (!next) 1403 1393 break; 1404 1394 f = container_of(next, struct wc_entry, rb_node); ··· 1440 1428 do { 1441 1429 bool found_entry = false; 1442 1430 bool search_used = false; 1431 + 1443 1432 if (writecache_has_error(wc)) { 1444 1433 wc->stats.writes += bio->bi_iter.bi_size >> wc->block_size_bits; 1445 1434 return WC_MAP_ERROR; ··· 1619 1606 1620 1607 if (bio->bi_private == (void *)1) { 1621 1608 int dir = bio_data_dir(bio); 1609 + 1622 1610 if (atomic_dec_and_test(&wc->bio_in_progress[dir])) 1623 1611 if (unlikely(waitqueue_active(&wc->bio_in_progress_wait[dir]))) 1624 1612 wake_up(&wc->bio_in_progress_wait[dir]); ··· 1958 1944 if (likely(wc->pause != 0)) { 1959 1945 while (1) { 1960 1946 unsigned long idle; 1947 + 1961 1948 if (unlikely(wc->cleaner) || unlikely(wc->writeback_all) || 1962 1949 unlikely(dm_suspended(wc->ti))) 1963 1950 break; ··· 2404 2389 string = dm_shift_arg(&as), opt_params--; 2405 2390 if (!strcasecmp(string, "start_sector") && opt_params >= 1) { 2406 2391 unsigned long long start_sector; 2392 + 2407 2393 string = dm_shift_arg(&as), opt_params--; 2408 2394 if (sscanf(string, "%llu%c", &start_sector, &dummy) != 1) 2409 2395 goto invalid_optional; ··· 2441 2425 wc->autocommit_blocks_set = true; 2442 2426 } else if (!strcasecmp(string, "autocommit_time") && opt_params >= 1) { 2443 2427 unsigned int autocommit_msecs; 2428 + 2444 2429 string = dm_shift_arg(&as), opt_params--; 2445 2430 if (sscanf(string, "%u%c", &autocommit_msecs, &dummy) != 1) 2446 2431 goto invalid_optional; ··· 2452 2435 wc->autocommit_time_set = true; 2453 2436 } else if (!strcasecmp(string, "max_age") && opt_params >= 1) { 2454 2437 unsigned int max_age_msecs; 2438 + 2455 2439 string = dm_shift_arg(&as), opt_params--; 2456 2440 if (sscanf(string, "%u%c", &max_age_msecs, &dummy) != 1) 2457 2441 goto invalid_optional; ··· 2480 2462 wc->metadata_only = true; 2481 2463 } else if (!strcasecmp(string, "pause_writeback") && opt_params >= 1) { 2482 2464 unsigned int pause_msecs; 2465 + 2483 2466 if (WC_MODE_PMEM(wc)) 2484 2467 goto invalid_optional; 2485 2468 string = dm_shift_arg(&as), opt_params--;
+4
drivers/md/persistent-data/dm-array.c
··· 112 112 void (*fn)(void *, const void *, unsigned int)) 113 113 { 114 114 unsigned int nr_entries = le32_to_cpu(ab->nr_entries); 115 + 115 116 fn(info->value_type.context, element_at(info, ab, 0), nr_entries); 116 117 } 117 118 ··· 439 438 440 439 while (begin_index != end_index) { 441 440 uint64_t key = begin_index++; 441 + 442 442 r = dm_btree_remove(&resize->info->btree_info, resize->root, 443 443 &key, &resize->root); 444 444 if (r) ··· 624 622 static void block_dec(void *context, const void *value, unsigned int count) 625 623 { 626 624 unsigned int i; 625 + 627 626 for (i = 0; i < count; i++, value += sizeof(__le64)) 628 627 __block_dec(context, value); 629 628 } ··· 698 695 __dm_written_to_disk(value) 699 696 { 700 697 int r = array_resize(info, root, old_size, new_size, value, new_root); 698 + 701 699 __dm_unbless_for_disk(value); 702 700 return r; 703 701 }
+1
drivers/md/persistent-data/dm-bitset.c
··· 74 74 uint32_t size, bit_value_fn fn, void *context) 75 75 { 76 76 struct packer_context p; 77 + 77 78 p.fn = fn; 78 79 p.nr_bits = size; 79 80 p.context = context;
+5 -2
drivers/md/persistent-data/dm-block-manager.c
··· 92 92 static void __del_holder(struct block_lock *lock, struct task_struct *task) 93 93 { 94 94 unsigned int h = __find_holder(lock, task); 95 + 95 96 lock->holders[h] = NULL; 96 97 put_task_struct(task); 97 98 } ··· 356 355 static void dm_block_manager_alloc_callback(struct dm_buffer *buf) 357 356 { 358 357 struct buffer_aux *aux = dm_bufio_get_aux_data(buf); 358 + 359 359 aux->validator = NULL; 360 360 bl_init(&aux->lock); 361 361 } ··· 364 362 static void dm_block_manager_write_callback(struct dm_buffer *buf) 365 363 { 366 364 struct buffer_aux *aux = dm_bufio_get_aux_data(buf); 365 + 367 366 if (aux->validator) { 368 367 aux->validator->prepare_for_write(aux->validator, (struct dm_block *) buf, 369 368 dm_bufio_get_block_size(dm_bufio_get_client(buf))); ··· 439 436 { 440 437 if (unlikely(!aux->validator)) { 441 438 int r; 439 + 442 440 if (!v) 443 441 return 0; 444 442 r = v->check(v, (struct dm_block *) buf, dm_bufio_get_block_size(bm->bufio)); ··· 595 591 596 592 void dm_bm_unlock(struct dm_block *b) 597 593 { 598 - struct buffer_aux *aux; 599 - aux = dm_bufio_get_aux_data(to_buffer(b)); 594 + struct buffer_aux *aux = dm_bufio_get_aux_data(to_buffer(b)); 600 595 601 596 if (aux->write_locked) { 602 597 dm_bufio_mark_buffer_dirty(to_buffer(b));
+1
drivers/md/persistent-data/dm-btree-internal.h
··· 119 119 static inline void *value_ptr(struct btree_node *n, uint32_t index) 120 120 { 121 121 uint32_t value_size = le32_to_cpu(n->header.value_size); 122 + 122 123 return value_base(n) + (value_size * index); 123 124 } 124 125
+5
drivers/md/persistent-data/dm-btree-remove.c
··· 87 87 { 88 88 uint32_t nr_left = le32_to_cpu(left->header.nr_entries); 89 89 uint32_t value_size = le32_to_cpu(left->header.value_size); 90 + 90 91 if (value_size != le32_to_cpu(right->header.value_size)) { 91 92 DMERR("mismatched value size"); 92 93 return -EILSEQ; ··· 131 130 unsigned int nr_entries = le32_to_cpu(n->header.nr_entries); 132 131 unsigned int nr_to_copy = nr_entries - (index + 1); 133 132 uint32_t value_size = le32_to_cpu(n->header.value_size); 133 + 134 134 BUG_ON(index >= nr_entries); 135 135 136 136 if (nr_to_copy) { ··· 267 265 * Rebalance. 268 266 */ 269 267 unsigned int target_left = (nr_left + nr_right) / 2; 268 + 270 269 ret = shift(left, right, nr_left - target_left); 271 270 if (ret) 272 271 return ret; ··· 560 557 */ 561 558 if (shadow_has_parent(s)) { 562 559 __le64 location = cpu_to_le64(dm_block_location(shadow_current(s))); 560 + 563 561 memcpy(value_ptr(dm_block_data(shadow_parent(s)), i), 564 562 &location, sizeof(__le64)); 565 563 } ··· 654 650 */ 655 651 if (shadow_has_parent(s)) { 656 652 __le64 location = cpu_to_le64(dm_block_location(shadow_current(s))); 653 + 657 654 memcpy(value_ptr(dm_block_data(shadow_parent(s)), i), 658 655 &location, sizeof(__le64)); 659 656 }
+10
drivers/md/persistent-data/dm-btree.c
··· 510 510 unsigned int count) 511 511 { 512 512 size_t value_size = le32_to_cpu(dest->header.value_size); 513 + 513 514 memcpy(dest->keys + dest_offset, src->keys + src_offset, count * sizeof(uint64_t)); 514 515 memcpy(value_ptr(dest, dest_offset), value_ptr(src, src_offset), count * value_size); 515 516 } ··· 524 523 unsigned int count) 525 524 { 526 525 size_t value_size = le32_to_cpu(dest->header.value_size); 526 + 527 527 memmove(dest->keys + dest_offset, src->keys + src_offset, count * sizeof(uint64_t)); 528 528 memmove(value_ptr(dest, dest_offset), value_ptr(src, src_offset), count * value_size); 529 529 } ··· 561 559 562 560 if (nr_left < target_left) { 563 561 unsigned int delta = target_left - nr_left; 562 + 564 563 copy_entries(left, nr_left, right, 0, delta); 565 564 shift_down(right, delta); 566 565 } else if (nr_left > target_left) { 567 566 unsigned int delta = nr_left - target_left; 567 + 568 568 if (nr_right) 569 569 shift_up(right, delta); 570 570 copy_entries(right, 0, left, target_left, delta); ··· 597 593 598 594 if (nr_left < target_left) { 599 595 unsigned int left_short = target_left - nr_left; 596 + 600 597 copy_entries(left, nr_left, right, 0, left_short); 601 598 copy_entries(center, 0, right, left_short, target_center); 602 599 shift_down(right, nr_right - target_right); 603 600 604 601 } else if (nr_left < (target_left + target_center)) { 605 602 unsigned int left_to_center = nr_left - target_left; 603 + 606 604 copy_entries(center, 0, left, target_left, left_to_center); 607 605 copy_entries(center, left_to_center, right, 0, target_center - left_to_center); 608 606 shift_down(right, nr_right - target_right); 609 607 610 608 } else { 611 609 unsigned int right_short = target_right - nr_right; 610 + 612 611 shift_up(right, right_short); 613 612 copy_entries(right, 0, left, nr_left - right_short, right_short); 614 613 copy_entries(center, 0, left, target_left, nr_left - target_left); ··· 1011 1004 /* Should we move entries to the left sibling? */ 1012 1005 if (parent_index > 0) { 1013 1006 dm_block_t left_b = value64(parent, parent_index - 1); 1007 + 1014 1008 r = dm_tm_block_is_shared(s->info->tm, left_b, &left_shared); 1015 1009 if (r) 1016 1010 return r; ··· 1029 1021 /* Should we move entries to the right sibling? */ 1030 1022 if (parent_index < (nr_parent - 1)) { 1031 1023 dm_block_t right_b = value64(parent, parent_index + 1); 1024 + 1032 1025 r = dm_tm_block_is_shared(s->info->tm, right_b, &right_shared); 1033 1026 if (r) 1034 1027 return r; ··· 1597 1588 int dm_btree_cursor_next(struct dm_btree_cursor *c) 1598 1589 { 1599 1590 int r = inc_or_backtrack(c); 1591 + 1600 1592 if (!r) { 1601 1593 r = find_leaf(c); 1602 1594 if (r)
+6
drivers/md/persistent-data/dm-space-map-common.c
··· 609 609 static inline int shadow_bitmap(struct ll_disk *ll, struct inc_context *ic) 610 610 { 611 611 int r, inc; 612 + 612 613 r = dm_tm_shadow_block(ll->tm, le64_to_cpu(ic->ie_disk.blocknr), 613 614 &dm_sm_bitmap_validator, &ic->bitmap_block, &inc); 614 615 if (r < 0) { ··· 749 748 *nr_allocations = 0; 750 749 while (b != e) { 751 750 int r = __sm_ll_inc(ll, b, e, nr_allocations, &b); 751 + 752 752 if (r) 753 753 return r; 754 754 } ··· 932 930 *nr_allocations = 0; 933 931 while (b != e) { 934 932 int r = __sm_ll_dec(ll, b, e, nr_allocations, &b); 933 + 935 934 if (r) 936 935 return r; 937 936 } ··· 1169 1166 static int disk_ll_init_index(struct ll_disk *ll) 1170 1167 { 1171 1168 unsigned int i; 1169 + 1172 1170 for (i = 0; i < IE_CACHE_SIZE; i++) { 1173 1171 struct ie_cache *iec = ll->ie_cache + i; 1172 + 1174 1173 iec->valid = false; 1175 1174 iec->dirty = false; 1176 1175 } ··· 1196 1191 1197 1192 for (i = 0; i < IE_CACHE_SIZE; i++) { 1198 1193 struct ie_cache *iec = ll->ie_cache + i; 1194 + 1199 1195 if (iec->valid && iec->dirty) 1200 1196 r = ie_cache_writeback(ll, iec); 1201 1197 }
+3
drivers/md/persistent-data/dm-space-map-disk.c
··· 49 49 static int sm_disk_get_nr_blocks(struct dm_space_map *sm, dm_block_t *count) 50 50 { 51 51 struct sm_disk *smd = container_of(sm, struct sm_disk, sm); 52 + 52 53 *count = smd->old_ll.nr_blocks; 53 54 54 55 return 0; ··· 58 57 static int sm_disk_get_nr_free(struct dm_space_map *sm, dm_block_t *count) 59 58 { 60 59 struct sm_disk *smd = container_of(sm, struct sm_disk, sm); 60 + 61 61 *count = (smd->old_ll.nr_blocks - smd->old_ll.nr_allocated) - smd->nr_allocated_this_transaction; 62 62 63 63 return 0; ··· 68 66 uint32_t *result) 69 67 { 70 68 struct sm_disk *smd = container_of(sm, struct sm_disk, sm); 69 + 71 70 return sm_ll_lookup(&smd->ll, b, result); 72 71 } 73 72
+3
drivers/md/persistent-data/dm-space-map-metadata.c
··· 114 114 static unsigned int brb_next(struct bop_ring_buffer *brb, unsigned int old) 115 115 { 116 116 unsigned int r = old + 1; 117 + 117 118 return r >= ARRAY_SIZE(brb->bops) ? 0 : r; 118 119 } 119 120 ··· 183 182 static int add_bop(struct sm_metadata *smm, enum block_op_type type, dm_block_t b, dm_block_t e) 184 183 { 185 184 int r = brb_push(&smm->uncommitted, type, b, e); 185 + 186 186 if (r) { 187 187 DMERR("too many recursive allocations"); 188 188 return -ENOMEM; ··· 489 487 struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); 490 488 491 489 int r = sm_metadata_new_block_(sm, b); 490 + 492 491 if (r) { 493 492 DMERR_LIMIT("unable to allocate new metadata block"); 494 493 return r;
+1
drivers/md/persistent-data/dm-transaction-manager.c
··· 37 37 static void prefetch_wipe(struct prefetch_set *p) 38 38 { 39 39 unsigned int i; 40 + 40 41 for (i = 0; i < PREFETCH_SIZE; i++) 41 42 p->blocks[i] = PREFETCH_SENTINEL; 42 43 }