From 527e3deb74ac4609be32a2b69adb9541fecad6e7 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Sat, 11 May 2024 00:35:24 +0200 Subject: [PATCH 1/6] Remove accidentally added .swp file Signed-off-by: Robert Baldyga --- src/engine/.cache_engine.h.swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/engine/.cache_engine.h.swp diff --git a/src/engine/.cache_engine.h.swp b/src/engine/.cache_engine.h.swp deleted file mode 100644 index 7f6b08e9802be2dafc1fd253b33a2cb1af74f597..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2&2Jk;7>6gEx`h@55?rU`fMeNp;s~e+99-L}tu~1jrymHxXuLb?9kJe7cE@p3 z)FN?1NL;wJ2o7+l_ygbuM+6sC4seAd9}*`{fW&Xsc4|4B6Y@9s1AGJS00rvc8SwilLcRuHfxF-Xa075q0uDF<{(Ov(pTLjc6Yw#3A29F+ zxCmO{0yqtRd6bZ!!AIZ@xCX9*0(cJmc9M`^!I$6*a2wnLH^Dk+f|I}jKfuF1V0?UQ zoY=z}um-FFYrqdab*|I<=h^+uU+i zR!M%_tIe+SA|ZJb9<#o@rO#-JRXm?9{0s#xW_Ef?g_$;=hhdMqZ?af3nKBg>Opx)W zRZX+AvAN$LSxs68$`dT$DGT|HJvK_D7TMUj9-5ktCWfmbJRdjU2`!pQ`T|obCVlP- z7V*I$!^gQygE&r>pGpKnESyR-&&0S0_G>2*sS0Oc*3?u=g5Els1X<26A99b_})q-WkE^oBA> z5J|+ttUyxJKR5bF(O0tN-+yFmq!1z}_(6DDsYxP!>H8(G`H=C@* z$fEQkQ|Sj=h{>H6X}8n3R=y-%5v8Ks_C%zmFGcbaJ>PAVSIhN~W3i@VUB!Ee><7Bw dF45}pO0`^Fu2yLq Date: Sat, 11 May 2024 00:00:19 +0200 Subject: [PATCH 2/6] Move declaration to the right header Signed-off-by: Robert Baldyga --- src/concurrency/ocf_cache_line_concurrency.h | 18 +----------------- src/utils/utils_alock.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/concurrency/ocf_cache_line_concurrency.h b/src/concurrency/ocf_cache_line_concurrency.h index b42d1647..ece2079d 100644 --- a/src/concurrency/ocf_cache_line_concurrency.h +++ b/src/concurrency/ocf_cache_line_concurrency.h @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -111,23 +112,6 @@ void ocf_req_unlock_rd(struct ocf_alock *c, void ocf_req_unlock(struct ocf_alock *c, struct ocf_request *req); -/** - * @Check if cache line is used. - * - * Cache line is used when: - * 1. It is locked for write or read access - * or - * 2. There is set locked bit in metadata - * - * @param cache - OCF cache instance - * @param line - Cache line to be unlocked - * - * @retval true - cache line is used - * @retval false - cache line is not used - */ -bool ocf_cache_line_is_used(struct ocf_alock *c, - ocf_cache_line_t line); - /** * @brief Check if for specified cache line there are waiters * on the waiting list diff --git a/src/utils/utils_alock.h b/src/utils/utils_alock.h index 4fb5fe26..8a36a63f 100644 --- a/src/utils/utils_alock.h +++ b/src/utils/utils_alock.h @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2022 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ #ifndef OCF_UTILS_ALOCK_H_ @@ -54,6 +55,23 @@ int ocf_alock_lock_rd(struct ocf_alock *alock, int ocf_alock_lock_wr(struct ocf_alock *alock, struct ocf_request *req, ocf_req_async_lock_cb cmpl); +/** + * @Check if cache line is used. + * + * Cache line is used when: + * 1. It is locked for write or read access + * or + * 2. There is set locked bit in metadata + * + * @param cache - OCF cache instance + * @param line - Cache line to be unlocked + * + * @retval true - cache line is used + * @retval false - cache line is not used + */ +bool ocf_cache_line_is_used(struct ocf_alock *c, + ocf_cache_line_t line); + bool ocf_alock_waitlist_is_empty(struct ocf_alock *alock, ocf_cache_line_t entry); From 253734b160fe89558c6e21334024191a2336f0d6 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Sat, 11 May 2024 00:02:30 +0200 Subject: [PATCH 3/6] Move misplaced function declaration to the appropriate header Signed-off-by: Robert Baldyga --- src/metadata/metadata_segment.h | 9 +++++++++ src/metadata/metadata_superblock.c | 10 ++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/metadata/metadata_segment.h b/src/metadata/metadata_segment.h index b97280b7..f57e3cd5 100644 --- a/src/metadata/metadata_segment.h +++ b/src/metadata/metadata_segment.h @@ -1,5 +1,6 @@ /* * Copyright(c) 2020-2021 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -16,6 +17,14 @@ struct ocf_metadata_segment struct ocf_metadata_segment *superblock; }; +int ocf_metadata_segment_init_in_place( + struct ocf_metadata_segment *segment, + struct ocf_cache *cache, + struct ocf_metadata_raw *raw, + ocf_flush_page_synch_t lock_page_pfn, + ocf_flush_page_synch_t unlock_page_pfn, + struct ocf_metadata_segment *superblock); + int ocf_metadata_segment_init( struct ocf_metadata_segment **self, struct ocf_cache *cache, diff --git a/src/metadata/metadata_superblock.c b/src/metadata/metadata_superblock.c index ef0be1f7..ed53ea65 100644 --- a/src/metadata/metadata_superblock.c +++ b/src/metadata/metadata_superblock.c @@ -1,11 +1,13 @@ /* * Copyright(c) 2020-2022 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ #include "metadata.h" #include "metadata_core.h" #include "metadata_internal.h" +#include "metadata_segment.h" #include "metadata_segment_id.h" #include "metadata_superblock.h" #include "../ocf_priv.h" @@ -26,14 +28,6 @@ #define OCF_DEBUG_PARAM(cache, format, ...) #endif -int ocf_metadata_segment_init_in_place( - struct ocf_metadata_segment *segment, - struct ocf_cache *cache, - struct ocf_metadata_raw *raw, - ocf_flush_page_synch_t lock_page_pfn, - ocf_flush_page_synch_t unlock_page_pfn, - struct ocf_metadata_segment *superblock); - /** * @brief Super Block - Set Shutdown Status * From 43608fc81271f9b9b373379ef25172a559e198d2 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Sat, 11 May 2024 00:02:52 +0200 Subject: [PATCH 4/6] Remove unused function Signed-off-by: Robert Baldyga --- src/ocf_core.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/ocf_core.c b/src/ocf_core.c index 16fb0c0a..011816ac 100644 --- a/src/ocf_core.c +++ b/src/ocf_core.c @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -95,17 +96,6 @@ bool ocf_core_is_valid(ocf_cache_t cache, ocf_core_id_t id) return true; } -int ocf_core_get(ocf_cache_t cache, ocf_core_id_t id, ocf_core_t *core) -{ - OCF_CHECK_NULL(cache); - - if (!ocf_core_is_valid(cache, id)) - return -OCF_ERR_CORE_NOT_AVAIL; - - *core = &cache->core[id]; - return 0; -} - uint32_t ocf_core_get_seq_cutoff_threshold(ocf_core_t core) { return env_atomic_read(&core->conf_meta->seq_cutoff_threshold); From 578f4b6591b22efc351d266beba8586c2054c8a7 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Sat, 11 May 2024 00:01:24 +0200 Subject: [PATCH 5/6] Add missing headers Signed-off-by: Robert Baldyga --- src/concurrency/ocf_pio_concurrency.c | 1 + src/engine/engine_wo.c | 2 ++ src/engine/engine_wo.h | 3 +++ src/mngt/ocf_mngt_core_pool.c | 2 ++ 4 files changed, 8 insertions(+) diff --git a/src/concurrency/ocf_pio_concurrency.c b/src/concurrency/ocf_pio_concurrency.c index 2fdd5c2a..9ed42e58 100644 --- a/src/concurrency/ocf_pio_concurrency.c +++ b/src/concurrency/ocf_pio_concurrency.c @@ -5,6 +5,7 @@ */ #include "ocf_concurrency.h" +#include "ocf_pio_concurrency.h" #include "../metadata/metadata_internal.h" #include "../metadata/metadata_io.h" #include "../ocf_priv.h" diff --git a/src/engine/engine_wo.c b/src/engine/engine_wo.c index 513f7474..a164932f 100644 --- a/src/engine/engine_wo.c +++ b/src/engine/engine_wo.c @@ -1,9 +1,11 @@ /* * Copyright(c) 2019-2022 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ #include "ocf/ocf.h" +#include "engine_wo.h" #include "../ocf_cache_priv.h" #include "cache_engine.h" #include "engine_common.h" diff --git a/src/engine/engine_wo.h b/src/engine/engine_wo.h index 31a7c746..3c53e43c 100644 --- a/src/engine/engine_wo.h +++ b/src/engine/engine_wo.h @@ -1,11 +1,14 @@ /* * Copyright(c) 2019-2021 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ #ifndef ENGINE_WO_H_ #define ENGINE_WO_H_ +#include "engine_common.h" + int ocf_read_wo(struct ocf_request *req); #endif /* ENGINE_WO_H_ */ diff --git a/src/mngt/ocf_mngt_core_pool.c b/src/mngt/ocf_mngt_core_pool.c index c76dba95..aae12454 100644 --- a/src/mngt/ocf_mngt_core_pool.c +++ b/src/mngt/ocf_mngt_core_pool.c @@ -1,9 +1,11 @@ /* * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ #include "ocf/ocf.h" +#include "ocf_mngt_core_pool_priv.h" #include "ocf_mngt_common.h" #include "../ocf_priv.h" #include "../ocf_core_priv.h" From 168ecd00752eb44f1ae10f41cb4e0a61073905cb Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Sat, 11 May 2024 00:03:26 +0200 Subject: [PATCH 6/6] Add missing "static" to the local function Signed-off-by: Robert Baldyga --- src/engine/engine_discard.c | 2 +- src/engine/engine_wi.c | 3 ++- src/engine/engine_wo.c | 2 +- src/metadata/metadata_io.c | 7 ++++--- src/metadata/metadata_raw.c | 3 ++- src/metadata/metadata_raw_dynamic.c | 3 ++- src/mngt/ocf_mngt_cache.c | 8 ++++---- src/mngt/ocf_mngt_flush.c | 3 ++- src/ocf_core.c | 2 +- src/ocf_seq_cutoff.c | 3 ++- src/utils/utils_async_lock.c | 5 +++-- src/utils/utils_rbtree.c | 3 ++- 12 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/engine/engine_discard.c b/src/engine/engine_discard.c index 24ee502a..38532de7 100644 --- a/src/engine/engine_discard.c +++ b/src/engine/engine_discard.c @@ -136,7 +136,7 @@ static void _ocf_discard_step_complete(struct ocf_request *req, int error) _ocf_discard_finish_step(req); } -int _ocf_discard_step_do(struct ocf_request *req) +static int _ocf_discard_step_do(struct ocf_request *req) { struct ocf_cache *cache = req->cache; diff --git a/src/engine/engine_wi.c b/src/engine/engine_wi.c index f5076d28..6db17a47 100644 --- a/src/engine/engine_wi.c +++ b/src/engine/engine_wi.c @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2022 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -16,7 +17,7 @@ #define OCF_ENGINE_DEBUG_IO_NAME "wi" #include "engine_debug.h" -int _ocf_write_wi_next_pass(struct ocf_request *req) +static int _ocf_write_wi_next_pass(struct ocf_request *req) { ocf_req_unlock_wr(ocf_cache_line_concurrency(req->cache), req); diff --git a/src/engine/engine_wo.c b/src/engine/engine_wo.c index a164932f..1b6afee3 100644 --- a/src/engine/engine_wo.c +++ b/src/engine/engine_wo.c @@ -174,7 +174,7 @@ static void _ocf_read_wo_core_complete(struct ocf_request *req, int error) ocf_engine_push_req_front(req, true); } -int ocf_read_wo_do(struct ocf_request *req) +static int ocf_read_wo_do(struct ocf_request *req) { ocf_req_get(req); diff --git a/src/metadata/metadata_io.c b/src/metadata/metadata_io.c index 420f0c6f..65a47787 100644 --- a/src/metadata/metadata_io.c +++ b/src/metadata/metadata_io.c @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2022 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ #include "metadata.h" @@ -97,7 +98,7 @@ static void metadata_io_read_i_atomic_step_end(struct ocf_io *io, int error) metadata_io_read_i_atomic_complete(context, 0); } -int metadata_io_read_i_atomic_step(struct ocf_request *req) +static int metadata_io_read_i_atomic_step(struct ocf_request *req) { struct metadata_io_read_i_atomic_context *context = req->priv; ocf_cache_t cache = context->cache; @@ -257,7 +258,7 @@ static int metadata_io_do(struct ocf_request *req) return 0; } -void metadata_io_req_finalize(struct metadata_io_request *m_req) +static void metadata_io_req_finalize(struct metadata_io_request *m_req) { struct metadata_io_request_asynch *a_req = m_req->asynch; @@ -328,7 +329,7 @@ static void metadata_io_io_end(struct metadata_io_request *m_req, int error) metadata_io_req_complete(m_req); } -void metadata_io_req_end(struct metadata_io_request *m_req) +static void metadata_io_req_end(struct metadata_io_request *m_req) { struct metadata_io_request_asynch *a_req = m_req->asynch; ocf_cache_t cache = m_req->cache; diff --git a/src/metadata/metadata_raw.c b/src/metadata/metadata_raw.c index 867d7a9a..b1f06a4c 100644 --- a/src/metadata/metadata_raw.c +++ b/src/metadata/metadata_raw.c @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -189,7 +190,7 @@ static uint32_t _raw_ram_checksum(ocf_cache_t cache, /* * RAM Implementation - Entry page number */ -uint32_t _raw_ram_page(struct ocf_metadata_raw *raw, uint32_t entry) +static uint32_t _raw_ram_page(struct ocf_metadata_raw *raw, uint32_t entry) { ENV_BUG_ON(entry >= raw->entries); diff --git a/src/metadata/metadata_raw_dynamic.c b/src/metadata/metadata_raw_dynamic.c index f25b657a..fc064189 100644 --- a/src/metadata/metadata_raw_dynamic.c +++ b/src/metadata/metadata_raw_dynamic.c @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2022 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -37,7 +38,7 @@ * Check if page is valid for specified RAW descriptor */ -uint32_t raw_dynamic_segment_size_on_ssd(struct ocf_metadata_raw *raw) +static uint32_t raw_dynamic_segment_size_on_ssd(struct ocf_metadata_raw *raw) { const size_t alignment = 128 * KiB / PAGE_SIZE; diff --git a/src/mngt/ocf_mngt_cache.c b/src/mngt/ocf_mngt_cache.c index dce9ac6e..9aed6f30 100644 --- a/src/mngt/ocf_mngt_cache.c +++ b/src/mngt/ocf_mngt_cache.c @@ -1,6 +1,6 @@ /* * Copyright(c) 2012-2022 Intel Corporation - * Copyright(c) 2023 Huawei Technologies + * Copyright(c) 2023-2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -767,7 +767,7 @@ static void _ocf_mngt_load_init_structures(ocf_pipeline_t pipeline, _ocf_mngt_init_metadata_complete, context, false); } -void _ocf_mngt_load_metadata_complete(void *priv, int error) +static void _ocf_mngt_load_metadata_complete(void *priv, int error) { struct ocf_cache_attach_context *context = priv; ocf_cache_t cache = context->cache; @@ -1372,7 +1372,7 @@ static void _ocf_mngt_attach_init_services(ocf_pipeline_t pipeline, _ocf_mngt_cleaning_populate_init_complete, context); } -uint64_t _ocf_mngt_calculate_ram_needed(ocf_cache_line_size_t line_size, +static uint64_t _ocf_mngt_calculate_ram_needed(ocf_cache_line_size_t line_size, uint64_t volume_size) { uint64_t const_data_size; @@ -2849,7 +2849,7 @@ _ocf_mngt_cache_standby_detach_pipeline_properties = { }, }; -void _ocf_mngt_cache_standby_detach(ocf_cache_t cache, +static void _ocf_mngt_cache_standby_detach(ocf_cache_t cache, ocf_mngt_cache_standby_detach_end_t cmpl, void *priv) { struct ocf_cache_standby_detach_context *context; diff --git a/src/mngt/ocf_mngt_flush.c b/src/mngt/ocf_mngt_flush.c index aa894bb3..e9d225e2 100644 --- a/src/mngt/ocf_mngt_flush.c +++ b/src/mngt/ocf_mngt_flush.c @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2022 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -460,7 +461,7 @@ static void _ocf_mngt_flush_container( end(context); } -void _ocf_flush_container_complete(void *ctx) +static void _ocf_flush_container_complete(void *ctx) { struct ocf_mngt_cache_flush_context *context = ctx; diff --git a/src/ocf_core.c b/src/ocf_core.c index 011816ac..ab29f1e6 100644 --- a/src/ocf_core.c +++ b/src/ocf_core.c @@ -255,7 +255,7 @@ static int ocf_core_submit_io_fast(struct ocf_io *io, struct ocf_request *req, return -OCF_ERR_IO; } -void ocf_core_volume_submit_io(struct ocf_io *io) +static void ocf_core_volume_submit_io(struct ocf_io *io) { struct ocf_request *req; ocf_core_t core; diff --git a/src/ocf_seq_cutoff.c b/src/ocf_seq_cutoff.c index a85bf974..f92aac7f 100644 --- a/src/ocf_seq_cutoff.c +++ b/src/ocf_seq_cutoff.c @@ -1,5 +1,6 @@ /* * Copyright(c) 2020-2021 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -92,7 +93,7 @@ static void ocf_seq_cutoff_base_init(struct ocf_seq_cutoff *base, int nstreams) } } -void ocf_seq_cutoff_base_deinit(struct ocf_seq_cutoff *base) +static void ocf_seq_cutoff_base_deinit(struct ocf_seq_cutoff *base) { env_rwlock_destroy(&base->lock); } diff --git a/src/utils/utils_async_lock.c b/src/utils/utils_async_lock.c index 8bced5f6..1f6f168d 100644 --- a/src/utils/utils_async_lock.c +++ b/src/utils/utils_async_lock.c @@ -1,5 +1,6 @@ /* * Copyright(c) 2019-2021 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -12,7 +13,7 @@ struct ocf_async_lock_waiter { ocf_async_lock_end_t cmpl; }; -void _ocf_async_lock_collect_waiters(ocf_async_lock_t lock, +static void _ocf_async_lock_collect_waiters(ocf_async_lock_t lock, struct list_head *waiters) { ocf_async_lock_waiter_t iter, temp; @@ -31,7 +32,7 @@ void _ocf_async_lock_collect_waiters(ocf_async_lock_t lock, } } -void _ocf_async_lock_run_waiters(struct ocf_async_lock *lock, +static void _ocf_async_lock_run_waiters(struct ocf_async_lock *lock, struct list_head *waiters, int status) { ocf_async_lock_waiter_t iter, temp; diff --git a/src/utils/utils_rbtree.c b/src/utils/utils_rbtree.c index 0d7b4f58..3b8da698 100644 --- a/src/utils/utils_rbtree.c +++ b/src/utils/utils_rbtree.c @@ -1,5 +1,6 @@ /* * Copyright(c) 2020-2021 Intel Corporation + * Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -276,7 +277,7 @@ static struct ocf_rb_node *ocf_rb_tree_sibling(struct ocf_rb_node *node) } -void ocf_rb_tree_fix_double_black(struct ocf_rb_tree *tree, +static void ocf_rb_tree_fix_double_black(struct ocf_rb_tree *tree, struct ocf_rb_node *node) { struct ocf_rb_node *sibling;