commit
f5588bbada
@ -905,10 +905,10 @@ static int cache_mng_initialize_core_objects(ocf_cache_t cache)
|
|||||||
|
|
||||||
int cache_mng_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
|
int cache_mng_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
|
||||||
struct ocf_mngt_cache_device_config *device_cfg,
|
struct ocf_mngt_cache_device_config *device_cfg,
|
||||||
|
struct atomic_dev_params *atomic_params,
|
||||||
struct kcas_start_cache *cmd)
|
struct kcas_start_cache *cmd)
|
||||||
{
|
{
|
||||||
int init_cache, result;
|
int init_cache, result;
|
||||||
struct atomic_dev_params atomic_params = { 0 };
|
|
||||||
struct block_device *bdev;
|
struct block_device *bdev;
|
||||||
int part_count;
|
int part_count;
|
||||||
char holder[] = "CAS START\n";
|
char holder[] = "CAS START\n";
|
||||||
@ -965,12 +965,15 @@ int cache_mng_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
|
|||||||
return -KCAS_ERR_CONTAINS_PART;
|
return -KCAS_ERR_CONTAINS_PART;
|
||||||
|
|
||||||
result = cas_blk_identify_type_atomic(device_cfg->uuid.data,
|
result = cas_blk_identify_type_atomic(device_cfg->uuid.data,
|
||||||
&device_cfg->volume_type, &atomic_params);
|
&device_cfg->volume_type, atomic_params);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
if (device_cfg->volume_type == ATOMIC_DEVICE_VOLUME)
|
||||||
|
device_cfg->volume_params = atomic_params;
|
||||||
|
|
||||||
cmd->metadata_mode_optimal =
|
cmd->metadata_mode_optimal =
|
||||||
block_dev_is_metadata_mode_optimal(&atomic_params,
|
block_dev_is_metadata_mode_optimal(atomic_params,
|
||||||
device_cfg->volume_type);
|
device_cfg->volume_type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#define CAS_BLK_DEV_REQ_TYPE_BIO 1
|
#define CAS_BLK_DEV_REQ_TYPE_BIO 1
|
||||||
#define CAS_BLK_DEV_REQ_TYPE_REQ 3
|
#define CAS_BLK_DEV_REQ_TYPE_REQ 3
|
||||||
|
|
||||||
|
struct atomic_dev_params;
|
||||||
|
|
||||||
int cache_mng_set_cleaning_policy(ocf_cache_id_t cache_id, uint32_t type);
|
int cache_mng_set_cleaning_policy(ocf_cache_id_t cache_id, uint32_t type);
|
||||||
|
|
||||||
int cache_mng_get_cleaning_policy(ocf_cache_id_t cache_id, uint32_t *type);
|
int cache_mng_get_cleaning_policy(ocf_cache_id_t cache_id, uint32_t *type);
|
||||||
@ -32,6 +34,7 @@ int cache_mng_exit_instance(ocf_cache_id_t id, int flush);
|
|||||||
|
|
||||||
int cache_mng_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
|
int cache_mng_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
|
||||||
struct ocf_mngt_cache_device_config *device_cfg,
|
struct ocf_mngt_cache_device_config *device_cfg,
|
||||||
|
struct atomic_dev_params *atomic_params,
|
||||||
struct kcas_start_cache *cmd);
|
struct kcas_start_cache *cmd);
|
||||||
|
|
||||||
int cache_mng_core_pool_get_paths(struct kcas_core_pool_path *cmd_info);
|
int cache_mng_core_pool_get_paths(struct kcas_core_pool_path *cmd_info);
|
||||||
|
@ -810,8 +810,9 @@ static int _cas_upgrade_restore_conf_main(struct cas_properties *cache_props,
|
|||||||
uint64_t cache_mode, cache_line_size;
|
uint64_t cache_mode, cache_line_size;
|
||||||
uint64_t cache_type, version;
|
uint64_t cache_type, version;
|
||||||
char *cache_path = NULL;
|
char *cache_path = NULL;
|
||||||
struct ocf_mngt_cache_config cfg;
|
struct ocf_mngt_cache_config cfg = {};
|
||||||
struct ocf_mngt_cache_device_config device_cfg;
|
struct ocf_mngt_cache_device_config device_cfg = {};
|
||||||
|
struct atomic_dev_params atomic_params = {};
|
||||||
|
|
||||||
CAS_DEBUG_TRACE();
|
CAS_DEBUG_TRACE();
|
||||||
|
|
||||||
@ -853,9 +854,6 @@ static int _cas_upgrade_restore_conf_main(struct cas_properties *cache_props,
|
|||||||
if (cache_mode >= ocf_cache_mode_max)
|
if (cache_mode >= ocf_cache_mode_max)
|
||||||
cache_mode = ocf_cache_mode_default;
|
cache_mode = ocf_cache_mode_default;
|
||||||
|
|
||||||
memset(&cfg, 0, sizeof(cfg));
|
|
||||||
memset(&device_cfg, 0, sizeof(device_cfg));
|
|
||||||
|
|
||||||
cfg.id = *cache_id;
|
cfg.id = *cache_id;
|
||||||
cfg.cache_mode = cache_mode;
|
cfg.cache_mode = cache_mode;
|
||||||
/* cfg.eviction_policy = TODO */
|
/* cfg.eviction_policy = TODO */
|
||||||
@ -876,6 +874,18 @@ static int _cas_upgrade_restore_conf_main(struct cas_properties *cache_props,
|
|||||||
device_cfg.perform_test = true;
|
device_cfg.perform_test = true;
|
||||||
device_cfg.force = false;
|
device_cfg.force = false;
|
||||||
|
|
||||||
|
if (device_cfg.volume_type == ATOMIC_DEVICE_VOLUME) {
|
||||||
|
result = cas_blk_identify_type_atomic(device_cfg.uuid.data,
|
||||||
|
&device_cfg.volume_type, &atomic_params);
|
||||||
|
if (result)
|
||||||
|
goto error;
|
||||||
|
if (device_cfg.volume_type != ATOMIC_DEVICE_VOLUME) {
|
||||||
|
result = -OCF_ERR_INVAL_VOLUME_TYPE;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
device_cfg.volume_params = &atomic_params;
|
||||||
|
}
|
||||||
|
|
||||||
result = cache_mng_init_instance(&cfg, &device_cfg, NULL);
|
result = cache_mng_init_instance(&cfg, &device_cfg, NULL);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -131,10 +131,12 @@ long cas_service_ioctl_ctrl(struct file *filp, unsigned int cmd,
|
|||||||
struct kcas_start_cache *cmd_info;
|
struct kcas_start_cache *cmd_info;
|
||||||
struct ocf_mngt_cache_config cfg;
|
struct ocf_mngt_cache_config cfg;
|
||||||
struct ocf_mngt_cache_device_config device_cfg;
|
struct ocf_mngt_cache_device_config device_cfg;
|
||||||
|
struct atomic_dev_params atomic_params = { 0 };
|
||||||
|
|
||||||
GET_CMD_INFO(cmd_info, arg);
|
GET_CMD_INFO(cmd_info, arg);
|
||||||
|
|
||||||
retval = cache_mng_prepare_cache_cfg(&cfg, &device_cfg, cmd_info);
|
retval = cache_mng_prepare_cache_cfg(&cfg, &device_cfg,
|
||||||
|
&atomic_params, cmd_info);
|
||||||
if (retval)
|
if (retval)
|
||||||
RETURN_CMD_RESULT(cmd_info, arg, retval);
|
RETURN_CMD_RESULT(cmd_info, arg, retval);
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ unsigned int cas_atomic_get_max_io_size(ocf_volume_t volume)
|
|||||||
if (!bd->bd_disk)
|
if (!bd->bd_disk)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return queue_max_sectors(bd->bd_disk->queue);
|
return queue_max_sectors(bd->bd_disk->queue) << SECTOR_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cas_atomic_close_object(ocf_volume_t volume)
|
void cas_atomic_close_object(ocf_volume_t volume)
|
||||||
@ -986,26 +986,22 @@ void cas_atomic_close_object(ocf_volume_t volume)
|
|||||||
block_dev_close_object(volume);
|
block_dev_close_object(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cas_atomic_open_object(ocf_volume_t volume)
|
int cas_atomic_open_object(ocf_volume_t volume, void *volume_params)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
uint8_t type;
|
|
||||||
struct bd_object *bdobj = NULL;
|
struct bd_object *bdobj = NULL;
|
||||||
|
|
||||||
result = block_dev_open_object(volume);
|
if (!volume_params)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
result = block_dev_open_object(volume, volume_params);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
bdobj = bd_object(volume);
|
bdobj = bd_object(volume);
|
||||||
|
|
||||||
result = cas_blk_identify_type_by_bdev(bdobj->btm_bd,
|
memcpy(&bdobj->atomic_params, volume_params,
|
||||||
&type, &bdobj->atomic_params);
|
sizeof(bdobj->atomic_params));
|
||||||
|
|
||||||
if (type != ATOMIC_DEVICE_VOLUME) {
|
|
||||||
cas_atomic_close_object(volume);
|
|
||||||
result = -OCF_ERR_INVAL_VOLUME_TYPE;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
bdobj->workqueue = create_workqueue("CAS_AT_ZER");
|
bdobj->workqueue = create_workqueue("CAS_AT_ZER");
|
||||||
if (!bdobj->workqueue) {
|
if (!bdobj->workqueue) {
|
||||||
|
@ -412,7 +412,7 @@ int cas_blk_open_volume_by_bdev(ocf_volume_t *vol,
|
|||||||
bdobj->btm_bd = bdev;
|
bdobj->btm_bd = bdev;
|
||||||
bdobj->opened_by_bdev = true;
|
bdobj->opened_by_bdev = true;
|
||||||
|
|
||||||
ocf_volume_open(*vol);
|
ocf_volume_open(*vol, &atomic_params);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#define CAS_DEBUG_PARAM(format, ...)
|
#define CAS_DEBUG_PARAM(format, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int block_dev_open_object(ocf_volume_t vol)
|
int block_dev_open_object(ocf_volume_t vol, void *volume_params)
|
||||||
{
|
{
|
||||||
struct bd_object *bdobj = bd_object(vol);
|
struct bd_object *bdobj = bd_object(vol);
|
||||||
const struct ocf_volume_uuid *uuid = ocf_volume_get_uuid(vol);
|
const struct ocf_volume_uuid *uuid = ocf_volume_get_uuid(vol);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "../cas_cache.h"
|
#include "../cas_cache.h"
|
||||||
|
|
||||||
int block_dev_open_object(ocf_volume_t vol);
|
int block_dev_open_object(ocf_volume_t vol, void *volume_params);
|
||||||
|
|
||||||
void block_dev_close_object(ocf_volume_t vol);
|
void block_dev_close_object(ocf_volume_t vol);
|
||||||
|
|
||||||
|
2
ocf
2
ocf
@ -1 +1 @@
|
|||||||
Subproject commit 40f1e9e0d3cd06e01dce4a0117c19ff107f74370
|
Subproject commit 0192f4070d38dc0e92161a73ad584963a3e4a660
|
Loading…
Reference in New Issue
Block a user