···628628{629629 struct dm_buffer *b = bio->bi_private;630630 blk_status_t status = bio->bi_status;631631+631632 bio_uninit(bio);632633 kfree(bio);633634 b->end_io(b, status);···661660662661 do {663662 unsigned int this_step = min((unsigned int)(PAGE_SIZE - offset_in_page(ptr)), len);663663+664664 if (!bio_add_page(bio, virt_to_page(ptr), this_step,665665 offset_in_page(ptr))) {666666 bio_put(bio);···784782static void __flush_write_list(struct list_head *write_list)785783{786784 struct blk_plug plug;785785+787786 blk_start_plug(&plug);788787 while (!list_empty(write_list)) {789788 struct dm_buffer *b =···11821179 for (; n_blocks--; block++) {11831180 int need_submit;11841181 struct dm_buffer *b;11821182+11851183 b = __bufio_new(c, block, NF_PREFETCH, &need_submit,11861184 &write_list);11871185 if (unlikely(!list_empty(&write_list))) {···14671463 __link_buffer(b, new_block, LIST_DIRTY);14681464 } else {14691465 sector_t old_block;14661466+14701467 wait_on_bit_lock_io(&b->state, B_WRITING,14711468 TASK_UNINTERRUPTIBLE);14721469 /*···15581553sector_t dm_bufio_get_device_size(struct dm_bufio_client *c)15591554{15601555 sector_t s = bdev_nr_sectors(c->bdev);15561556+15611557 if (s >= c->start)15621558 s -= c->start;15631559 else···16741668static unsigned long get_retain_buffers(struct dm_bufio_client *c)16751669{16761670 unsigned long retain_bytes = READ_ONCE(dm_bufio_retain_bytes);16711671+16771672 if (likely(c->sectors_per_block_bits >= 0))16781673 retain_bytes >>= c->sectors_per_block_bits + SECTOR_SHIFT;16791674 else16801675 retain_bytes /= c->block_size;16761676+16811677 return retain_bytes;16821678}16831679···18141806 if (block_size <= KMALLOC_MAX_SIZE &&18151807 (block_size < PAGE_SIZE || !is_power_of_2(block_size))) {18161808 unsigned int align = min(1U << __ffs(block_size), (unsigned int)PAGE_SIZE);18091809+18171810 snprintf(slab_name, sizeof slab_name, "dm_bufio_cache-%u", block_size);18181811 c->slab_cache = kmem_cache_create(slab_name, block_size, align,18191812 SLAB_RECLAIM_ACCOUNT, NULL);
+6
drivers/md/dm-cache-metadata.c
···535535 bool may_format_device)536536{537537 int r;538538+538539 cmd->bm = dm_block_manager_create(cmd->bdev, DM_CACHE_METADATA_BLOCK_SIZE << SECTOR_SHIFT,539540 CACHE_MAX_CONCURRENT_LOCKS);540541 if (IS_ERR(cmd->bm)) {···569568 flags_mutator mutator)570569{571570 uint32_t sb_flags = mutator(le32_to_cpu(disk_super->flags));571571+572572 disk_super->flags = cpu_to_le32(sb_flags);573573}574574···734732static __le64 pack_value(dm_oblock_t block, unsigned int flags)735733{736734 uint64_t value = from_oblock(block);735735+737736 value <<= 16;738737 value = value | (flags & FLAGS_MASK);739738 return cpu_to_le64(value);···744741{745742 uint64_t value = le64_to_cpu(value_le);746743 uint64_t b = value >> 16;744744+747745 *block = to_oblock(b);748746 *flags = value & FLAGS_MASK;749747}···12581254{12591255 int r;12601256 __le64 value = pack_value(oblock, M_VALID);12571257+12611258 __dm_bless_for_disk(&value);1262125912631260 r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock),···15851580{15861581 int r;15871582 unsigned int i;15831583+15881584 for (i = 0; i < nr_bits; i++) {15891585 r = __dirty(cmd, to_cblock(i), test_bit(i, bits));15901586 if (r)
+3
drivers/md/dm-cache-policy-internal.h
···8989 unsigned int maxlen, ssize_t *sz_ptr)9090{9191 ssize_t sz = *sz_ptr;9292+9293 if (p->emit_config_values)9394 return p->emit_config_values(p, result, maxlen, sz_ptr);9495···122121static inline unsigned long *alloc_bitset(unsigned int nr_entries)123122{124123 size_t s = bitset_size_in_bytes(nr_entries);124124+125125 return vzalloc(s);126126}127127128128static inline void clear_bitset(void *bitset, unsigned int nr_entries)129129{130130 size_t s = bitset_size_in_bytes(nr_entries);131131+131132 memset(bitset, 0, s);132133}133134
···92929393 while (n) {9494 struct hash_cell *hc = container_of(n, struct hash_cell, name_node);9595- int c = strcmp(hc->name, str);9595+ int c;9696+9797+ c = strcmp(hc->name, str);9698 if (!c) {9799 dm_get(hc->md);98100 return hc;···111109112110 while (n) {113111 struct hash_cell *hc = container_of(n, struct hash_cell, uuid_node);114114- int c = strcmp(hc->uuid, str);112112+ int c;113113+114114+ c = strcmp(hc->uuid, str);115115 if (!c) {116116 dm_get(hc->md);117117 return hc;···153149154150 while (*n) {155151 struct hash_cell *hc = container_of(*n, struct hash_cell, name_node);156156- int c = strcmp(hc->name, new_hc->name);152152+ int c;153153+154154+ c = strcmp(hc->name, new_hc->name);157155 BUG_ON(!c);158156 parent = *n;159157 n = c >= 0 ? &hc->name_node.rb_left : &hc->name_node.rb_right;···178172179173 while (*n) {180174 struct hash_cell *hc = container_of(*n, struct hash_cell, uuid_node);181181- int c = strcmp(hc->uuid, new_hc->uuid);175175+ int c;176176+177177+ c = strcmp(hc->uuid, new_hc->uuid);182178 BUG_ON(!c);183179 parent = *n;184180 n = c > 0 ? &hc->uuid_node.rb_left : &hc->uuid_node.rb_right;···629621 */630622 for (n = rb_first(&name_rb_tree); n; n = rb_next(n)) {631623 void *uuid_ptr;624624+632625 hc = container_of(n, struct hash_cell, name_node);633626 if (!filter_device(hc, param->name, param->uuid))634627 continue;···857848858849 if (param->flags & DM_QUERY_INACTIVE_TABLE_FLAG) {859850 int srcu_idx;851851+860852 table = dm_get_inactive_table(md, &srcu_idx);861853 if (table) {862854 if (!(dm_table_get_mode(table) & FMODE_WRITE))
···276276{277277 uint32_t stride = ps->exceptions_per_area + 1;278278 chunk_t next_free = ps->next_free;279279+279280 if (sector_div(next_free, stride) == NUM_SNAPSHOT_HDR_CHUNKS)280281 ps->next_free++;281282}···522521 if (DM_PREFETCH_CHUNKS) {523522 do {524523 chunk_t pf_chunk = area_location(ps, prefetch_area);524524+525525 if (unlikely(pf_chunk >= dm_bufio_get_device_size(client)))526526 break;527527 dm_bufio_prefetch(client, pf_chunk, 1);···881879882880 if (options) {883881 char overflow = toupper(options[0]);882882+884883 if (overflow == 'O')885884 store->userspace_supports_overflow = true;886885 else {
+7
drivers/md/dm-snap.c
···245245static void init_tracked_chunk(struct bio *bio)246246{247247 struct dm_snap_tracked_chunk *c = dm_per_bio_data(bio, sizeof(struct dm_snap_tracked_chunk));248248+248249 INIT_HLIST_NODE(&c->node);249250}250251251252static bool is_bio_tracked(struct bio *bio)252253{253254 struct dm_snap_tracked_chunk *c = dm_per_bio_data(bio, sizeof(struct dm_snap_tracked_chunk));255255+254256 return !hlist_unhashed(&c->node);255257}256258···401399static void __insert_origin(struct origin *o)402400{403401 struct list_head *sl = &_origins[origin_hash(o->bdev)];402402+404403 list_add_tail(&o->hash_list, sl);405404}406405···421418static void __insert_dm_origin(struct dm_origin *o)422419{423420 struct list_head *sl = &_dm_origins[origin_hash(o->dev->bdev)];421421+424422 list_add_tail(&o->hash_list, sl);425423}426424···872868{873869 /* use a fixed size of 2MB */874870 unsigned long mem = 2 * 1024 * 1024;871871+875872 mem /= sizeof(struct hlist_bl_head);876873877874 return mem;···15571552 * throttling is unlikely to negatively impact performance.15581553 */15591554 DECLARE_WAITQUEUE(wait, current);15551555+15601556 __add_wait_queue(&s->in_progress_wait, &wait);15611557 __set_current_state(TASK_UNINTERRUPTIBLE);15621558 spin_unlock(&s->in_progress_wait.lock);···25732567 if (o) {25742568 if (limit) {25752569 struct dm_snapshot *s;25702570+25762571 list_for_each_entry(s, &o->snapshots, list)25772572 if (unlikely(!wait_for_in_progress(s, true)))25782573 goto again;
+11-2
drivers/md/dm-stats.c
···336336337337 if (s->n_histogram_entries) {338338 unsigned long long *hi;339339+339340 hi = dm_kvzalloc(s->histogram_alloc_size, NUMA_NO_NODE);340341 if (!hi) {341342 r = -ENOMEM;···358357 s->stat_percpu[cpu] = p;359358 if (s->n_histogram_entries) {360359 unsigned long long *hi;360360+361361 hi = dm_kvzalloc(s->histogram_alloc_size, cpu_to_node(cpu));362362 if (!hi) {363363 r = -ENOMEM;···497495 DMEMIT(" precise_timestamps");498496 if (s->n_histogram_entries) {499497 unsigned int i;498498+500499 DMEMIT(" histogram:");501500 for (i = 0; i < s->n_histogram_entries; i++) {502501 if (i)···570567 */571568#if BITS_PER_LONG == 32572569 unsigned long flags;570570+573571 local_irq_save(flags);574572#else575573 preempt_disable();···582578 atomic_inc(&shared->in_flight[idx]);583579 } else {584580 unsigned long long duration;581581+585582 dm_stat_round(s, shared, p);586583 atomic_dec(&shared->in_flight[idx]);587584 p->sectors[idx] += len;···597592 }598593 if (s->n_histogram_entries) {599594 unsigned int lo = 0, hi = s->n_histogram_entries + 1;595595+600596 while (lo + 1 < hi) {601597 unsigned int mid = (lo + hi) / 2;598598+602599 if (s->histogram_boundaries[mid - 1] > duration) {603600 hi = mid;604601 } else {···748741 shared->tmp.time_in_queue += READ_ONCE(p->time_in_queue);749742 if (s->n_histogram_entries) {750743 unsigned int i;744744+751745 for (i = 0; i < s->n_histogram_entries + 1; i++)752746 shared->tmp.histogram[i] += READ_ONCE(p->histogram[i]);753747 }···783775 local_irq_enable();784776 if (s->n_histogram_entries) {785777 unsigned int i;778778+786779 for (i = 0; i < s->n_histogram_entries + 1; i++) {787780 local_irq_disable();788781 p = &s->stat_percpu[smp_processor_id()][x];···899890 dm_jiffies_to_msec64(s, shared->tmp.io_ticks[WRITE]));900891 if (s->n_histogram_entries) {901892 unsigned int i;893893+902894 for (i = 0; i < s->n_histogram_entries + 1; i++) {903895 DMEMIT("%s%llu", !i ? " " : ":", shared->tmp.histogram[i]);904896 }···972962 unsigned long long hi;973963 int s;974964 char ch;965965+975966 s = sscanf(h, "%llu%c", &hi, &ch);976967 if (!s || (s == 2 && ch != ','))977968 return -EINVAL;···998987 unsigned int divisor;999988 const char *program_id, *aux_data;1000989 unsigned int stat_flags = 0;10011001-1002990 unsigned int n_histogram_entries = 0;1003991 unsigned long long *histogram_boundaries = NULL;10041004-1005992 struct dm_arg_set as, as_backup;1006993 const char *a;1007994 unsigned int feature_args;
···114114static unsigned int brb_next(struct bop_ring_buffer *brb, unsigned int old)115115{116116 unsigned int r = old + 1;117117+117118 return r >= ARRAY_SIZE(brb->bops) ? 0 : r;118119}119120···183182static int add_bop(struct sm_metadata *smm, enum block_op_type type, dm_block_t b, dm_block_t e)184183{185184 int r = brb_push(&smm->uncommitted, type, b, e);185185+186186 if (r) {187187 DMERR("too many recursive allocations");188188 return -ENOMEM;···489487 struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);490488491489 int r = sm_metadata_new_block_(sm, b);490490+492491 if (r) {493492 DMERR_LIMIT("unable to allocate new metadata block");494493 return r;
···3737static void prefetch_wipe(struct prefetch_set *p)3838{3939 unsigned int i;4040+4041 for (i = 0; i < PREFETCH_SIZE; i++)4142 p->blocks[i] = PREFETCH_SENTINEL;4243}