Move ocf_request from utils
ocf_request has always been first class citizen in OCF, so lets place it along with another essential objects. Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
57bc19103d
commit
7de56940a4
@ -9,7 +9,7 @@
|
|||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
#include "../utils/utils_cleaner.h"
|
#include "../utils/utils_cleaner.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../cleaning/acp.h"
|
#include "../cleaning/acp.h"
|
||||||
#include "../engine/engine_common.h"
|
#include "../engine/engine_common.h"
|
||||||
#include "../concurrency/ocf_cache_concurrency.h"
|
#include "../concurrency/ocf_cache_concurrency.h"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "engine_ops.h"
|
#include "engine_ops.h"
|
||||||
#include "../utils/utils_part.h"
|
#include "../utils/utils_part.h"
|
||||||
#include "../utils/utils_refcnt.h"
|
#include "../utils/utils_refcnt.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
#include "../eviction/eviction.h"
|
#include "../eviction/eviction.h"
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "engine_inv.h"
|
#include "engine_inv.h"
|
||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "cache_engine.h"
|
#include "cache_engine.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#define OCF_ENGINE_DEBUG_IO_NAME "common"
|
#define OCF_ENGINE_DEBUG_IO_NAME "common"
|
||||||
#include "engine_debug.h"
|
#include "engine_debug.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_cleaner.h"
|
#include "../utils/utils_cleaner.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
#include "../eviction/eviction.h"
|
#include "../eviction/eviction.h"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "engine_d2c.h"
|
#include "engine_d2c.h"
|
||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "cache_engine.h"
|
#include "cache_engine.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "engine_discard.h"
|
#include "engine_discard.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "engine_pt.h"
|
#include "engine_pt.h"
|
||||||
#include "engine_wb.h"
|
#include "engine_wb.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_part.h"
|
#include "../utils/utils_part.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "engine_inv.h"
|
#include "engine_inv.h"
|
||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "cache_engine.h"
|
#include "cache_engine.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "cache_engine.h"
|
#include "cache_engine.h"
|
||||||
#include "engine_ops.h"
|
#include "engine_ops.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
|
|
||||||
#define OCF_ENGINE_DEBUG_IO_NAME "ops"
|
#define OCF_ENGINE_DEBUG_IO_NAME "ops"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "engine_pt.h"
|
#include "engine_pt.h"
|
||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "cache_engine.h"
|
#include "cache_engine.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../utils/utils_part.h"
|
#include "../utils/utils_part.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "cache_engine.h"
|
#include "cache_engine.h"
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_part.h"
|
#include "../utils/utils_part.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "engine_wa.h"
|
#include "engine_wa.h"
|
||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "cache_engine.h"
|
#include "cache_engine.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "engine_wb.h"
|
#include "engine_wb.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_part.h"
|
#include "../utils/utils_part.h"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "engine_wi.h"
|
#include "engine_wi.h"
|
||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "engine_wt.h"
|
#include "engine_wt.h"
|
||||||
#include "engine_inv.h"
|
#include "engine_inv.h"
|
||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_part.h"
|
#include "../utils/utils_part.h"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "engine_zero.h"
|
#include "engine_zero.h"
|
||||||
#include "engine_common.h"
|
#include "engine_common.h"
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
#include "../mngt/ocf_mngt_common.h"
|
#include "../mngt/ocf_mngt_common.h"
|
||||||
#include "../engine/engine_zero.h"
|
#include "../engine/engine_zero.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
|
|
||||||
#define OCF_EVICTION_MAX_SCAN 1024
|
#define OCF_EVICTION_MAX_SCAN 1024
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "../engine/cache_engine.h"
|
#include "../engine/cache_engine.h"
|
||||||
#include "../engine/engine_common.h"
|
#include "../engine/engine_common.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../ocf_def_priv.h"
|
#include "../ocf_def_priv.h"
|
||||||
#include "../ocf_priv.h"
|
#include "../ocf_priv.h"
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_pipeline.h"
|
#include "../utils/utils_pipeline.h"
|
||||||
#include "../utils/utils_refcnt.h"
|
#include "../utils/utils_refcnt.h"
|
||||||
#include "../ocf_utils.h"
|
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
#include "../eviction/ops.h"
|
#include "../eviction/ops.h"
|
||||||
#include "../ocf_ctx_priv.h"
|
#include "../ocf_ctx_priv.h"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "../ocf_ctx_priv.h"
|
#include "../ocf_ctx_priv.h"
|
||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
#include "../engine/cache_engine.h"
|
#include "../engine/cache_engine.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_device.h"
|
#include "../utils/utils_device.h"
|
||||||
#include "../eviction/ops.h"
|
#include "../eviction/ops.h"
|
||||||
#include "../ocf_logger_priv.h"
|
#include "../ocf_logger_priv.h"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "../utils/utils_part.h"
|
#include "../utils/utils_part.h"
|
||||||
#include "../utils/utils_pipeline.h"
|
#include "../utils/utils_pipeline.h"
|
||||||
#include "../utils/utils_refcnt.h"
|
#include "../utils/utils_refcnt.h"
|
||||||
#include "../utils/utils_req.h"
|
#include "../ocf_request.h"
|
||||||
#include "../ocf_def_priv.h"
|
#include "../ocf_def_priv.h"
|
||||||
|
|
||||||
struct ocf_mngt_cache_flush_context;
|
struct ocf_mngt_cache_flush_context;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "metadata/metadata.h"
|
#include "metadata/metadata.h"
|
||||||
#include "engine/cache_engine.h"
|
#include "engine/cache_engine.h"
|
||||||
#include "utils/utils_cache_line.h"
|
#include "utils/utils_cache_line.h"
|
||||||
#include "utils/utils_req.h"
|
#include "ocf_request.h"
|
||||||
#include "utils/utils_part.h"
|
#include "utils/utils_part.h"
|
||||||
#include "ocf_priv.h"
|
#include "ocf_priv.h"
|
||||||
#include "ocf_cache_priv.h"
|
#include "ocf_cache_priv.h"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "ocf_io_priv.h"
|
#include "ocf_io_priv.h"
|
||||||
#include "metadata/metadata.h"
|
#include "metadata/metadata.h"
|
||||||
#include "engine/cache_engine.h"
|
#include "engine/cache_engine.h"
|
||||||
#include "utils/utils_req.h"
|
#include "ocf_request.h"
|
||||||
#include "utils/utils_part.h"
|
#include "utils/utils_part.h"
|
||||||
#include "utils/utils_device.h"
|
#include "utils/utils_device.h"
|
||||||
#include "ocf_request.h"
|
#include "ocf_request.h"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "ocf_ctx_priv.h"
|
#include "ocf_ctx_priv.h"
|
||||||
#include "ocf_priv.h"
|
#include "ocf_priv.h"
|
||||||
#include "ocf_volume_priv.h"
|
#include "ocf_volume_priv.h"
|
||||||
#include "ocf_utils.h"
|
#include "ocf_request.h"
|
||||||
#include "ocf_logger_priv.h"
|
#include "ocf_logger_priv.h"
|
||||||
#include "ocf_core_priv.h"
|
#include "ocf_core_priv.h"
|
||||||
#include "mngt/ocf_mngt_core_pool_priv.h"
|
#include "mngt/ocf_mngt_core_pool_priv.h"
|
||||||
@ -141,7 +141,7 @@ int ocf_ctx_create(ocf_ctx_t *ctx, const struct ocf_ctx_config *cfg)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto err_ctx;
|
goto err_ctx;
|
||||||
|
|
||||||
ret = ocf_utils_init(ocf_ctx);
|
ret = ocf_req_allocator_init(ocf_ctx);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_logger;
|
goto err_logger;
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ int ocf_ctx_create(ocf_ctx_t *ctx, const struct ocf_ctx_config *cfg)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_utils:
|
err_utils:
|
||||||
ocf_utils_deinit(ocf_ctx);
|
ocf_req_allocator_deinit(ocf_ctx);
|
||||||
err_logger:
|
err_logger:
|
||||||
ocf_logger_close(&ocf_ctx->logger);
|
ocf_logger_close(&ocf_ctx->logger);
|
||||||
err_ctx:
|
err_ctx:
|
||||||
@ -190,7 +190,7 @@ void ocf_ctx_put(ocf_ctx_t ctx)
|
|||||||
|
|
||||||
ocf_mngt_core_pool_deinit(ctx);
|
ocf_mngt_core_pool_deinit(ctx);
|
||||||
ocf_core_volume_type_deinit(ctx);
|
ocf_core_volume_type_deinit(ctx);
|
||||||
ocf_utils_deinit(ctx);
|
ocf_req_allocator_deinit(ctx);
|
||||||
ocf_logger_close(&ctx->logger);
|
ocf_logger_close(&ctx->logger);
|
||||||
env_free(ctx);
|
env_free(ctx);
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ocf/ocf.h"
|
#include "ocf/ocf.h"
|
||||||
#include "utils_req.h"
|
#include "ocf_request.h"
|
||||||
#include "utils_cache_line.h"
|
#include "ocf_cache_priv.h"
|
||||||
#include "../ocf_request.h"
|
#include "ocf_queue_priv.h"
|
||||||
#include "../ocf_cache_priv.h"
|
#include "utils/utils_cache_line.h"
|
||||||
#include "../ocf_queue_priv.h"
|
|
||||||
|
|
||||||
#define OCF_UTILS_RQ_DEBUG 0
|
#define OCF_UTILS_RQ_DEBUG 0
|
||||||
|
|
||||||
@ -76,20 +75,20 @@ int ocf_req_allocator_init(struct ocf_ctx *ocf_ctx)
|
|||||||
req = ocf_ctx->resources.req;
|
req = ocf_ctx->resources.req;
|
||||||
|
|
||||||
if (!req)
|
if (!req)
|
||||||
goto ocf_utils_req_init_ERROR;
|
goto err;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(req->allocator); i++) {
|
for (i = 0; i < ARRAY_SIZE(req->allocator); i++) {
|
||||||
req->size[i] = ocf_req_sizeof(1 << i);
|
req->size[i] = ocf_req_sizeof(1 << i);
|
||||||
|
|
||||||
if (snprintf(name, sizeof(name), ALLOCATOR_NAME_FMT,
|
if (snprintf(name, sizeof(name), ALLOCATOR_NAME_FMT,
|
||||||
(1 << i)) < 0) {
|
(1 << i)) < 0) {
|
||||||
goto ocf_utils_req_init_ERROR;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
req->allocator[i] = env_allocator_create(req->size[i], name);
|
req->allocator[i] = env_allocator_create(req->size[i], name);
|
||||||
|
|
||||||
if (!req->allocator[i])
|
if (!req->allocator[i])
|
||||||
goto ocf_utils_req_init_ERROR;
|
goto err;
|
||||||
|
|
||||||
OCF_DEBUG_PARAM(cache, "New request allocator, lines = %u, "
|
OCF_DEBUG_PARAM(cache, "New request allocator, lines = %u, "
|
||||||
"size = %lu", 1 << i, req->size[i]);
|
"size = %lu", 1 << i, req->size[i]);
|
||||||
@ -97,10 +96,8 @@ int ocf_req_allocator_init(struct ocf_ctx *ocf_ctx)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ocf_utils_req_init_ERROR:
|
err:
|
||||||
|
|
||||||
ocf_req_allocator_deinit(ocf_ctx);
|
ocf_req_allocator_deinit(ocf_ctx);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include "ocf_env.h"
|
#include "ocf_env.h"
|
||||||
|
|
||||||
|
struct ocf_req_allocator;
|
||||||
|
|
||||||
struct ocf_req_info {
|
struct ocf_req_info {
|
||||||
/* Number of hits, invalid, misses. */
|
/* Number of hits, invalid, misses. */
|
||||||
unsigned int hit_no;
|
unsigned int hit_no;
|
||||||
@ -201,4 +203,131 @@ struct ocf_request {
|
|||||||
|
|
||||||
typedef void (*ocf_req_end_t)(struct ocf_request *req, int error);
|
typedef void (*ocf_req_end_t)(struct ocf_request *req, int error);
|
||||||
|
|
||||||
#endif
|
/**
|
||||||
|
* @brief Initialize OCF request allocation utility
|
||||||
|
*
|
||||||
|
* @param cache - OCF cache instance
|
||||||
|
* @return Operation status 0 - successful, non-zero failure
|
||||||
|
*/
|
||||||
|
int ocf_req_allocator_init(struct ocf_ctx *ocf_ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief De-initialize OCF request allocation utility
|
||||||
|
*
|
||||||
|
* @param cache - OCF cache instance
|
||||||
|
*/
|
||||||
|
void ocf_req_allocator_deinit(struct ocf_ctx *ocf_ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Allocate new OCF request
|
||||||
|
*
|
||||||
|
* @param queue - I/O queue handle
|
||||||
|
* @param core - OCF core instance
|
||||||
|
* @param addr - LBA of request
|
||||||
|
* @param bytes - number of bytes of request
|
||||||
|
* @param rw - Read or Write
|
||||||
|
*
|
||||||
|
* @return new OCF request
|
||||||
|
*/
|
||||||
|
struct ocf_request *ocf_req_new(ocf_queue_t queue, ocf_core_t core,
|
||||||
|
uint64_t addr, uint32_t bytes, int rw);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Allocate OCF request map
|
||||||
|
*
|
||||||
|
* @param req OCF request
|
||||||
|
*
|
||||||
|
* @retval 0 Allocation succeed
|
||||||
|
* @retval non-zero Allocation failed
|
||||||
|
*/
|
||||||
|
int ocf_req_alloc_map(struct ocf_request *req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Allocate new OCF request with NOIO map allocation for huge request
|
||||||
|
*
|
||||||
|
* @param queue - I/O queue handle
|
||||||
|
* @param core - OCF core instance
|
||||||
|
* @param addr - LBA of request
|
||||||
|
* @param bytes - number of bytes of request
|
||||||
|
* @param rw - Read or Write
|
||||||
|
*
|
||||||
|
* @return new OCF request
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct ocf_request *ocf_req_new_extended(ocf_queue_t queue, ocf_core_t core,
|
||||||
|
uint64_t addr, uint32_t bytes, int rw);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Allocate new OCF request for DISCARD operation
|
||||||
|
*
|
||||||
|
* @param queue - I/O queue handle
|
||||||
|
* @param core - OCF core instance
|
||||||
|
* @param addr - LBA of request
|
||||||
|
* @param bytes - number of bytes of request
|
||||||
|
* @param rw - Read or Write
|
||||||
|
*
|
||||||
|
* @return new OCF request
|
||||||
|
*/
|
||||||
|
struct ocf_request *ocf_req_new_discard(ocf_queue_t queue, ocf_core_t core,
|
||||||
|
uint64_t addr, uint32_t bytes, int rw);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Increment OCF request reference count
|
||||||
|
*
|
||||||
|
* @param req - OCF request
|
||||||
|
*/
|
||||||
|
void ocf_req_get(struct ocf_request *req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Decrement OCF request reference. If reference is 0 then request will
|
||||||
|
* be deallocated
|
||||||
|
*
|
||||||
|
* @param req - OCF request
|
||||||
|
*/
|
||||||
|
void ocf_req_put(struct ocf_request *req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear OCF request info
|
||||||
|
*
|
||||||
|
* @param req - OCF request
|
||||||
|
*/
|
||||||
|
void ocf_req_clear_info(struct ocf_request *req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear OCF request map
|
||||||
|
*
|
||||||
|
* @param req - OCF request
|
||||||
|
*/
|
||||||
|
void ocf_req_clear_map(struct ocf_request *req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear OCF request
|
||||||
|
*
|
||||||
|
* @param req - OCF request
|
||||||
|
*/
|
||||||
|
static inline void ocf_req_clear(struct ocf_request *req)
|
||||||
|
{
|
||||||
|
ocf_req_clear_info(req);
|
||||||
|
ocf_req_clear_map(req);
|
||||||
|
|
||||||
|
env_atomic_set(&req->lock_remaining, 0);
|
||||||
|
env_atomic_set(&req->req_remaining, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return OCF request reference count
|
||||||
|
*
|
||||||
|
* @param req - OCF request
|
||||||
|
* @return OCF request reference count
|
||||||
|
*/
|
||||||
|
static inline int ocf_req_ref_count(struct ocf_request *req)
|
||||||
|
{
|
||||||
|
return env_atomic_read(&req->ref_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool ocf_req_is_4k(uint64_t addr, uint32_t bytes)
|
||||||
|
{
|
||||||
|
return !((addr % PAGE_SIZE) || (bytes % PAGE_SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __OCF_REQUEST_H__ */
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright(c) 2012-2018 Intel Corporation
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ocf/ocf.h"
|
|
||||||
#include "ocf_cache_priv.h"
|
|
||||||
#include "utils/utils_req.h"
|
|
||||||
#include "ocf_utils.h"
|
|
||||||
#include "ocf_ctx_priv.h"
|
|
||||||
|
|
||||||
int ocf_utils_init(struct ocf_ctx *ocf_ctx)
|
|
||||||
{
|
|
||||||
return ocf_req_allocator_init(ocf_ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ocf_utils_deinit(struct ocf_ctx *ocf_ctx)
|
|
||||||
{
|
|
||||||
ocf_req_allocator_deinit(ocf_ctx);
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright(c) 2012-2018 Intel Corporation
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OCF_UTILS_H_
|
|
||||||
#define OCF_UTILS_H_
|
|
||||||
|
|
||||||
int ocf_utils_init(struct ocf_ctx *ocf_ctx);
|
|
||||||
|
|
||||||
void ocf_utils_deinit(struct ocf_ctx *ocf_ctx);
|
|
||||||
|
|
||||||
#endif /* OCF_UTILS_H_ */
|
|
@ -7,9 +7,9 @@
|
|||||||
#include "../engine/cache_engine.h"
|
#include "../engine/cache_engine.h"
|
||||||
#include "../engine/engine_common.h"
|
#include "../engine/engine_common.h"
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
|
#include "../ocf_request.h"
|
||||||
#include "utils_cleaner.h"
|
#include "utils_cleaner.h"
|
||||||
#include "utils_part.h"
|
#include "utils_part.h"
|
||||||
#include "utils_req.h"
|
|
||||||
#include "utils_io.h"
|
#include "utils_io.h"
|
||||||
#include "utils_cache_line.h"
|
#include "utils_cache_line.h"
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "ocf/ocf.h"
|
#include "ocf/ocf.h"
|
||||||
#include "../engine/cache_engine.h"
|
#include "../engine/cache_engine.h"
|
||||||
#include "../engine/engine_common.h"
|
#include "../engine/engine_common.h"
|
||||||
|
#include "../ocf_request.h"
|
||||||
#include "utils_pipeline.h"
|
#include "utils_pipeline.h"
|
||||||
#include "utils_req.h"
|
|
||||||
|
|
||||||
struct ocf_pipeline {
|
struct ocf_pipeline {
|
||||||
struct ocf_pipeline_properties *properties;
|
struct ocf_pipeline_properties *properties;
|
||||||
|
@ -1,145 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright(c) 2012-2018 Intel Corporation
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef UTILS_RQ_H_
|
|
||||||
#define UTILS_RQ_H_
|
|
||||||
|
|
||||||
#include "../ocf_request.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file utils_req.h
|
|
||||||
* @brief OCF request allocation utilities
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct ocf_req_allocator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize OCF request allocation utility
|
|
||||||
*
|
|
||||||
* @param cache - OCF cache instance
|
|
||||||
* @return Operation status 0 - successful, non-zero failure
|
|
||||||
*/
|
|
||||||
int ocf_req_allocator_init(struct ocf_ctx *ocf_ctx);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief De-initialize OCF request allocation utility
|
|
||||||
*
|
|
||||||
* @param cache - OCF cache instance
|
|
||||||
*/
|
|
||||||
void ocf_req_allocator_deinit(struct ocf_ctx *ocf_ctx);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Allocate new OCF request
|
|
||||||
*
|
|
||||||
* @param queue - I/O queue handle
|
|
||||||
* @param core - OCF core instance
|
|
||||||
* @param addr - LBA of request
|
|
||||||
* @param bytes - number of bytes of request
|
|
||||||
* @param rw - Read or Write
|
|
||||||
*
|
|
||||||
* @return new OCF request
|
|
||||||
*/
|
|
||||||
struct ocf_request *ocf_req_new(ocf_queue_t queue, ocf_core_t core,
|
|
||||||
uint64_t addr, uint32_t bytes, int rw);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Allocate OCF request map
|
|
||||||
*
|
|
||||||
* @param req OCF request
|
|
||||||
*
|
|
||||||
* @retval 0 Allocation succeed
|
|
||||||
* @retval non-zero Allocation failed
|
|
||||||
*/
|
|
||||||
int ocf_req_alloc_map(struct ocf_request *req);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Allocate new OCF request with NOIO map allocation for huge request
|
|
||||||
*
|
|
||||||
* @param queue - I/O queue handle
|
|
||||||
* @param core - OCF core instance
|
|
||||||
* @param addr - LBA of request
|
|
||||||
* @param bytes - number of bytes of request
|
|
||||||
* @param rw - Read or Write
|
|
||||||
*
|
|
||||||
* @return new OCF request
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct ocf_request *ocf_req_new_extended(ocf_queue_t queue, ocf_core_t core,
|
|
||||||
uint64_t addr, uint32_t bytes, int rw);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Allocate new OCF request for DISCARD operation
|
|
||||||
*
|
|
||||||
* @param queue - I/O queue handle
|
|
||||||
* @param core - OCF core instance
|
|
||||||
* @param addr - LBA of request
|
|
||||||
* @param bytes - number of bytes of request
|
|
||||||
* @param rw - Read or Write
|
|
||||||
*
|
|
||||||
* @return new OCF request
|
|
||||||
*/
|
|
||||||
struct ocf_request *ocf_req_new_discard(ocf_queue_t queue, ocf_core_t core,
|
|
||||||
uint64_t addr, uint32_t bytes, int rw);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Increment OCF request reference count
|
|
||||||
*
|
|
||||||
* @param req - OCF request
|
|
||||||
*/
|
|
||||||
void ocf_req_get(struct ocf_request *req);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Decrement OCF request reference. If reference is 0 then request will
|
|
||||||
* be deallocated
|
|
||||||
*
|
|
||||||
* @param req - OCF request
|
|
||||||
*/
|
|
||||||
void ocf_req_put(struct ocf_request *req);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clear OCF request info
|
|
||||||
*
|
|
||||||
* @param req - OCF request
|
|
||||||
*/
|
|
||||||
void ocf_req_clear_info(struct ocf_request *req);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clear OCF request map
|
|
||||||
*
|
|
||||||
* @param req - OCF request
|
|
||||||
*/
|
|
||||||
void ocf_req_clear_map(struct ocf_request *req);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clear OCF request
|
|
||||||
*
|
|
||||||
* @param req - OCF request
|
|
||||||
*/
|
|
||||||
static inline void ocf_req_clear(struct ocf_request *req)
|
|
||||||
{
|
|
||||||
ocf_req_clear_info(req);
|
|
||||||
ocf_req_clear_map(req);
|
|
||||||
|
|
||||||
env_atomic_set(&req->lock_remaining, 0);
|
|
||||||
env_atomic_set(&req->req_remaining, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return OCF request reference count
|
|
||||||
*
|
|
||||||
* @param req - OCF request
|
|
||||||
* @return OCF request reference count
|
|
||||||
*/
|
|
||||||
static inline int ocf_req_ref_count(struct ocf_request *req)
|
|
||||||
{
|
|
||||||
return env_atomic_read(&req->ref_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool ocf_req_is_4k(uint64_t addr, uint32_t bytes)
|
|
||||||
{
|
|
||||||
return !((addr % PAGE_SIZE) || (bytes % PAGE_SIZE));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* UTILS_RQ_H_ */
|
|
@ -35,7 +35,6 @@
|
|||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_pipeline.h"
|
#include "../utils/utils_pipeline.h"
|
||||||
#include "../ocf_utils.h"
|
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
#include "../eviction/ops.h"
|
#include "../eviction/ops.h"
|
||||||
#include "../ocf_ctx_priv.h"
|
#include "../ocf_ctx_priv.h"
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_pipeline.h"
|
#include "../utils/utils_pipeline.h"
|
||||||
#include "../ocf_utils.h"
|
|
||||||
#include "../concurrency/ocf_concurrency.h"
|
#include "../concurrency/ocf_concurrency.h"
|
||||||
#include "../eviction/ops.h"
|
#include "../eviction/ops.h"
|
||||||
#include "../ocf_ctx_priv.h"
|
#include "../ocf_ctx_priv.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user