• Home
  • Raw
  • Download

Lines Matching refs:ab

96 static void *element_at(struct dm_array_info *info, struct array_block *ab,  in element_at()  argument
99 unsigned char *entry = (unsigned char *) (ab + 1); in element_at()
110 static void on_entries(struct dm_array_info *info, struct array_block *ab, in on_entries() argument
113 unsigned i, nr_entries = le32_to_cpu(ab->nr_entries); in on_entries()
116 fn(info->value_type.context, element_at(info, ab, i)); in on_entries()
122 static void inc_ablock_entries(struct dm_array_info *info, struct array_block *ab) in inc_ablock_entries() argument
127 on_entries(info, ab, vt->inc); in inc_ablock_entries()
133 static void dec_ablock_entries(struct dm_array_info *info, struct array_block *ab) in dec_ablock_entries() argument
138 on_entries(info, ab, vt->dec); in dec_ablock_entries()
154 struct dm_block **block, struct array_block **ab) in alloc_ablock() argument
162 (*ab) = dm_block_data(*block); in alloc_ablock()
163 (*ab)->max_entries = cpu_to_le32(max_entries); in alloc_ablock()
164 (*ab)->nr_entries = cpu_to_le32(0); in alloc_ablock()
165 (*ab)->value_size = cpu_to_le32(info->value_type.size); in alloc_ablock()
175 static void fill_ablock(struct dm_array_info *info, struct array_block *ab, in fill_ablock() argument
182 BUG_ON(new_nr > le32_to_cpu(ab->max_entries)); in fill_ablock()
183 BUG_ON(new_nr < le32_to_cpu(ab->nr_entries)); in fill_ablock()
185 nr_entries = le32_to_cpu(ab->nr_entries); in fill_ablock()
189 memcpy(element_at(info, ab, i), value, vt->size); in fill_ablock()
191 ab->nr_entries = cpu_to_le32(new_nr); in fill_ablock()
199 static void trim_ablock(struct dm_array_info *info, struct array_block *ab, in trim_ablock() argument
206 BUG_ON(new_nr > le32_to_cpu(ab->max_entries)); in trim_ablock()
207 BUG_ON(new_nr > le32_to_cpu(ab->nr_entries)); in trim_ablock()
209 nr_entries = le32_to_cpu(ab->nr_entries); in trim_ablock()
212 vt->dec(vt->context, element_at(info, ab, i - 1)); in trim_ablock()
213 ab->nr_entries = cpu_to_le32(new_nr); in trim_ablock()
221 struct dm_block **block, struct array_block **ab) in get_ablock() argument
229 *ab = dm_block_data(*block); in get_ablock()
255 struct array_block **ab) in lookup_ablock() argument
265 return get_ablock(info, le64_to_cpu(block_le), block, ab); in lookup_ablock()
283 struct dm_block **block, struct array_block **ab) in __shadow_ablock() argument
291 *ab = dm_block_data(*block); in __shadow_ablock()
293 inc_ablock_entries(info, *ab); in __shadow_ablock()
329 struct array_block **ab) in shadow_ablock() argument
341 r = __shadow_ablock(info, b, block, ab); in shadow_ablock()
358 struct array_block *ab; in insert_new_ablock() local
360 r = alloc_ablock(info, size_of_block, max_entries, &block, &ab); in insert_new_ablock()
364 fill_ablock(info, ab, value, nr); in insert_new_ablock()
470 struct array_block *ab; in shrink() local
491 resize->new_nr_full_blocks, &block, &ab); in shrink()
495 trim_ablock(resize->info, ab, resize->new_nr_entries_in_last_block); in shrink()
509 struct array_block *ab; in grow_extend_tail_block() local
512 resize->old_nr_full_blocks, &block, &ab); in grow_extend_tail_block()
516 fill_ablock(resize->info, ab, resize->value, new_nr_entries); in grow_extend_tail_block()
592 struct array_block *ab; in block_dec() local
610 r = get_ablock(info, b, &block, &ab); in block_dec()
617 dec_ablock_entries(info, ab); in block_dec()
698 static int populate_ablock_with_values(struct dm_array_info *info, struct array_block *ab, in populate_ablock_with_values() argument
705 BUG_ON(le32_to_cpu(ab->nr_entries)); in populate_ablock_with_values()
706 BUG_ON(new_nr > le32_to_cpu(ab->max_entries)); in populate_ablock_with_values()
709 r = fn(base + i, element_at(info, ab, i), context); in populate_ablock_with_values()
714 vt->inc(vt->context, element_at(info, ab, i)); in populate_ablock_with_values()
717 ab->nr_entries = cpu_to_le32(new_nr); in populate_ablock_with_values()
726 struct array_block *ab; in dm_array_new() local
738 r = alloc_ablock(info, size_of_block, max_entries, &block, &ab); in dm_array_new()
742 r = populate_ablock_with_values(info, ab, fn, context, in dm_array_new()
773 struct array_block *ab; in dm_array_get_value() local
780 r = lookup_ablock(info, root, index / max_entries, &block, &ab); in dm_array_get_value()
785 if (entry >= le32_to_cpu(ab->nr_entries)) in dm_array_get_value()
788 memcpy(value_le, element_at(info, ab, entry), in dm_array_get_value()
801 struct array_block *ab; in array_set_value() local
811 r = shadow_ablock(info, &root, index / max_entries, &block, &ab); in array_set_value()
817 if (entry >= le32_to_cpu(ab->nr_entries)) { in array_set_value()
822 old_value = element_at(info, ab, entry); in array_set_value()
864 struct array_block *ab; in walk_ablock() local
867 r = get_ablock(wi->info, le64_to_cpu(block_le), &block, &ab); in walk_ablock()
871 max_entries = le32_to_cpu(ab->max_entries); in walk_ablock()
872 nr_entries = le32_to_cpu(ab->nr_entries); in walk_ablock()
875 element_at(wi->info, ab, i)); in walk_ablock()
911 c->ab = NULL; in load_ablock()
920 r = get_ablock(c->info, le64_to_cpu(value_le), &c->block, &c->ab); in load_ablock()
965 if (c->index >= le32_to_cpu(c->ab->nr_entries)) { in dm_array_cursor_next()
984 uint32_t remaining = le32_to_cpu(c->ab->nr_entries) - c->index; in dm_array_cursor_skip()
1002 *value_le = element_at(c->info, c->ab, c->index); in dm_array_cursor_get_value()