Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement cache detach/attach #799

Merged
merged 16 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions inc/ocf_cache.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2023 Huawei Technologies
* Copyright(c) 2023-2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause
*/

Expand Down Expand Up @@ -156,14 +156,14 @@ bool ocf_cache_is_device_attached(ocf_cache_t cache);
bool ocf_cache_is_running(ocf_cache_t cache);

/**
* @brief Check if cache object is initializing
* @brief Check if cache is detached
*
* @param[in] cache Cache object
* @param[in] cache Cache
*
* @retval 1 Caching device is initializing
* @retval 0 Caching device is not initializing
* @retval 1 Caching device is detached
* @retval 0 Caching device is not detached
*/
bool ocf_cache_is_initializing(ocf_cache_t cache);
bool ocf_cache_is_detached(ocf_cache_t cache);

/**
* @brief Check if cache object is standby
Expand Down
7 changes: 4 additions & 3 deletions inc/ocf_def.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright(c) 2012-2022 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause
*/

Expand Down Expand Up @@ -118,14 +119,14 @@ typedef enum {
ocf_cache_state_stopping = 1, //!< ocf_cache_state_stopping
/*!< OCF cache instance is stopping */

ocf_cache_state_initializing = 2, //!< ocf_cache_state_initializing
/*!< OCF cache instance during initialization */
ocf_cache_state_detached = 2, //!< ocf_cache_state_detached
/*!< OCF cache instance without caching device attached */

ocf_cache_state_incomplete = 3, //!< ocf_cache_state_incomplete
/*!< OCF cache has at least one inactive core */

ocf_cache_state_standby = 4, //!< ocf_cache_state_standby
/*!< OCF is currently in standby mode */
/*!< OCF cache is currently in standby mode */

ocf_cache_state_max //!< ocf_cache_state_max
/*!< Stopper of cache state enumerator */
Expand Down
4 changes: 4 additions & 0 deletions inc/ocf_err.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause
*/

Expand Down Expand Up @@ -143,6 +144,9 @@ typedef enum {
/** Invalid operation for cache in standby state. */
OCF_ERR_CACHE_STANDBY,

/** Invalid operation for cache in standby state. */
OCF_ERR_CACHE_DETACHED,

/** Size of core volume doesn't match the size stored in cache metadata */
OCF_ERR_CORE_SIZE_MISMATCH,

Expand Down
2 changes: 2 additions & 0 deletions src/metadata/metadata_superblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,8 @@ void ocf_metadata_flush_superblock(ocf_cache_t cache,

OCF_DEBUG_TRACE(cache);

ENV_BUG_ON(!ocf_cache_is_device_attached(cache));

result = ocf_pipeline_create(&pipeline, cache,
&ocf_metadata_flush_sb_pipeline_props);
if (result)
Expand Down
Loading
Loading