Rename "data object" to "volume"
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
@@ -184,7 +184,8 @@ static inline int ocf_metadata_check_properties(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ocf_metadata_read_properties(ocf_ctx_t ctx, ocf_data_obj_t cache_obj,
|
||||
static int ocf_metadata_read_properties(ocf_ctx_t ctx,
|
||||
ocf_volume_t cache_volume,
|
||||
struct ocf_superblock_config *superblock)
|
||||
{
|
||||
ctx_data_t *data;
|
||||
@@ -195,7 +196,7 @@ static int ocf_metadata_read_properties(ocf_ctx_t ctx, ocf_data_obj_t cache_obj,
|
||||
return -EINVAL;
|
||||
|
||||
/* Allocate resources for IO */
|
||||
io = ocf_dobj_new_io(cache_obj);
|
||||
io = ocf_volume_new_io(cache_volume);
|
||||
data = ctx_data_alloc(ctx, 1);
|
||||
|
||||
/* Check allocation result */
|
||||
@@ -237,7 +238,7 @@ out:
|
||||
|
||||
/**
|
||||
* @brief function loads individual properties from metadata set
|
||||
* @param cache_obj object from which to load metadata
|
||||
* @param cache_volume volume from which to load metadata
|
||||
* @param variant - field to which save metadata variant; if NULL,
|
||||
* metadata variant won't be read.
|
||||
* @param cache mode; if NULL is passed it won't be read
|
||||
@@ -246,7 +247,7 @@ out:
|
||||
* the cache
|
||||
* @return 0 upon successful completion
|
||||
*/
|
||||
int ocf_metadata_load_properties(ocf_data_obj_t cache_obj,
|
||||
int ocf_metadata_load_properties(ocf_volume_t cache_volume,
|
||||
ocf_cache_line_size_t *line_size,
|
||||
ocf_metadata_layout_t *layout,
|
||||
ocf_cache_mode_t *cache_mode,
|
||||
@@ -259,28 +260,28 @@ int ocf_metadata_load_properties(ocf_data_obj_t cache_obj,
|
||||
/* Allocate first page of super block */
|
||||
superblock = env_zalloc(PAGE_SIZE, ENV_MEM_NORMAL);
|
||||
if (!superblock) {
|
||||
ocf_cache_log(cache_obj->cache, log_err,
|
||||
ocf_cache_log(cache_volume->cache, log_err,
|
||||
"Allocation memory error");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
OCF_DEBUG_TRACE(cache);
|
||||
|
||||
err_value = ocf_metadata_read_properties(cache_obj->cache->owner,
|
||||
cache_obj, superblock);
|
||||
err_value = ocf_metadata_read_properties(cache_volume->cache->owner,
|
||||
cache_volume, superblock);
|
||||
if (err_value)
|
||||
goto ocf_metadata_load_variant_ERROR;
|
||||
|
||||
if (superblock->magic_number != CACHE_MAGIC_NUMBER) {
|
||||
err_value = -ENODATA;
|
||||
ocf_cache_log(cache_obj->cache, log_info,
|
||||
ocf_cache_log(cache_volume->cache, log_info,
|
||||
"Can not detect pre-existing metadata\n");
|
||||
goto ocf_metadata_load_variant_ERROR;
|
||||
}
|
||||
|
||||
if (METADATA_VERSION() != superblock->metadata_version) {
|
||||
err_value = -EBADF;
|
||||
ocf_cache_log(cache_obj->cache, log_err,
|
||||
ocf_cache_log(cache_volume->cache, log_err,
|
||||
"Metadata version mismatch!\n");
|
||||
goto ocf_metadata_load_variant_ERROR;
|
||||
}
|
||||
@@ -290,7 +291,7 @@ int ocf_metadata_load_properties(ocf_data_obj_t cache_obj,
|
||||
*line_size = superblock->line_size;
|
||||
} else {
|
||||
err_value = -EINVAL;
|
||||
ocf_cache_log(cache_obj->cache, log_err,
|
||||
ocf_cache_log(cache_volume->cache, log_err,
|
||||
"ERROR: Invalid cache line size!\n");
|
||||
}
|
||||
}
|
||||
@@ -299,7 +300,7 @@ int ocf_metadata_load_properties(ocf_data_obj_t cache_obj,
|
||||
if (superblock->metadata_layout >= ocf_metadata_layout_max ||
|
||||
superblock->metadata_layout < 0) {
|
||||
err_value = -EINVAL;
|
||||
ocf_cache_log(cache_obj->cache, log_err,
|
||||
ocf_cache_log(cache_volume->cache, log_err,
|
||||
"ERROR: Invalid metadata layout!\n");
|
||||
} else {
|
||||
*layout = superblock->metadata_layout;
|
||||
@@ -310,7 +311,7 @@ int ocf_metadata_load_properties(ocf_data_obj_t cache_obj,
|
||||
if (superblock->cache_mode < ocf_cache_mode_max) {
|
||||
*cache_mode = superblock->cache_mode;
|
||||
} else {
|
||||
ocf_cache_log(cache_obj->cache, log_err,
|
||||
ocf_cache_log(cache_volume->cache, log_err,
|
||||
"ERROR: Invalid cache mode!\n");
|
||||
err_value = -EINVAL;
|
||||
}
|
||||
@@ -320,7 +321,7 @@ int ocf_metadata_load_properties(ocf_data_obj_t cache_obj,
|
||||
if (superblock->clean_shutdown <= ocf_metadata_clean_shutdown) {
|
||||
*shutdown_status = superblock->clean_shutdown;
|
||||
} else {
|
||||
ocf_cache_log(cache_obj->cache, log_err,
|
||||
ocf_cache_log(cache_volume->cache, log_err,
|
||||
"ERROR: Invalid shutdown status!\n");
|
||||
err_value = -EINVAL;
|
||||
}
|
||||
@@ -330,7 +331,7 @@ int ocf_metadata_load_properties(ocf_data_obj_t cache_obj,
|
||||
if (superblock->dirty_flushed <= DIRTY_FLUSHED) {
|
||||
*dirty_flushed = superblock->dirty_flushed;
|
||||
} else {
|
||||
ocf_cache_log(cache_obj->cache, log_err,
|
||||
ocf_cache_log(cache_volume->cache, log_err,
|
||||
"ERROR: Invalid flush status!\n");
|
||||
err_value = -EINVAL;
|
||||
}
|
||||
@@ -342,14 +343,14 @@ ocf_metadata_load_variant_ERROR:
|
||||
return err_value;
|
||||
}
|
||||
|
||||
int ocf_metadata_probe(ocf_ctx_t ctx, ocf_data_obj_t cache_obj,
|
||||
int ocf_metadata_probe(ocf_ctx_t ctx, ocf_volume_t cache_volume,
|
||||
bool *clean_shutdown, bool *cache_dirty)
|
||||
{
|
||||
struct ocf_superblock_config *superblock;
|
||||
int result = 0;
|
||||
|
||||
OCF_CHECK_NULL(ctx);
|
||||
OCF_CHECK_NULL(cache_obj);
|
||||
OCF_CHECK_NULL(cache_volume);
|
||||
|
||||
/* Allocate first page of super block */
|
||||
superblock = env_zalloc(PAGE_SIZE, ENV_MEM_NORMAL);
|
||||
@@ -360,7 +361,7 @@ int ocf_metadata_probe(ocf_ctx_t ctx, ocf_data_obj_t cache_obj,
|
||||
|
||||
OCF_DEBUG_TRACE(cache);
|
||||
|
||||
result = ocf_metadata_read_properties(ctx, cache_obj, superblock);
|
||||
result = ocf_metadata_read_properties(ctx, cache_volume, superblock);
|
||||
if (result)
|
||||
goto ocf_metadata_probe_END;
|
||||
|
||||
|
@@ -306,7 +306,7 @@ static inline ocf_cache_line_t ocf_metadata_entries_hash(
|
||||
return cache->metadata.iface.entries_hash(cache);
|
||||
}
|
||||
|
||||
int ocf_metadata_load_properties(ocf_data_obj_t cache_obj,
|
||||
int ocf_metadata_load_properties(ocf_volume_t cache_volume,
|
||||
ocf_cache_line_size_t *line_size,
|
||||
ocf_metadata_layout_t *layout,
|
||||
ocf_cache_mode_t *cache_mode,
|
||||
|
@@ -576,7 +576,7 @@ static int ocf_metadata_hash_init_variable_size(struct ocf_cache *cache,
|
||||
if (cache->device->init_mode == ocf_init_mode_metadata_volatile) {
|
||||
raw->raw_type = metadata_raw_type_volatile;
|
||||
} else if (i == metadata_segment_collision &&
|
||||
ocf_dobj_is_atomic(&cache->device->obj)) {
|
||||
ocf_volume_is_atomic(&cache->device->volume)) {
|
||||
raw->raw_type = metadata_raw_type_atomic;
|
||||
}
|
||||
|
||||
@@ -887,7 +887,7 @@ static int ocf_metadata_hash_load_superblock(struct ocf_cache *cache)
|
||||
struct ocf_superblock_config *sb_config;
|
||||
struct ocf_superblock_runtime *sb_runtime;
|
||||
struct ocf_metadata_uuid *muuid;
|
||||
struct ocf_data_obj_uuid uuid;
|
||||
struct ocf_volume_uuid uuid;
|
||||
|
||||
OCF_DEBUG_TRACE(cache);
|
||||
|
||||
@@ -973,9 +973,9 @@ static int ocf_metadata_hash_load_superblock(struct ocf_cache *cache)
|
||||
uuid.data = muuid->data;
|
||||
uuid.size = muuid->size;
|
||||
|
||||
/* Initialize core data object */
|
||||
ocf_dobj_init(&cache->core[i].obj,
|
||||
ocf_ctx_get_data_obj_type(cache->owner,
|
||||
/* Initialize core volume */
|
||||
ocf_volume_init(&cache->core[i].volume,
|
||||
ocf_ctx_get_volume_type(cache->owner,
|
||||
cache->core_conf_meta[i].type),
|
||||
&uuid, false);
|
||||
}
|
||||
@@ -1022,8 +1022,8 @@ static int ocf_metadata_hash_flush_superblock(struct ocf_cache *cache)
|
||||
|
||||
/* Synchronize core objects types */
|
||||
for (i = 0; i < OCF_CORE_MAX; i++) {
|
||||
cache->core_conf_meta[i].type = ocf_ctx_get_data_obj_type_id(
|
||||
cache->owner, cache->core[i].obj.type);
|
||||
cache->core_conf_meta[i].type = ocf_ctx_get_volume_type_id(
|
||||
cache->owner, cache->core[i].volume.type);
|
||||
}
|
||||
|
||||
/* Calculate checksum */
|
||||
@@ -1543,7 +1543,7 @@ static int ocf_metadata_hash_load_recovery(struct ocf_cache *cache)
|
||||
OCF_DEBUG_TRACE(cache);
|
||||
|
||||
|
||||
if (ocf_dobj_is_atomic(&cache->device->obj)) {
|
||||
if (ocf_volume_is_atomic(&cache->device->volume)) {
|
||||
result = _ocf_metadata_hash_load_recovery_atomic(cache);
|
||||
rebuild_dirty_only = false;
|
||||
} else {
|
||||
|
@@ -46,7 +46,7 @@ static struct ocf_io_if meta_restart_if = {
|
||||
*/
|
||||
static uint32_t metadata_io_max_page(struct ocf_cache *cache)
|
||||
{
|
||||
return ocf_dobj_get_max_io_size(&cache->device->obj) / PAGE_SIZE;
|
||||
return ocf_volume_get_max_io_size(&cache->device->volume) / PAGE_SIZE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -56,7 +56,7 @@ static void metadata_io_read_i_atomic_end(struct ocf_io *io, int error)
|
||||
{
|
||||
struct metadata_io_request_atomic *meta_atom_req = io->priv1;
|
||||
|
||||
OCF_DEBUG_TRACE(ocf_dobj_get_cache(io->obj));
|
||||
OCF_DEBUG_TRACE(ocf_volume_get_cache(io->volume));
|
||||
|
||||
meta_atom_req->error |= error;
|
||||
env_completion_complete(&meta_atom_req->complete);
|
||||
@@ -119,7 +119,7 @@ int metadata_io_read_i_atomic(struct ocf_cache *cache,
|
||||
}
|
||||
|
||||
/* Submit IO */
|
||||
ocf_dobj_submit_metadata(io);
|
||||
ocf_volume_submit_metadata(io);
|
||||
ocf_io_put(io);
|
||||
|
||||
/* Wait for completion of IO */
|
||||
@@ -194,7 +194,7 @@ static int ocf_restart_meta_io(struct ocf_request *req)
|
||||
metadata_io_write_i_asynch_end(meta_io_req, ret);
|
||||
return ret;
|
||||
}
|
||||
ocf_dobj_submit_io(io);
|
||||
ocf_volume_submit_io(io);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ int metadata_io_write_i_asynch(struct ocf_cache *cache, uint32_t queue,
|
||||
break;
|
||||
}
|
||||
|
||||
ocf_dobj_submit_io(io);
|
||||
ocf_volume_submit_io(io);
|
||||
}
|
||||
|
||||
count -= curr_count;
|
||||
@@ -507,7 +507,7 @@ static int metadata_submit_io(
|
||||
|
||||
/* Submit IO */
|
||||
env_atomic_inc(&mio->req_remaining);
|
||||
ocf_dobj_submit_io(io);
|
||||
ocf_volume_submit_io(io);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@@ -85,10 +85,10 @@ static int _raw_atomic_io_discard_do(struct ocf_cache *cache, void *context,
|
||||
ocf_io_configure(io, start_addr, len, OCF_WRITE, 0, 0);
|
||||
ocf_io_set_cmpl(io, ctx, NULL, _raw_atomic_io_discard_end);
|
||||
|
||||
if (cache->device->obj.features.discard_zeroes)
|
||||
ocf_dobj_submit_discard(io);
|
||||
if (cache->device->volume.features.discard_zeroes)
|
||||
ocf_volume_submit_discard(io);
|
||||
else
|
||||
ocf_dobj_submit_write_zeroes(io);
|
||||
ocf_volume_submit_write_zeroes(io);
|
||||
|
||||
return req->error;
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ struct ocf_superblock_config {
|
||||
ocf_metadata_layout_t metadata_layout;
|
||||
uint32_t core_count;
|
||||
|
||||
unsigned long valid_object_bitmap[(OCF_CORE_MAX /
|
||||
unsigned long valid_core_bitmap[(OCF_CORE_MAX /
|
||||
(sizeof(unsigned long) * 8)) + 1];
|
||||
|
||||
ocf_cleaning_t cleaning_policy_type;
|
||||
|
Reference in New Issue
Block a user