Merge pull request #814 from mmichal10/debug-mechanism

Debug mechanism
This commit is contained in:
Robert Baldyga 2024-09-09 15:48:45 +02:00 committed by GitHub
commit ebbf832cdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,6 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -18,4 +19,6 @@ struct ocf_dbg_seq_cutoff_status {
void ocf_dbg_get_seq_cutoff_status(ocf_core_t core, void ocf_dbg_get_seq_cutoff_status(ocf_core_t core,
struct ocf_dbg_seq_cutoff_status *status); struct ocf_dbg_seq_cutoff_status *status);
bool ocf_dbg_cache_is_settled(ocf_cache_t cache);
#endif /* __OCF_DEBUG_H__ */ #endif /* __OCF_DEBUG_H__ */

View File

@ -15,6 +15,7 @@
#include "ocf_cache_priv.h" #include "ocf_cache_priv.h"
#include "ocf_queue_priv.h" #include "ocf_queue_priv.h"
#include "utils/utils_stats.h" #include "utils/utils_stats.h"
#include "ocf/ocf_debug.h"
ocf_volume_t ocf_cache_get_volume(ocf_cache_t cache) ocf_volume_t ocf_cache_get_volume(ocf_cache_t cache)
{ {
@ -559,3 +560,9 @@ int ocf_cache_volume_type_init(ocf_ctx_t ctx)
return ocf_ctx_register_volume_type_internal(ctx, OCF_VOLUME_TYPE_CACHE, return ocf_ctx_register_volume_type_internal(ctx, OCF_VOLUME_TYPE_CACHE,
&ocf_cache_volume_properties, NULL); &ocf_cache_volume_properties, NULL);
} }
bool ocf_dbg_cache_is_settled(ocf_cache_t cache)
{
return ocf_refcnt_zeroed(&cache->refcnt.metadata) &&
ocf_refcnt_zeroed(&cache->refcnt.d2c);
}

View File

@ -1,5 +1,6 @@
/* /*
* Copyright(c) 2019-2021 Intel Corporation * Copyright(c) 2019-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -68,3 +69,8 @@ bool ocf_refcnt_frozen(struct ocf_refcnt *rc)
{ {
return !!env_atomic_read(&rc->freeze); return !!env_atomic_read(&rc->freeze);
} }
bool ocf_refcnt_zeroed(struct ocf_refcnt *rc)
{
return (env_atomic_read(&rc->counter) == 0);
}

View File

@ -1,5 +1,6 @@
/* /*
* Copyright(c) 2019-2021 Intel Corporation * Copyright(c) 2019-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -40,6 +41,8 @@ void ocf_refcnt_unfreeze(struct ocf_refcnt *rc);
bool ocf_refcnt_frozen(struct ocf_refcnt *rc); bool ocf_refcnt_frozen(struct ocf_refcnt *rc);
bool ocf_refcnt_zeroed(struct ocf_refcnt *rc);
/* Register callback to be called when reference counter drops to 0. /* Register callback to be called when reference counter drops to 0.
* Must be called after counter is frozen. * Must be called after counter is frozen.
* Cannot be called until previously regsitered callback had fired. */ * Cannot be called until previously regsitered callback had fired. */

View File

@ -1010,7 +1010,8 @@ class Cache:
# settle all queues accociated with this cache (mngt and I/O) # settle all queues accociated with this cache (mngt and I/O)
def settle(self): def settle(self):
Queue.settle_many(self.io_queues + [self.mngt_queue]) while not self.owner.lib.ocf_dbg_cache_is_settled(self.cache_handle):
pass
@staticmethod @staticmethod
def get_by_name(cache_name, owner=None): def get_by_name(cache_name, owner=None):