result = vdo_allocate(cache->page_count, struct page_info, "page infos",
&cache->infos);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = vdo_allocate_memory(size, VDO_BLOCK_SIZE, "cache pages", &cache->pages);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = vdo_int_map_create(cache->page_count, &cache->page_map);
result = vdo_allocate_extended(struct block_map,
vdo->thread_config.logical_zone_count,
struct block_map_zone, __func__, &map);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
map->vdo = vdo;
result = vdo_allocate_extended(struct data_vio_pool, pool_size, struct data_vio,
__func__, &pool);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
ASSERT_LOG_ONLY((discard_limit <= pool_size),
result = vdo_allocate(substring_count + 1, char *, "string-splitting array",
&substrings);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
for (s = string; *s != 0; s++) {
result = vdo_allocate(length + 1, char, "split string",
&substrings[current_substring]);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
free_string_array(substrings);
return result;
}
result = vdo_allocate(length + 1, char, "split string",
&substrings[current_substring]);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
free_string_array(substrings);
return result;
}
* Since the array is initially NULL, this also initializes the array the first time we allocate an
* instance number.
*
- * Return: UDS_SUCCESS or an error code from the allocation
+ * Return: VDO_SUCCESS or an error code from the allocation
*/
static int grow_bit_array(void)
{
get_bit_array_size(instances.bit_count),
get_bit_array_size(new_count),
"instance number bit array", &new_words);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
instances.bit_count = new_count;
instances.words = new_words;
- return UDS_SUCCESS;
+ return VDO_SUCCESS;
}
/**
* allocate_instance() - Allocate an instance number.
* @instance_ptr: A point to hold the instance number
*
- * Return: UDS_SUCCESS or an error code
+ * Return: VDO_SUCCESS or an error code
*
* This function must be called while holding the instances lock.
*/
/* If there are no unallocated instances, grow the bit array. */
if (instances.count >= instances.bit_count) {
result = grow_bit_array();
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
}
instances.count++;
instances.next = instance + 1;
*instance_ptr = instance;
- return UDS_SUCCESS;
+ return VDO_SUCCESS;
}
static int construct_new_vdo_registered(struct dm_target *ti, unsigned int argc,
int result;
result = vdo_allocate(1, struct partition, __func__, &partition);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
partition->id = id;
struct funnel_queue *queue;
result = vdo_allocate(1, struct funnel_queue, "funnel queue", &queue);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
/*
VDO_WORK_Q_MAX_PRIORITY);
result = vdo_allocate(1, struct simple_work_queue, "simple work queue", &queue);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
queue->private = private;
result = vdo_allocate(1, struct round_robin_work_queue, "round-robin work queue",
&queue);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = vdo_allocate(thread_count, struct simple_work_queue *,
"subordinate work queues", &queue->service_queues);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
vdo_free(queue);
return result;
}
struct open_chapter_index *index;
result = vdo_allocate(1, struct open_chapter_index, "open chapter index", &index);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
/*
return result;
result = vdo_allocate(1, struct uds_configuration, __func__, &config);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = uds_make_index_geometry(DEFAULT_BYTES_PER_PAGE, record_pages_per_chapter,
int result;
result = vdo_allocate(size, u8, "delta list", &delta_zone->memory);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = vdo_allocate(list_count + 2, u64, "delta list temp",
&delta_zone->new_offsets);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
/* Allocate the delta lists. */
result = vdo_allocate(list_count + 2, struct delta_list, "delta lists",
&delta_zone->delta_lists);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
compute_coding_constants(mean_delta, &delta_zone->min_bits,
result = vdo_allocate(zone_count, struct delta_zone, "Delta Index Zones",
&delta_index->delta_zones);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
delta_index->zone_count = zone_count;
u8 *data;
result = vdo_allocate(DELTA_LIST_MAX_BYTE_COUNT, u8, __func__, &data);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
for (z = 0; z < reader_count; z++) {
struct uds_request_queue *queue;
result = vdo_allocate(1, struct uds_request_queue, __func__, &queue);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
queue->processor = processor;
struct index_geometry *geometry;
result = vdo_allocate(1, struct index_geometry, "geometry", &geometry);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
geometry->bytes_per_page = bytes_per_page;
result = vdo_allocate_extended(struct region_table, region_count,
struct layout_region,
"layout region table for ISL", &table);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
lr = &table->regions[0];
size_t offset = 0;
result = vdo_allocate(table->encoded_size, u8, "index save data", &buffer);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
encode_region_table(buffer, &offset, table);
result = vdo_allocate_extended(struct region_table, region_count,
struct layout_region, "layout region table",
&table);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
lr = &table->regions[0];
size_t offset = 0;
result = vdo_allocate(table->encoded_size, u8, "layout data", &buffer);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
encode_region_table(buffer, &offset, table);
result = vdo_allocate(sizes.save_count, struct index_save_layout, __func__,
&layout->index.saves);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
initialize_layout(layout, &sizes);
result = vdo_allocate_extended(struct region_table, header.region_count,
struct layout_region,
"single file layout region table", &table);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
table->header = header;
size_t offset = 0;
result = vdo_allocate(saved_size, u8, "super block data", &buffer);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = uds_read_from_buffered_reader(reader, buffer, saved_size);
result = vdo_allocate(layout->super.max_saves, struct index_save_layout,
__func__, &layout->index.saves);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
layout->total_blocks = table->header.region_blocks;
return result;
result = vdo_allocate(1, struct index_layout, __func__, &layout);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = create_layout_factory(layout, config);
struct index_page_map *map;
result = vdo_allocate(1, struct index_page_map, "page map", &map);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
map->geometry = geometry;
map->entries_per_chapter = geometry->index_pages_per_chapter - 1;
result = vdo_allocate(get_entry_count(geometry), u16, "Index Page Map Entries",
&map->entries);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
uds_free_index_page_map(map);
return result;
}
u32 i;
result = vdo_allocate(saved_size, u8, "page map data", &buffer);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
memcpy(buffer, PAGE_MAP_MAGIC, PAGE_MAP_MAGIC_LENGTH);
u32 i;
result = vdo_allocate(saved_size, u8, "page map data", &buffer);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = uds_read_from_buffered_reader(reader, buffer, saved_size);
struct uds_index_session *session;
result = vdo_allocate(1, struct uds_index_session, __func__, &session);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
mutex_init(&session->request_mutex);
struct uds_request *request;
result = vdo_allocate(1, struct uds_request, __func__, &request);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
request->index = index;
result = vdo_allocate_extended(struct chapter_writer, index->zone_count,
struct open_chapter_zone *, "Chapter Writer",
&writer);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
writer->index = index;
result = vdo_allocate_cache_aligned(collated_records_size, "collated records",
&writer->collated_records);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
free_chapter_writer(writer);
return result;
}
struct index_zone *zone;
result = vdo_allocate(1, struct index_zone, "index zone", &zone);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = uds_make_open_chapter(index->volume->geometry, index->zone_count,
result = vdo_allocate_extended(struct uds_index, config->zone_count,
struct uds_request_queue *, "index", &index);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
index->zone_count = config->zone_count;
result = vdo_allocate(index->zone_count, struct index_zone *, "zones",
&index->zones);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
uds_free_index(index);
return result;
}
struct io_factory *factory;
result = vdo_allocate(1, struct io_factory, __func__, &factory);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
factory->bdev = bdev;
return result;
result = vdo_allocate(1, struct buffered_reader, "buffered reader", &reader);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
dm_bufio_client_destroy(client);
return result;
}
return result;
result = vdo_allocate(1, struct buffered_writer, "buffered writer", &writer);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
dm_bufio_client_destroy(client);
return result;
}
result = vdo_allocate_extended(struct open_chapter_zone, slot_count,
struct open_chapter_zone_slot, "open chapter",
&open_chapter);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
open_chapter->slot_count = slot_count;
open_chapter->capacity = capacity;
result = vdo_allocate_cache_aligned(records_size(open_chapter), "record pages",
&open_chapter->records);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
uds_free_open_chapter(open_chapter);
return result;
}
result = vdo_allocate_extended(struct radix_sorter, stack_size, struct task,
__func__, &radix_sorter);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
radix_sorter->count = count;
result = vdo_allocate(chapter->index_pages_count, struct delta_index_page,
__func__, &chapter->index_pages);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
return vdo_allocate(chapter->index_pages_count, struct dm_buffer *,
bytes = (sizeof(struct search_list) +
(cache->capacity * sizeof(struct cached_chapter_index *)));
result = vdo_allocate_cache_aligned(bytes, "search list", &list);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
list->capacity = cache->capacity;
bytes = (sizeof(struct sparse_cache) + (capacity * sizeof(struct cached_chapter_index)));
result = vdo_allocate_cache_aligned(bytes, "sparse cache", &cache);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
cache->geometry = geometry;
/* purge_search_list() needs some temporary lists for sorting. */
result = vdo_allocate(capacity * 2, struct cached_chapter_index *,
"scratch entries", &cache->scratch_entries);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
goto out;
*cache_ptr = cache;
/* The following arrays are initialized to all zeros. */
result = vdo_allocate(params.list_count, u64, "first chapter to flush",
&sub_index->flush_chapters);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
return vdo_allocate(zone_count, struct volume_sub_index_zone,
int result;
result = vdo_allocate(1, struct volume_index, "volume index", &volume_index);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
volume_index->zone_count = config->zone_count;
result = vdo_allocate(config->zone_count, struct volume_index_zone,
"volume index zones", &volume_index->zones);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
uds_free_volume_index(volume_index);
return result;
}
result = vdo_allocate(VOLUME_CACHE_MAX_QUEUED_READS, struct queued_read,
"volume read queue", &cache->read_queue);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = vdo_allocate(cache->zone_count, struct search_pending_counter,
"Volume Cache Zones", &cache->search_pending_counters);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = vdo_allocate(cache->indexable_pages, u16, "page cache index",
&cache->index);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
result = vdo_allocate(cache->cache_slots, struct cached_page, "page cache cache",
&cache->cache);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
/* Initialize index values to invalid values. */
int result;
result = vdo_allocate(1, struct volume, "volume", &volume);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
volume->nonce = uds_get_volume_nonce(layout);
result = vdo_allocate(geometry->records_per_page,
const struct uds_volume_record *, "record pointers",
&volume->record_pointers);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
uds_free_volume(volume);
return result;
}
result = vdo_allocate(config->read_threads, struct thread *, "reader threads",
&volume->reader_threads);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
uds_free_volume(volume);
return result;
}
* @map: The map to initialize.
* @capacity: The initial capacity of the map.
*
- * Return: UDS_SUCCESS or an error code.
+ * Return: VDO_SUCCESS or an error code.
*/
static int allocate_buckets(struct int_map *map, size_t capacity)
{
* tells the map to use its own small default).
* @map_ptr: Output, a pointer to hold the new int_map.
*
- * Return: UDS_SUCCESS or an error code.
+ * Return: VDO_SUCCESS or an error code.
*/
int vdo_int_map_create(size_t initial_capacity, struct int_map **map_ptr)
{
size_t capacity;
result = vdo_allocate(1, struct int_map, "struct int_map", &map);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
/* Use the default capacity if the caller did not specify one. */
capacity = capacity * 100 / DEFAULT_LOAD;
result = allocate_buckets(map, capacity);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
vdo_int_map_free(vdo_forget(map));
return result;
}
*map_ptr = map;
- return UDS_SUCCESS;
+ return VDO_SUCCESS;
}
/**
*
* Resizes and rehashes all the existing entries, storing them in the new buckets.
*
- * Return: UDS_SUCCESS or an error code.
+ * Return: VDO_SUCCESS or an error code.
*/
static int resize_buckets(struct int_map *map)
{
uds_log_info("%s: attempting resize from %zu to %zu, current size=%zu",
__func__, map->capacity, new_capacity, map->size);
result = allocate_buckets(map, new_capacity);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
*map = old_map;
return result;
}
/* Destroy the old bucket array. */
vdo_free(vdo_forget(old_map.buckets));
- return UDS_SUCCESS;
+ return VDO_SUCCESS;
}
/**
* large maps).
*/
result = resize_buckets(map);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
/*
result = vdo_allocate_extended(struct io_submitter, thread_count,
struct bio_queue_data, "bio submission data",
&io_submitter);
- if (result != UDS_SUCCESS)
+ if (result != VDO_SUCCESS)
return result;
io_submitter->bio_queue_rotation_interval = rotation_interval;
int result;
result = vdo_allocate(1, struct vdo_statistics, __func__, &stats);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
uds_log_error("Cannot allocate memory to write VDO statistics");
return result;
}
bytes = (slab->reference_block_count * COUNTS_PER_BLOCK) + (2 * BYTES_PER_WORD);
result = vdo_allocate(bytes, vdo_refcount_t, "ref counts array",
&slab->counters);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
vdo_free(vdo_forget(slab->reference_blocks));
return result;
}
int result;
result = vdo_allocate(1, struct thread, __func__, &thread);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
uds_log_warning("Error allocating memory for %s", name);
return result;
}
{
char *string;
- if (vdo_allocate(length + 1, char, __func__, &string) != UDS_SUCCESS)
+ if (vdo_allocate(length + 1, char, __func__, &string) != VDO_SUCCESS)
return NULL;
memcpy(string, buf, length);
*reason = "Unspecified error";
result = vdo_allocate(1, struct vdo, __func__, &vdo);
- if (result != UDS_SUCCESS) {
+ if (result != VDO_SUCCESS) {
*reason = "Cannot allocate VDO";
return result;
}