From b9110635c1e797aef57a51ed68fb67a1685ab0ba Mon Sep 17 00:00:00 2001 From: Gal Hammer Date: Wed, 25 May 2022 10:30:49 +0300 Subject: [PATCH 01/16] cas_cache: fix "blk_update_request: operation not supported" error A write request with the REQ_RAHEAD flag enabled cause the nvme driver to send a write command with access frequency value that is reserved (at least on specification version 1.4c). NVME devices might fail this write command with an unsupported error. So we now clear the request's flag based on its direction. Signed-off-by: Gal Hammer Signed-off-by: Shai Fultheim Signed-off-by: Robert Baldyga --- modules/cas_cache/volume/vol_block_dev_bottom.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/cas_cache/volume/vol_block_dev_bottom.c b/modules/cas_cache/volume/vol_block_dev_bottom.c index 31927ba4d..6495e83b2 100644 --- a/modules/cas_cache/volume/vol_block_dev_bottom.c +++ b/modules/cas_cache/volume/vol_block_dev_bottom.c @@ -310,6 +310,21 @@ static inline bool cas_bd_io_prepare(int *dir, struct ocf_io *io) return true; } +/* + * Returns only flags that are relevant to request's direction. + */ +static inline uint64_t filter_req_flags(int dir, uint64_t flags) +{ + /* Remove REQ_RAHEAD flag from write request to cache which are a + result of a missed read-head request. This flag caused the nvme + driver to send write command with access frequency value that is + reserved */ + if (dir == WRITE) + flags &= ~REQ_RAHEAD; + + return flags; +} + /* * */ @@ -359,7 +374,7 @@ static void block_dev_submit_io(struct ocf_io *io) CAS_BIO_BISECTOR(bio) = addr / SECTOR_SIZE; bio->bi_next = NULL; bio->bi_private = io; - CAS_BIO_OP_FLAGS(bio) |= io->flags; + CAS_BIO_OP_FLAGS(bio) |= filter_req_flags(dir, io->flags); bio->bi_end_io = CAS_REFER_BLOCK_CALLBACK(cas_bd_io_end); /* Add pages */ From ab81ac667b0013f0bbb6137508b7bb13c50e08d5 Mon Sep 17 00:00:00 2001 From: Jan Musial Date: Tue, 16 Jan 2024 12:18:42 +0100 Subject: [PATCH 02/16] Remove unused fields Signed-off-by: Jan Musial Signed-off-by: Robert Baldyga --- modules/cas_cache/exp_obj.h | 4 +--- modules/cas_cache/layer_cache_management.c | 16 ---------------- modules/cas_cache/volume/obj_blk.h | 7 +------ 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/modules/cas_cache/exp_obj.h b/modules/cas_cache/exp_obj.h index 1c536578b..be52f5a93 100644 --- a/modules/cas_cache/exp_obj.h +++ b/modules/cas_cache/exp_obj.h @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2022 Intel Corporation +* Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ #ifndef __CASDISK_EXP_OBJ_H__ @@ -46,9 +47,6 @@ struct cas_exp_obj { struct blk_mq_tag_set tag_set; - atomic_t pt_ios; - atomic_t *pending_rqs; - void *private; }; diff --git a/modules/cas_cache/layer_cache_management.c b/modules/cas_cache/layer_cache_management.c index 15ef0e731..adfb48595 100644 --- a/modules/cas_cache/layer_cache_management.c +++ b/modules/cas_cache/layer_cache_management.c @@ -3504,22 +3504,6 @@ int cache_mngt_get_core_info(struct kcas_core_info *info) return result; } -static int cache_mngt_wait_for_rq_finish_visitor(ocf_core_t core, void *cntx) -{ - ocf_volume_t obj = ocf_core_get_volume(core); - struct bd_object *bdobj = bd_object(obj); - - while (atomic64_read(&bdobj->pending_rqs)) - io_schedule(); - - return 0; -} - -void cache_mngt_wait_for_rq_finish(ocf_cache_t cache) -{ - ocf_core_visit(cache, cache_mngt_wait_for_rq_finish_visitor, NULL, true); -} - int cache_mngt_set_core_params(struct kcas_set_core_param *info) { ocf_cache_t cache; diff --git a/modules/cas_cache/volume/obj_blk.h b/modules/cas_cache/volume/obj_blk.h index 281446e6d..870698bfa 100644 --- a/modules/cas_cache/volume/obj_blk.h +++ b/modules/cas_cache/volume/obj_blk.h @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2022 Intel Corporation +* Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -25,12 +26,6 @@ struct bd_object { uint32_t opened_by_bdev : 1; /*!< Opened by supplying bdev manually */ - atomic64_t pending_rqs; - /*!< This fields describes in flight IO requests */ - - struct workqueue_struct *btm_wq; - /*< Workqueue for I/O internally trigerred in bottom vol */ - struct workqueue_struct *expobj_wq; /*< Workqueue for I/O handled by top vol */ From 988ac5f645fc55e3d2b35e6d09a584b7f1a8040b Mon Sep 17 00:00:00 2001 From: Toby Roth Date: Wed, 15 May 2024 13:31:16 +0300 Subject: [PATCH 03/16] Do not submit IO in complete flush Signed-off-by: Toby Roth Signed-off-by: Robert Baldyga --- modules/cas_cache/volume/vol_block_dev_top.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/cas_cache/volume/vol_block_dev_top.c b/modules/cas_cache/volume/vol_block_dev_top.c index 7bb1b176c..9a7c79e86 100644 --- a/modules/cas_cache/volume/vol_block_dev_top.c +++ b/modules/cas_cache/volume/vol_block_dev_top.c @@ -370,10 +370,7 @@ static void blkdev_complete_flush(struct ocf_io *io, int error) return; } - if (in_interrupt()) - blkdev_defer_bio(bvol, bio, blkdev_handle_bio_noflush); - else - blkdev_handle_bio_noflush(bvol, bio); + blkdev_defer_bio(bvol, bio, blkdev_handle_bio_noflush); } static void blkdev_handle_flush(struct bd_object *bvol, struct bio *bio) From ef2211553907bf81e6639cd8b54fc9da0b6eddb2 Mon Sep 17 00:00:00 2001 From: Michael Lyulko Date: Tue, 22 Feb 2022 21:42:05 +0200 Subject: [PATCH 04/16] Change compiler flags from -O2 to -Ofast Signed-off-by: Michael Lyulko Signed-off-by: Robert Baldyga --- modules/config.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config.mk b/modules/config.mk index 0ac502e00..17c17961b 100644 --- a/modules/config.mk +++ b/modules/config.mk @@ -1,5 +1,6 @@ # # Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2024 Huawei Technologies # SPDX-License-Identifier: BSD-3-Clause # @@ -14,7 +15,7 @@ EXTRA_CFLAGS += -DCAS_VERSION_MAIN=$(CAS_VERSION_MAIN) EXTRA_CFLAGS += -DCAS_VERSION_MAJOR=$(CAS_VERSION_MAJOR) EXTRA_CFLAGS += -DCAS_VERSION_MINOR=$(CAS_VERSION_MINOR) EXTRA_CFLAGS += -DCAS_VERSION=\"$(CAS_VERSION)\" -EXTRA_CFLAGS += -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security +EXTRA_CFLAGS += -Ofast -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security EXTRA_CFLAGS += -I$(M) EXTRA_CFLAGS += -I$(M)/cas_cache From b02c02f1bbe6e10538462adbb662b3ad404ed571 Mon Sep 17 00:00:00 2001 From: Amir Haroush Date: Tue, 28 Jun 2022 17:29:21 +0300 Subject: [PATCH 05/16] Makefile: fix dependencies for casadm Signed-off-by: Amir Haroush Signed-off-by: Robert Baldyga --- Makefile | 1 + casadm/Makefile | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2d0b76a7a..4eda4d398 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # # Copyright(c) 2012-2022 Intel Corporation +# Copyright(c) 2024 Huawei Technologies # SPDX-License-Identifier: BSD-3-Clause # diff --git a/casadm/Makefile b/casadm/Makefile index 8ab0c4e87..d010125d3 100644 --- a/casadm/Makefile +++ b/casadm/Makefile @@ -152,7 +152,9 @@ $(OBJDIR)%.o: %.c ifeq ($(strip $(CAS_VERSION_MAIN)),) $(error "No version file") endif - @$(CC) -c $(CFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" + @$(CC) -c $(CFLAGS) -MMD -o "$@" "$<" + +-include $(addprefix $(OBJDIR),$(OBJS:.o=.d)) clean: @echo " CLEAN " From 1a1d9507af50f07d354b087a37e8c058f8064a02 Mon Sep 17 00:00:00 2001 From: Avi Halaf Date: Wed, 21 Dec 2022 09:03:02 -0500 Subject: [PATCH 06/16] Fix get-param casadm man page Signed-off-by: Avi Halaf Signed-off-by: Shai Fultheim Signed-off-by: Robert Baldyga --- casadm/casadm.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/casadm/casadm.8 b/casadm/casadm.8 index 3a5d4e95b..16fc0bef1 100644 --- a/casadm/casadm.8 +++ b/casadm/casadm.8 @@ -88,7 +88,7 @@ Stop cache instance. Set runtime parameter for cache/core instance. .TP -.B -G, --set-param +.B -G, --get-param Get runtime parameter for cache/core instance. .TP From 14aea0eda072d80333cda27c181f4b9cebd420b2 Mon Sep 17 00:00:00 2001 From: Amir Haroush Date: Tue, 16 May 2023 20:46:48 +0300 Subject: [PATCH 07/16] Fix compilation distclean race where several tries to rm If we run 'make -j' all 3 targets [modules, casadm, utils] will run in parallel. modules & casadm will then call sync, and then call distcleandir from ocf/Makefile. The distcleandir will try to remove empty directories, but now we have two instances of make trying to do that. Also, what if one of them just created directory to put files in it, and the other just removes it. Make casadm target dependent on modules target will ensure that it will start running only after modules target is done. Signed-off-by: Amir Haroush Signed-off-by: Robert Baldyga --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 4eda4d398..054e39eb7 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ ifneq ($(MAKECMDGOALS),srpm) ifneq ($(MAKECMDGOALS),deb) ifneq ($(MAKECMDGOALS),dsc) cd $@ && $(MAKE) $(MAKECMDGOALS) +casadm: modules + cd $@ && $(MAKE) $(MAKECMDGOALS) endif endif endif From c9f301249e2dec020d04ebb97af0d67a01b5bbcd Mon Sep 17 00:00:00 2001 From: Ian Levine Date: Tue, 6 Jun 2023 09:32:58 +0300 Subject: [PATCH 08/16] Check memory parameters before copying to user space Signed-off-by: Ian Levine Signed-off-by: Robert Baldyga --- modules/cas_cache/layer_cache_management.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/cas_cache/layer_cache_management.c b/modules/cas_cache/layer_cache_management.c index adfb48595..f45a7ae2d 100644 --- a/modules/cas_cache/layer_cache_management.c +++ b/modules/cas_cache/layer_cache_management.c @@ -1075,6 +1075,9 @@ int cache_mngt_core_pool_get_paths(struct kcas_core_pool_path *cmd_info) struct get_paths_ctx visitor_ctx = {0}; int result; + if (visitor_ctx->core_path_name_tab == NULL) + return -EINVAL; + visitor_ctx.core_path_name_tab = cmd_info->core_path_tab; visitor_ctx.max_count = cmd_info->core_pool_count; From 79a73fded2cde8cb180b445100c9f36fae9a4fc0 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Wed, 21 Jun 2023 11:31:51 +0200 Subject: [PATCH 09/16] ctx: Remove unused zalloc ops Signed-off-by: Michal Mielewczyk Signed-off-by: Robert Baldyga --- modules/cas_cache/context.c | 17 ++--------------- modules/cas_cache/context.h | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/modules/cas_cache/context.c b/modules/cas_cache/context.c index ed5b1cc29..94eb55a73 100644 --- a/modules/cas_cache/context.c +++ b/modules/cas_cache/context.c @@ -82,7 +82,7 @@ static int _cas_page_get_cpu(struct page *page) /* * */ -static ctx_data_t *__cas_ctx_data_alloc(uint32_t pages, bool zalloc) +static ctx_data_t *__cas_ctx_data_alloc(uint32_t pages) { struct blk_data *data; uint32_t i; @@ -116,14 +116,6 @@ static ctx_data_t *__cas_ctx_data_alloc(uint32_t pages, bool zalloc) if (!data->vec[i].bv_page) break; - if (zalloc) { - if (!page_addr) { - page_addr = page_address( - data->vec[i].bv_page); - } - memset(page_addr, 0, PAGE_SIZE); - } - data->vec[i].bv_len = PAGE_SIZE; data->vec[i].bv_offset = 0; } @@ -153,12 +145,7 @@ static ctx_data_t *__cas_ctx_data_alloc(uint32_t pages, bool zalloc) ctx_data_t *cas_ctx_data_alloc(uint32_t pages) { - return __cas_ctx_data_alloc(pages, false); -} - -ctx_data_t *cas_ctx_data_zalloc(uint32_t pages) -{ - return __cas_ctx_data_alloc(pages, true); + return __cas_ctx_data_alloc(pages); } /* diff --git a/modules/cas_cache/context.h b/modules/cas_cache/context.h index 5e9578946..b50233057 100644 --- a/modules/cas_cache/context.h +++ b/modules/cas_cache/context.h @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2022 Intel Corporation +* Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -69,7 +70,6 @@ struct blk_data *cas_alloc_blk_data(uint32_t size, gfp_t flags); void cas_free_blk_data(struct blk_data *data); ctx_data_t *cas_ctx_data_alloc(uint32_t pages); -ctx_data_t *cas_ctx_data_zalloc(uint32_t pages); void cas_ctx_data_free(ctx_data_t *ctx_data); void cas_ctx_data_secure_erase(ctx_data_t *ctx_data); From 72594436cee84f9de3344faa0b90274df10a18fe Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Wed, 20 Sep 2023 08:57:37 +0200 Subject: [PATCH 10/16] Don't access cache priv before locking cache Cache priv may be freed by concurrent stop. Signed-off-by: Michal Mielewczyk Signed-off-by: Robert Baldyga --- modules/cas_cache/layer_cache_management.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/cas_cache/layer_cache_management.c b/modules/cas_cache/layer_cache_management.c index f45a7ae2d..cff65a073 100644 --- a/modules/cas_cache/layer_cache_management.c +++ b/modules/cas_cache/layer_cache_management.c @@ -3199,10 +3199,6 @@ int cache_mngt_exit_instance(const char *cache_name, size_t name_len, int flush) if (status) return status; - cache_priv = ocf_cache_get_priv(cache); - mngt_queue = cache_priv->mngt_queue; - context = cache_priv->stop_context; - /* * Flush cache. Flushing may take a long time, so we allow user * to interrupt this operation. Hence we do first flush before @@ -3221,6 +3217,10 @@ int cache_mngt_exit_instance(const char *cache_name, size_t name_len, int flush) if (status) goto put; + cache_priv = ocf_cache_get_priv(cache); + mngt_queue = cache_priv->mngt_queue; + context = cache_priv->stop_context; + context->finish_thread = cas_lazy_thread_create(exit_instance_finish, context, "cas_%s_stop", cache_name); if (IS_ERR(context->finish_thread)) { From 6a409a0064d2261c4f1c3272d2b732f601a2961b Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Tue, 3 Oct 2023 07:37:52 +0200 Subject: [PATCH 11/16] Set mngt queue to null if couldn't start thread This prevents attempt to deinitialize the queue for the second time in the start rollback Signed-off-by: Michal Mielewczyk Signed-off-by: Robert Baldyga --- modules/cas_cache/layer_cache_management.c | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/cas_cache/layer_cache_management.c b/modules/cas_cache/layer_cache_management.c index cff65a073..6b3a59b01 100644 --- a/modules/cas_cache/layer_cache_management.c +++ b/modules/cas_cache/layer_cache_management.c @@ -2061,6 +2061,7 @@ static int _cache_mngt_start_queues(ocf_cache_t cache) cache_priv->mngt_queue, CAS_CPUS_ALL); if (result) { ocf_queue_put(cache_priv->mngt_queue); + cache_priv->mngt_queue = NULL; goto err; } From 72026cea63dc3f0dc7bca1cc3c165978d855c1d4 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Tue, 3 Oct 2023 09:12:04 +0200 Subject: [PATCH 12/16] Add missing ocf_volume_destroy() on cache init Signed-off-by: Michal Mielewczyk Signed-off-by: Robert Baldyga --- modules/cas_cache/layer_cache_management.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/cas_cache/layer_cache_management.c b/modules/cas_cache/layer_cache_management.c index 6b3a59b01..1c20f7d28 100644 --- a/modules/cas_cache/layer_cache_management.c +++ b/modules/cas_cache/layer_cache_management.c @@ -2701,17 +2701,21 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg, switch (cmd->init_cache) { case CACHE_INIT_STANDBY_NEW: case CACHE_INIT_STANDBY_LOAD: + ocf_volume_destroy(attach_cfg->device.volume); printk(KERN_ERR "Standby mode is not supported!\n"); return -ENOTSUP; default: break; } - if (!try_module_get(THIS_MODULE)) + if (!try_module_get(THIS_MODULE)) { + ocf_volume_destroy(attach_cfg->device.volume); return -KCAS_ERR_SYSTEM; + } result = cache_mngt_check_bdev(&attach_cfg->device, attach_cfg->force, false, NULL); if (result) { + ocf_volume_destroy(attach_cfg->device.volume); module_put(THIS_MODULE); return result; } @@ -2723,6 +2727,7 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg, cache_name_meta, &cache_mode_meta, &cache_line_size_meta); if (result) { + ocf_volume_destroy(attach_cfg->device.volume); module_put(THIS_MODULE); return result; } @@ -2733,6 +2738,7 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg, printk(KERN_ERR "Improper cache name format on %s.\n", cmd->cache_path_name); + ocf_volume_destroy(attach_cfg->device.volume); module_put(THIS_MODULE); return -OCF_ERR_START_CACHE_FAIL; } @@ -2745,6 +2751,7 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg, "already exists.\n", cache_name_meta); ocf_mngt_cache_put(tmp_cache); + ocf_volume_destroy(attach_cfg->device.volume); module_put(THIS_MODULE); return -OCF_ERR_CACHE_EXIST; } @@ -2759,6 +2766,7 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg, context = kzalloc(sizeof(*context), GFP_KERNEL); if (!context) { + ocf_volume_destroy(attach_cfg->device.volume); module_put(THIS_MODULE); return -ENOMEM; } @@ -2768,6 +2776,7 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg, if (IS_ERR(context->rollback_thread)) { result = PTR_ERR(context->rollback_thread); kfree(context); + ocf_volume_destroy(attach_cfg->device.volume); module_put(THIS_MODULE); return result; } @@ -2783,6 +2792,7 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg, if (result) { cas_lazy_thread_stop(context->rollback_thread); kfree(context); + ocf_volume_destroy(attach_cfg->device.volume); module_put(THIS_MODULE); return result; } @@ -2790,12 +2800,12 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg, result = _cache_mngt_cache_priv_init(cache); if (result) - goto err; + goto err_deinit_config; context->priv_inited = true; result = _cache_mngt_start_queues(cache); if (result) - goto err; + goto err_deinit_config; cache_priv = ocf_cache_get_priv(cache); cache_priv->attach_context = context; @@ -2842,6 +2852,9 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg, ocf_mngt_cache_unlock(cache); return result; + +err_deinit_config: + ocf_volume_destroy(attach_cfg->device.volume); err: cmd->min_free_ram = context->min_free_ram; From 69c4ca246e9b6bb40c3bd87282420468d5894e12 Mon Sep 17 00:00:00 2001 From: Rafal Stefanowski Date: Fri, 6 Oct 2023 15:42:30 +0200 Subject: [PATCH 13/16] Fix interpreting version numbers as octal Bash interprets any number with leading zero as an octal instead of decimal, so make sure it doesn't happen if any version number has a leading zero in version input file. Signed-off-by: Rafal Stefanowski Signed-off-by: Robert Baldyga --- tools/cas_version_gen.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/cas_version_gen.sh b/tools/cas_version_gen.sh index aa33fceb0..0badf68dc 100755 --- a/tools/cas_version_gen.sh +++ b/tools/cas_version_gen.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Copyright(c) 2020-2021 Intel Corporation +# Copyright(c) 2024 Huawei Technologies # SPDX-License-Identifier: BSD-3-Clause # @@ -30,13 +31,19 @@ if [[ -d "$SOURCES_DIR/.git" ]] && which git &>/dev/null &&\ if [[ ! -r "$MANUAL_VERSION_INPUT" ]]; then error "can't read version input file '$MANUAL_VERSION_INPUT'" fi - . "$MANUAL_VERSION_INPUT" + source "$MANUAL_VERSION_INPUT" if [[ ! "$CAS_VERSION_MAIN" || ! "$CAS_VERSION_MAJOR" || ! "$CAS_VERSION_MINOR" ]]; then error "'$MANUAL_VERSION_INPUT' - wrong version input file format;"\ "file should contain CAS_VERSION_MAIN, CAS_VERSION_MAJOR and CAS_VERSION_MINOR"\ "variables along with their respective values" fi + # Make sure version numbers are interpreted by bash as decimal numbers in case any of + # them were being input with leading zeros, which is interpreted as an octal by default. + CAS_VERSION_MAIN=$((10#$CAS_VERSION_MAIN)) + CAS_VERSION_MAJOR=$((10#$CAS_VERSION_MAJOR)) + CAS_VERSION_MINOR=$((10#$CAS_VERSION_MINOR)) + CAS_VERSION_BUILD=$(cd "$SOURCES_DIR" && git log --merges --oneline | wc -l) LAST_COMMIT_HASH=$(cd "$SOURCES_DIR" && git log -1 --pretty=format:%H) LAST_COMMIT_HASH_ABBR=$(cd "$SOURCES_DIR" && git log -1 --pretty=format:%h) @@ -80,7 +87,7 @@ if [[ -d "$SOURCES_DIR/.git" ]] && which git &>/dev/null &&\ echo "FILE_CREATION_DATE=$FILE_CREATION_DATE" >> "$VERSION_FILE" echo "FILE_CREATION_TIMESTAMP=$FILE_CREATION_TIMESTAMP" >> "$VERSION_FILE" elif [[ -r "$VERSION_FILE" ]]; then - . "$VERSION_FILE" >/dev/null + source "$VERSION_FILE" >/dev/null if [[ ! "$CAS_VERSION" ]]; then error "'$VERSION_FILE' - wrong version file format; file does not contain CAS_VERSION" fi From 6367a66a6865daacae4eeda9044afc6dc45ca5cf Mon Sep 17 00:00:00 2001 From: Roel Apfelbaum Date: Sun, 3 Dec 2023 10:01:20 -0500 Subject: [PATCH 14/16] Fix comment referring to old name of CAS control device Signed-off-by: Roel Apfelbaum Signed-off-by: Robert Baldyga --- modules/cas_cache/service_ui_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cas_cache/service_ui_ioctl.c b/modules/cas_cache/service_ui_ioctl.c index 0bd8e19ca..6f22d5f63 100644 --- a/modules/cas_cache/service_ui_ioctl.c +++ b/modules/cas_cache/service_ui_ioctl.c @@ -32,7 +32,7 @@ return map_cas_err_to_generic(ret); \ }) -/* this handles IOctl for /dev/cas */ +/* this handles IOctl for /dev/cas_ctrl */ /*********************************************/ long cas_service_ioctl_ctrl(struct file *filp, unsigned int cmd, unsigned long arg) From d453456c5ff9630878bb8bb13c05ae5c55be62b9 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Sun, 18 Feb 2024 09:05:27 +0100 Subject: [PATCH 15/16] Add ./tags to .gitignore Signed-off-by: Robert Baldyga --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f44b86e2c..c277861b8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ *.ko.* *.obj *.a +tags Module.symvers Module.markers *.mod.c From ded760a7608415be54e626e6cb23c2929c200275 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Sun, 18 Feb 2024 21:16:39 +0100 Subject: [PATCH 16/16] Fix debug macros Signed-off-by: Robert Baldyga --- modules/cas_cache/debug.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/cas_cache/debug.h b/modules/cas_cache/debug.h index cc7d2b10e..3dac09ff8 100644 --- a/modules/cas_cache/debug.h +++ b/modules/cas_cache/debug.h @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2022 Intel Corporation +* Copyright(c) 2024 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ #ifndef __CASDISK_DEBUG_H__ @@ -12,7 +13,7 @@ printk(KERN_INFO "%s\n", __func__) #define CAS_DEBUG_DISK_TRACE(dsk) \ - printk(KERN_INFO "[%u] %s\n", dsk->id, __func__) + printk(KERN_INFO "[%s] %s\n", dsk->path, __func__) #define CAS_DEBUG_MSG(msg) \ printk(KERN_INFO "%s - %s\n", __func__, msg) @@ -22,8 +23,8 @@ __func__, ##__VA_ARGS__) #define CAS_DEBUG_DISK(dsk, format, ...) \ - printk(KERN_INFO "[%u] %s - "format"\n", \ - dsk->id, \ + printk(KERN_INFO "[%s] %s - "format"\n", \ + dsk->path, \ __func__, ##__VA_ARGS__) #define CAS_DEBUG_ERROR(error, ...) \