Merge pull request #637 from jfckm/fix-cache-size-req

Fix cache size requirements and some logging
This commit is contained in:
Robert Baldyga 2022-01-03 20:17:21 +01:00 committed by GitHub
commit 4d4cdece0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -31,7 +31,7 @@
/** /**
* Minimum cache size in bytes * Minimum cache size in bytes
*/ */
#define OCF_CACHE_SIZE_MIN (20 * MiB) #define OCF_CACHE_SIZE_MIN (40 * MiB)
/** /**
* Size of cache name * Size of cache name
*/ */

View File

@ -670,7 +670,7 @@ int ocf_metadata_init_variable_size(struct ocf_cache *cache,
/* TODO: This is just a rough check. Most optimal one would be /* TODO: This is just a rough check. Most optimal one would be
* located in calculate_metadata_size. */ * located in calculate_metadata_size. */
ocf_cache_log(cache, log_err, "Device exceeds maximum suported size " ocf_cache_log(cache, log_err, "Device exceeds maximum suported size "
"with this cache line size. Try bigger cache line size."); "with this cache line size. Try bigger cache line size.\n");
return -OCF_ERR_INVAL_CACHE_DEV; return -OCF_ERR_INVAL_CACHE_DEV;
} }
@ -712,7 +712,9 @@ int ocf_metadata_init_variable_size(struct ocf_cache *cache,
} }
if (0 != ocf_metadata_calculate_metadata_size(cache, ctrl, line_size)) { if (0 != ocf_metadata_calculate_metadata_size(cache, ctrl, line_size)) {
return -1; ocf_cache_log(cache, log_err, "Couldn't fit metadata structure "
"on device. Please try bigger cache device.\n");
return -OCF_ERR_INVAL_CACHE_DEV;
} }
OCF_DEBUG_PARAM(cache, "Metadata begin pages = %u", ctrl->start_page); OCF_DEBUG_PARAM(cache, "Metadata begin pages = %u", ctrl->start_page);

View File

@ -735,8 +735,8 @@ static void _ocf_mngt_attach_cache_device(ocf_pipeline_t pipeline,
/* Check minimum size of cache device */ /* Check minimum size of cache device */
if (context->volume_size < OCF_CACHE_SIZE_MIN) { if (context->volume_size < OCF_CACHE_SIZE_MIN) {
ocf_cache_log(cache, log_err, "ERROR: Cache cache size must " ocf_cache_log(cache, log_err, "Cache device size must "
"be at least %llu [MiB]\n", OCF_CACHE_SIZE_MIN / MiB); "be at least %llu MiB\n", OCF_CACHE_SIZE_MIN / MiB);
OCF_PL_FINISH_RET(pipeline, -OCF_ERR_INVAL_CACHE_DEV); OCF_PL_FINISH_RET(pipeline, -OCF_ERR_INVAL_CACHE_DEV);
} }