From 6542c2fa943cd6607db33aa0f398de606fc56d26 Mon Sep 17 00:00:00 2001 From: Rafal Stefanowski Date: Wed, 19 Aug 2020 03:15:18 +0200 Subject: [PATCH] Fix memory requirement when loading cache Load properties before checking memory needs and obtain cache line size from context rather than from cache state. Signed-off-by: Rafal Stefanowski --- src/mngt/ocf_mngt_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mngt/ocf_mngt_cache.c b/src/mngt/ocf_mngt_cache.c index dc22da0..4879348 100644 --- a/src/mngt/ocf_mngt_cache.c +++ b/src/mngt/ocf_mngt_cache.c @@ -1289,7 +1289,7 @@ static void _ocf_mngt_attach_check_ram(ocf_pipeline_t pipeline, { struct ocf_cache_attach_context *context = priv; ocf_cache_t cache = context->cache; - ocf_cache_line_size_t line_size = ocf_line_size(cache); + ocf_cache_line_size_t line_size = context->metadata.line_size; uint64_t volume_size = ocf_volume_get_length(&cache->device->volume); uint64_t min_free_ram; uint64_t free_ram; @@ -1538,8 +1538,8 @@ struct ocf_pipeline_properties _ocf_mngt_cache_attach_pipeline_properties = { .finish = _ocf_mngt_cache_attach_finish, .steps = { OCF_PL_STEP(_ocf_mngt_attach_cache_device), - OCF_PL_STEP(_ocf_mngt_attach_check_ram), OCF_PL_STEP(_ocf_mngt_attach_load_properties), + OCF_PL_STEP(_ocf_mngt_attach_check_ram), OCF_PL_STEP(_ocf_mngt_attach_prepare_metadata), OCF_PL_STEP(_ocf_mngt_test_volume), OCF_PL_STEP(_ocf_mngt_attach_load_superblock),