Skip to content
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
19 changes: 19 additions & 0 deletions inc/ocf_io.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* Copyright(c) 2026 Unvertical
* SPDX-License-Identifier: BSD-3-Clause
*/

Expand Down Expand Up @@ -153,6 +154,24 @@ uint8_t ocf_forward_get_io_class(ocf_forward_token_t token);
*/
uint64_t ocf_forward_get_flags(ocf_forward_token_t token);

/**
* @brief Check if forwarded io goes to the core volume
*
* @param[in] token Forward token
*
* @retval true io forwarded to the core volume, otherwise false
*/
bool ocf_forward_is_core(ocf_forward_token_t token);

/**
* @brief Check if forwarded io goes to the cache volume
*
* @param[in] token Forward token
*
* @retval true io forwarded to the cache volume, otherwise false
*/
bool ocf_forward_is_cache(ocf_forward_token_t token);

/**
* @brief Forward io to another subvolume
*
Expand Down
10 changes: 10 additions & 0 deletions src/ocf_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,16 @@ uint64_t ocf_forward_get_flags(ocf_forward_token_t token)
return (token & 1) ? 0 : req->flags;
}

bool ocf_forward_is_core(ocf_forward_token_t token)
{
return !(token & 1);
}

bool ocf_forward_is_cache(ocf_forward_token_t token)
{
return !!(token & 1);
}

static inline void _ocf_forward_get(ocf_forward_token_t token)
{
struct ocf_request *req = (struct ocf_request *)(token & ~1);
Expand Down
Loading