Consolidate ocf_request_io and ocf_request - io properties
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com> Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
parent
d8d750462a
commit
3fbb75756e
@ -157,8 +157,7 @@ void ocf_resolve_effective_cache_mode(ocf_cache_t cache,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache->pt_unaligned_io && !ocf_req_is_4k(req->byte_position,
|
if (cache->pt_unaligned_io && !ocf_req_is_4k(req->addr, req->bytes)) {
|
||||||
req->byte_length)) {
|
|
||||||
req->cache_mode = ocf_req_cache_mode_pt;
|
req->cache_mode = ocf_req_cache_mode_pt;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@ void ocf_engine_error(struct ocf_request *req,
|
|||||||
if (ocf_cache_log_rl(cache)) {
|
if (ocf_cache_log_rl(cache)) {
|
||||||
ocf_core_log(req->core, log_err,
|
ocf_core_log(req->core, log_err,
|
||||||
"%s sector: %" ENV_PRIu64 ", bytes: %u\n", msg,
|
"%s sector: %" ENV_PRIu64 ", bytes: %u\n", msg,
|
||||||
BYTES_TO_SECTORS(req->byte_position),
|
BYTES_TO_SECTORS(req->addr),
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ void ocf_engine_clean(struct ocf_request *req)
|
|||||||
void ocf_engine_update_block_stats(struct ocf_request *req)
|
void ocf_engine_update_block_stats(struct ocf_request *req)
|
||||||
{
|
{
|
||||||
ocf_core_stats_vol_block_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_vol_block_update(req->core, req->part_id, req->rw,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ocf_engine_update_request_stats(struct ocf_request *req)
|
void ocf_engine_update_request_stats(struct ocf_request *req)
|
||||||
|
@ -41,7 +41,7 @@ int ocf_d2c_io_fast(struct ocf_request *req)
|
|||||||
ocf_engine_update_block_stats(req);
|
ocf_engine_update_block_stats(req);
|
||||||
|
|
||||||
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
|
|
||||||
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
|
||||||
req->info.hit_no, req->core_line_count);
|
req->info.hit_no, req->core_line_count);
|
||||||
@ -61,7 +61,7 @@ int ocf_d2c_flush_fast(struct ocf_request *req)
|
|||||||
ocf_engine_update_block_stats(req);
|
ocf_engine_update_block_stats(req);
|
||||||
|
|
||||||
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
|
|
||||||
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
|
||||||
req->info.hit_no, req->core_line_count);
|
req->info.hit_no, req->core_line_count);
|
||||||
@ -81,7 +81,7 @@ int ocf_d2c_discard_fast(struct ocf_request *req)
|
|||||||
ocf_engine_update_block_stats(req);
|
ocf_engine_update_block_stats(req);
|
||||||
|
|
||||||
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
|
|
||||||
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
|
||||||
req->info.hit_no, req->core_line_count);
|
req->info.hit_no, req->core_line_count);
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -33,8 +34,8 @@
|
|||||||
#define OCF_DEBUG_RQ(req, format, ...) \
|
#define OCF_DEBUG_RQ(req, format, ...) \
|
||||||
ocf_cache_log(req->cache, log_info, "[Engine][%s][%s, %llu, %u] %s - " \
|
ocf_cache_log(req->cache, log_info, "[Engine][%s][%s, %llu, %u] %s - " \
|
||||||
format"\n", OCF_ENGINE_DEBUG_IO_NAME, \
|
format"\n", OCF_ENGINE_DEBUG_IO_NAME, \
|
||||||
OCF_READ == (req)->rw ? "RD" : "WR", req->byte_position, \
|
OCF_READ == (req)->rw ? "RD" : "WR", req->addr, \
|
||||||
req->byte_length, __func__, ##__VA_ARGS__)
|
req->bytes, __func__, ##__VA_ARGS__)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define OCF_DEBUG_PREFIX
|
#define OCF_DEBUG_PREFIX
|
||||||
|
@ -28,8 +28,8 @@ static void _ocf_discard_complete_req(struct ocf_request *req, int error)
|
|||||||
|
|
||||||
static int _ocf_discard_core(struct ocf_request *req)
|
static int _ocf_discard_core(struct ocf_request *req)
|
||||||
{
|
{
|
||||||
req->byte_position = SECTORS_TO_BYTES(req->discard.sector);
|
req->addr = SECTORS_TO_BYTES(req->discard.sector);
|
||||||
req->byte_length = SECTORS_TO_BYTES(req->discard.nr_sects);
|
req->bytes = SECTORS_TO_BYTES(req->discard.nr_sects);
|
||||||
|
|
||||||
ocf_engine_forward_core_discard_req(req, _ocf_discard_complete_req);
|
ocf_engine_forward_core_discard_req(req, _ocf_discard_complete_req);
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ static int _ocf_discard_step(struct ocf_request *req);
|
|||||||
|
|
||||||
static void _ocf_discard_finish_step(struct ocf_request *req)
|
static void _ocf_discard_finish_step(struct ocf_request *req)
|
||||||
{
|
{
|
||||||
req->discard.handled += BYTES_TO_SECTORS(req->byte_length);
|
req->discard.handled += BYTES_TO_SECTORS(req->bytes);
|
||||||
|
|
||||||
if (req->discard.handled < req->discard.nr_sects)
|
if (req->discard.handled < req->discard.nr_sects)
|
||||||
req->engine_handler = _ocf_discard_step;
|
req->engine_handler = _ocf_discard_step;
|
||||||
@ -149,13 +149,13 @@ static int _ocf_discard_step(struct ocf_request *req)
|
|||||||
|
|
||||||
OCF_DEBUG_TRACE(req->cache);
|
OCF_DEBUG_TRACE(req->cache);
|
||||||
|
|
||||||
req->byte_position = SECTORS_TO_BYTES(req->discard.sector +
|
req->addr = SECTORS_TO_BYTES(req->discard.sector +
|
||||||
req->discard.handled);
|
req->discard.handled);
|
||||||
req->byte_length = OCF_MIN(SECTORS_TO_BYTES(req->discard.nr_sects -
|
req->bytes = OCF_MIN(SECTORS_TO_BYTES(req->discard.nr_sects -
|
||||||
req->discard.handled), MAX_TRIM_RQ_SIZE);
|
req->discard.handled), MAX_TRIM_RQ_SIZE);
|
||||||
req->core_line_first = ocf_bytes_2_lines(cache, req->byte_position);
|
req->core_line_first = ocf_bytes_2_lines(cache, req->addr);
|
||||||
req->core_line_last =
|
req->core_line_last =
|
||||||
ocf_bytes_2_lines(cache, req->byte_position + req->byte_length - 1);
|
ocf_bytes_2_lines(cache, req->addr + req->bytes - 1);
|
||||||
req->core_line_count = req->core_line_last - req->core_line_first + 1;
|
req->core_line_count = req->core_line_last - req->core_line_first + 1;
|
||||||
req->engine_handler = _ocf_discard_step_do;
|
req->engine_handler = _ocf_discard_step_do;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ void ocf_engine_forward_cache_io(struct ocf_request *req, int dir,
|
|||||||
uint64_t offset, uint64_t size, ocf_req_end_t callback)
|
uint64_t offset, uint64_t size, ocf_req_end_t callback)
|
||||||
{
|
{
|
||||||
ocf_cache_t cache = req->cache;
|
ocf_cache_t cache = req->cache;
|
||||||
uint32_t seek = req->byte_position % ocf_line_size(cache);
|
uint32_t seek = req->addr % ocf_line_size(cache);
|
||||||
uint32_t first_cl = ocf_bytes_2_lines(cache, offset + seek);
|
uint32_t first_cl = ocf_bytes_2_lines(cache, offset + seek);
|
||||||
uint64_t addr;
|
uint64_t addr;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ void ocf_engine_forward_cache_io(struct ocf_request *req, int dir,
|
|||||||
addr += (offset + seek) % ocf_line_size(cache);
|
addr += (offset + seek) % ocf_line_size(cache);
|
||||||
|
|
||||||
ocf_core_stats_cache_block_update(req->core, req->part_id,
|
ocf_core_stats_cache_block_update(req->core, req->part_id,
|
||||||
dir, req->byte_length);
|
dir, req->bytes);
|
||||||
|
|
||||||
ocf_req_forward_cache_io(req, dir, addr, size,
|
ocf_req_forward_cache_io(req, dir, addr, size,
|
||||||
req->offset + offset);
|
req->offset + offset);
|
||||||
@ -45,12 +45,12 @@ void ocf_engine_forward_cache_io_req(struct ocf_request *req, int dir,
|
|||||||
if (ocf_engine_is_sequential(req)) {
|
if (ocf_engine_is_sequential(req)) {
|
||||||
addr = cache->device->metadata_offset;
|
addr = cache->device->metadata_offset;
|
||||||
addr += req->map[0].coll_idx * ocf_line_size(cache);
|
addr += req->map[0].coll_idx * ocf_line_size(cache);
|
||||||
addr += req->byte_position % ocf_line_size(cache);
|
addr += req->addr % ocf_line_size(cache);
|
||||||
|
|
||||||
ocf_core_stats_cache_block_update(req->core, req->part_id,
|
ocf_core_stats_cache_block_update(req->core, req->part_id,
|
||||||
dir, req->byte_length);
|
dir, req->bytes);
|
||||||
|
|
||||||
ocf_req_forward_cache_io(req, dir, addr, req->byte_length,
|
ocf_req_forward_cache_io(req, dir, addr, req->bytes,
|
||||||
req->offset);
|
req->offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ void ocf_engine_forward_cache_io_req(struct ocf_request *req, int dir,
|
|||||||
bytes = ocf_line_size(cache);
|
bytes = ocf_line_size(cache);
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
uint64_t seek = (req->byte_position) %
|
uint64_t seek = (req->addr) %
|
||||||
ocf_line_size(cache);
|
ocf_line_size(cache);
|
||||||
|
|
||||||
addr += seek;
|
addr += seek;
|
||||||
@ -87,13 +87,13 @@ void ocf_engine_forward_cache_io_req(struct ocf_request *req, int dir,
|
|||||||
|
|
||||||
if (i == (req->core_line_count - 1)) {
|
if (i == (req->core_line_count - 1)) {
|
||||||
uint64_t skip = (ocf_line_size(cache) -
|
uint64_t skip = (ocf_line_size(cache) -
|
||||||
((req->byte_position + req->byte_length) %
|
((req->addr + req->bytes) %
|
||||||
ocf_line_size(cache))) % ocf_line_size(cache);
|
ocf_line_size(cache))) % ocf_line_size(cache);
|
||||||
|
|
||||||
bytes -= skip;
|
bytes -= skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = OCF_MIN(bytes, req->byte_length - total_bytes);
|
bytes = OCF_MIN(bytes, req->bytes - total_bytes);
|
||||||
ENV_BUG_ON(bytes == 0);
|
ENV_BUG_ON(bytes == 0);
|
||||||
|
|
||||||
ocf_core_stats_cache_block_update(req->core, req->part_id,
|
ocf_core_stats_cache_block_update(req->core, req->part_id,
|
||||||
@ -105,7 +105,7 @@ void ocf_engine_forward_cache_io_req(struct ocf_request *req, int dir,
|
|||||||
total_bytes += bytes;
|
total_bytes += bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENV_BUG_ON(total_bytes != req->byte_length);
|
ENV_BUG_ON(total_bytes != req->bytes);
|
||||||
|
|
||||||
ocf_req_forward_cache_put(req);
|
ocf_req_forward_cache_put(req);
|
||||||
}
|
}
|
||||||
@ -123,27 +123,27 @@ void ocf_engine_forward_cache_discard_req(struct ocf_request *req,
|
|||||||
{
|
{
|
||||||
req->cache_forward_end = callback;
|
req->cache_forward_end = callback;
|
||||||
|
|
||||||
ocf_req_forward_cache_discard(req, req->byte_position,
|
ocf_req_forward_cache_discard(req, req->addr,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ocf_engine_forward_core_io_req(struct ocf_request *req,
|
void ocf_engine_forward_core_io_req(struct ocf_request *req,
|
||||||
ocf_req_end_t callback)
|
ocf_req_end_t callback)
|
||||||
{
|
{
|
||||||
ocf_core_stats_core_block_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_core_block_update(req->core, req->part_id, req->rw,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
|
|
||||||
req->core_forward_end = callback;
|
req->core_forward_end = callback;
|
||||||
|
|
||||||
ocf_req_forward_core_io(req, req->rw, req->byte_position,
|
ocf_req_forward_core_io(req, req->rw, req->addr,
|
||||||
req->byte_length, req->offset);
|
req->bytes, req->offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ocf_engine_forward_core_flush_req(struct ocf_request *req,
|
void ocf_engine_forward_core_flush_req(struct ocf_request *req,
|
||||||
ocf_req_end_t callback)
|
ocf_req_end_t callback)
|
||||||
{
|
{
|
||||||
ocf_core_stats_core_block_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_core_block_update(req->core, req->part_id, req->rw,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
|
|
||||||
req->core_forward_end = callback;
|
req->core_forward_end = callback;
|
||||||
|
|
||||||
@ -154,9 +154,9 @@ void ocf_engine_forward_core_discard_req(struct ocf_request *req,
|
|||||||
ocf_req_end_t callback)
|
ocf_req_end_t callback)
|
||||||
{
|
{
|
||||||
ocf_core_stats_core_block_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_core_block_update(req->core, req->part_id, req->rw,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
|
|
||||||
req->core_forward_end = callback;
|
req->core_forward_end = callback;
|
||||||
|
|
||||||
ocf_req_forward_core_discard(req, req->byte_position, req->byte_length);
|
ocf_req_forward_core_discard(req, req->addr, req->bytes);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ int ocf_read_pt_do(struct ocf_request *req)
|
|||||||
ocf_engine_update_block_stats(req);
|
ocf_engine_update_block_stats(req);
|
||||||
|
|
||||||
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
|
|
||||||
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
|
||||||
req->info.hit_no, req->core_line_count);
|
req->info.hit_no, req->core_line_count);
|
||||||
|
@ -65,7 +65,7 @@ static void _ocf_read_generic_miss_complete(struct ocf_request *req, int error)
|
|||||||
/* Copy data to the backfill buffer */
|
/* Copy data to the backfill buffer */
|
||||||
if (req->cp_data) {
|
if (req->cp_data) {
|
||||||
ctx_data_cpy(cache->owner, req->cp_data, req->data, 0, 0,
|
ctx_data_cpy(cache->owner, req->cp_data, req->data, 0, 0,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
req->complete(req, error);
|
req->complete(req, error);
|
||||||
@ -85,12 +85,12 @@ static inline void _ocf_read_generic_submit_miss(struct ocf_request *req)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
req->cp_data = ctx_data_alloc(cache->owner,
|
req->cp_data = ctx_data_alloc(cache->owner,
|
||||||
BYTES_TO_PAGES(req->byte_length));
|
BYTES_TO_PAGES(req->bytes));
|
||||||
if (!req->cp_data) {
|
if (!req->cp_data) {
|
||||||
/* If buffer allocation for backfill fails, ignore the error */
|
/* If buffer allocation for backfill fails, ignore the error */
|
||||||
ocf_cache_log(cache, log_warn, "Backfill buffer allocation "
|
ocf_cache_log(cache, log_warn, "Backfill buffer allocation "
|
||||||
"error (size %u)\n",
|
"error (size %u)\n",
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
goto err_alloc;
|
goto err_alloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ static int _ocf_write_wi_core_write(struct ocf_request *req)
|
|||||||
ocf_engine_update_block_stats(req);
|
ocf_engine_update_block_stats(req);
|
||||||
|
|
||||||
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
|
|
||||||
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
|
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
|
||||||
req->info.hit_no, req->core_line_count);
|
req->info.hit_no, req->core_line_count);
|
||||||
|
@ -76,15 +76,15 @@ static inline void ocf_zero_map_info(struct ocf_request *req)
|
|||||||
|
|
||||||
if (map_idx == 0) {
|
if (map_idx == 0) {
|
||||||
/* First */
|
/* First */
|
||||||
start_bit = BYTES_TO_SECTORS(req->byte_position)
|
start_bit = (BYTES_TO_SECTORS(req->addr)
|
||||||
% ocf_line_sectors(cache);
|
% ocf_line_sectors(cache));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map_idx == (count - 1)) {
|
if (map_idx == (count - 1)) {
|
||||||
/* Last */
|
/* Last */
|
||||||
end_bit = BYTES_TO_SECTORS(req->byte_position +
|
end_bit = (BYTES_TO_SECTORS(req->addr +
|
||||||
req->byte_length - 1) %
|
req->bytes - 1) %
|
||||||
ocf_line_sectors(cache);
|
ocf_line_sectors(cache));
|
||||||
}
|
}
|
||||||
|
|
||||||
ocf_metadata_flush_mark(cache, req, map_idx, INVALID,
|
ocf_metadata_flush_mark(cache, req, map_idx, INVALID,
|
||||||
|
@ -426,7 +426,7 @@ static int metadata_io_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int dir,
|
|||||||
m_req->req.rw = dir;
|
m_req->req.rw = dir;
|
||||||
m_req->req.map = LIST_POISON1;
|
m_req->req.map = LIST_POISON1;
|
||||||
m_req->req.alock_status = (uint8_t*)&m_req->alock_status;
|
m_req->req.alock_status = (uint8_t*)&m_req->alock_status;
|
||||||
m_req->req.io.flags = flags;
|
m_req->req.flags = flags;
|
||||||
|
|
||||||
/* If req_count == io_count and count is not multiple of
|
/* If req_count == io_count and count is not multiple of
|
||||||
* max_count, for last we can allocate data smaller that
|
* max_count, for last we can allocate data smaller that
|
||||||
|
@ -30,8 +30,8 @@ static int passive_io_resume(struct ocf_request *req)
|
|||||||
struct ocf_request *master = req->master_io_req;
|
struct ocf_request *master = req->master_io_req;
|
||||||
ocf_cache_t cache = req->cache;
|
ocf_cache_t cache = req->cache;
|
||||||
struct ocf_metadata_ctrl *ctrl = cache->metadata.priv;
|
struct ocf_metadata_ctrl *ctrl = cache->metadata.priv;
|
||||||
uint64_t io_start_page = BYTES_TO_PAGES(master->io.addr);
|
uint64_t io_start_page = BYTES_TO_PAGES(master->addr);
|
||||||
uint64_t io_pages_count = BYTES_TO_PAGES(master->io.bytes);
|
uint64_t io_pages_count = BYTES_TO_PAGES(master->bytes);
|
||||||
uint64_t io_end_page = io_start_page + io_pages_count - 1;
|
uint64_t io_end_page = io_start_page + io_pages_count - 1;
|
||||||
enum ocf_metadata_segment_id update_segments[] = {
|
enum ocf_metadata_segment_id update_segments[] = {
|
||||||
metadata_segment_sb_config,
|
metadata_segment_sb_config,
|
||||||
@ -77,12 +77,12 @@ int ocf_metadata_passive_update(struct ocf_request *master)
|
|||||||
{
|
{
|
||||||
ocf_cache_t cache = master->cache;
|
ocf_cache_t cache = master->cache;
|
||||||
struct ocf_metadata_ctrl *ctrl = cache->metadata.priv;
|
struct ocf_metadata_ctrl *ctrl = cache->metadata.priv;
|
||||||
uint64_t io_start_page = BYTES_TO_PAGES(master->io.addr);
|
uint64_t io_start_page = BYTES_TO_PAGES(master->addr);
|
||||||
uint64_t io_end_page = io_start_page + BYTES_TO_PAGES(master->io.bytes);
|
uint64_t io_end_page = io_start_page + BYTES_TO_PAGES(master->bytes);
|
||||||
struct ocf_request *req;
|
struct ocf_request *req;
|
||||||
int lock = 0;
|
int lock = 0;
|
||||||
|
|
||||||
if (master->io.dir == OCF_READ) {
|
if (master->rw == OCF_READ) {
|
||||||
master->complete(master, 0);
|
master->complete(master, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -92,14 +92,14 @@ int ocf_metadata_passive_update(struct ocf_request *master)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (master->io.addr % PAGE_SIZE || master->io.bytes % PAGE_SIZE) {
|
if (master->addr % PAGE_SIZE || master->bytes % PAGE_SIZE) {
|
||||||
ocf_cache_log(cache, log_warn,
|
ocf_cache_log(cache, log_warn,
|
||||||
"Metadata update not aligned to page size!\n");
|
"Metadata update not aligned to page size!\n");
|
||||||
master->complete(master, -OCF_ERR_INVAL);
|
master->complete(master, -OCF_ERR_INVAL);
|
||||||
return -OCF_ERR_INVAL;
|
return -OCF_ERR_INVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (master->io.bytes > MAX_PASSIVE_IO_SIZE) {
|
if (master->bytes > MAX_PASSIVE_IO_SIZE) {
|
||||||
//FIXME handle greater IOs
|
//FIXME handle greater IOs
|
||||||
ocf_cache_log(cache, log_warn,
|
ocf_cache_log(cache, log_warn,
|
||||||
"IO size exceedes max supported size!\n");
|
"IO size exceedes max supported size!\n");
|
||||||
@ -113,7 +113,7 @@ int ocf_metadata_passive_update(struct ocf_request *master)
|
|||||||
return -OCF_ERR_NO_MEM;
|
return -OCF_ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
req->io_queue = master->io.io_queue;;
|
req->io_queue = master->io_queue;;
|
||||||
req->info.internal = true;
|
req->info.internal = true;
|
||||||
req->engine_handler = passive_io_resume;
|
req->engine_handler = passive_io_resume;
|
||||||
req->rw = OCF_WRITE;
|
req->rw = OCF_WRITE;
|
||||||
|
@ -621,7 +621,7 @@ static int _raw_ram_flush_do_asynch(ocf_cache_t cache,
|
|||||||
|
|
||||||
result |= metadata_io_write_i_asynch(cache, req->io_queue, ctx,
|
result |= metadata_io_write_i_asynch(cache, req->io_queue, ctx,
|
||||||
raw->ssd_pages_offset + start_page, count,
|
raw->ssd_pages_offset + start_page, count,
|
||||||
req->io.flags,
|
req->flags,
|
||||||
_raw_ram_flush_do_asynch_fill,
|
_raw_ram_flush_do_asynch_fill,
|
||||||
_raw_ram_flush_do_asynch_io_complete,
|
_raw_ram_flush_do_asynch_io_complete,
|
||||||
raw->mio_conc);
|
raw->mio_conc);
|
||||||
|
@ -333,8 +333,8 @@ static void ocf_cache_volume_submit_io(ocf_io_t io)
|
|||||||
env_atomic_set(&req->req_remaining, 3);
|
env_atomic_set(&req->req_remaining, 3);
|
||||||
|
|
||||||
req->cache_forward_end = ocf_cache_io_complete;
|
req->cache_forward_end = ocf_cache_io_complete;
|
||||||
ocf_req_forward_cache_io(req, req->rw, req->byte_position,
|
ocf_req_forward_cache_io(req, req->rw, req->addr,
|
||||||
req->byte_length, req->offset);
|
req->bytes, req->offset);
|
||||||
|
|
||||||
req->complete = ocf_cache_io_complete;
|
req->complete = ocf_cache_io_complete;
|
||||||
result = ocf_metadata_passive_update(req);
|
result = ocf_metadata_passive_update(req);
|
||||||
@ -381,8 +381,8 @@ static void ocf_cache_volume_submit_discard(ocf_io_t io)
|
|||||||
}
|
}
|
||||||
|
|
||||||
req->cache_forward_end = ocf_cache_volume_io_complete_generic;
|
req->cache_forward_end = ocf_cache_volume_io_complete_generic;
|
||||||
ocf_req_forward_cache_discard(req, req->byte_position,
|
ocf_req_forward_cache_discard(req, req->addr,
|
||||||
req->byte_length);
|
req->bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *** VOLUME OPS *** */
|
/* *** VOLUME OPS *** */
|
||||||
|
@ -182,16 +182,16 @@ static inline int ocf_core_validate_io(ocf_io_t io)
|
|||||||
ocf_volume_t volume = ocf_io_get_volume(io);
|
ocf_volume_t volume = ocf_io_get_volume(io);
|
||||||
ocf_core_t core = ocf_volume_to_core(volume);
|
ocf_core_t core = ocf_volume_to_core(volume);
|
||||||
|
|
||||||
if (req->io.addr + req->io.bytes > ocf_volume_get_length(volume))
|
if (req->addr + req->bytes > ocf_volume_get_length(volume))
|
||||||
return -OCF_ERR_INVAL;
|
return -OCF_ERR_INVAL;
|
||||||
|
|
||||||
if (req->io.io_class >= OCF_USER_IO_CLASS_MAX)
|
if (req->io.io_class >= OCF_USER_IO_CLASS_MAX)
|
||||||
return -OCF_ERR_INVAL;
|
return -OCF_ERR_INVAL;
|
||||||
|
|
||||||
if (req->io.dir != OCF_READ && req->io.dir != OCF_WRITE)
|
if (req->rw != OCF_READ && req->rw != OCF_WRITE)
|
||||||
return -OCF_ERR_INVAL;
|
return -OCF_ERR_INVAL;
|
||||||
|
|
||||||
if (!req->io.io_queue)
|
if (!req->io_queue)
|
||||||
return -OCF_ERR_INVAL;
|
return -OCF_ERR_INVAL;
|
||||||
|
|
||||||
if (!req->io.end)
|
if (!req->io.end)
|
||||||
@ -200,7 +200,7 @@ static inline int ocf_core_validate_io(ocf_io_t io)
|
|||||||
/* Core volume I/O must not be queued on management queue - this would
|
/* Core volume I/O must not be queued on management queue - this would
|
||||||
* break I/O accounting code, resulting in use-after-free type of errors
|
* break I/O accounting code, resulting in use-after-free type of errors
|
||||||
* after cache detach, core remove etc. */
|
* after cache detach, core remove etc. */
|
||||||
if (req->io.io_queue == ocf_core_get_cache(core)->mngt_queue)
|
if (req->io_queue == ocf_core_get_cache(core)->mngt_queue)
|
||||||
return -OCF_ERR_INVAL;
|
return -OCF_ERR_INVAL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -323,7 +323,7 @@ static void ocf_core_volume_submit_io(ocf_io_t io)
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
ocf_io_end_func(io, ret);
|
ocf_io_end_func(io, ret);
|
||||||
ocf_io_put(io);
|
ocf_io_put(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ocf_core_volume_submit_flush(ocf_io_t io)
|
static void ocf_core_volume_submit_flush(ocf_io_t io)
|
||||||
@ -367,7 +367,7 @@ static void ocf_core_volume_submit_discard(ocf_io_t io)
|
|||||||
|
|
||||||
OCF_CHECK_NULL(io);
|
OCF_CHECK_NULL(io);
|
||||||
|
|
||||||
if (req->io.bytes == 0) {
|
if (req->bytes == 0) {
|
||||||
ocf_io_end_func(io, -OCF_ERR_INVAL);
|
ocf_io_end_func(io, -OCF_ERR_INVAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
19
src/ocf_io.c
19
src/ocf_io.c
@ -32,7 +32,18 @@ void *ocf_io_allocator_default_new(ocf_io_allocator_t allocator,
|
|||||||
ocf_volume_t volume, ocf_queue_t queue,
|
ocf_volume_t volume, ocf_queue_t queue,
|
||||||
uint64_t addr, uint32_t bytes, uint32_t dir)
|
uint64_t addr, uint32_t bytes, uint32_t dir)
|
||||||
{
|
{
|
||||||
return env_allocator_new(allocator->priv);
|
struct ocf_request *req;
|
||||||
|
|
||||||
|
req = env_allocator_new(allocator->priv);
|
||||||
|
if (!req)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
req->io_queue = queue;
|
||||||
|
req->addr = addr;
|
||||||
|
req->bytes = bytes;
|
||||||
|
req->rw = dir;
|
||||||
|
|
||||||
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ocf_io_allocator_default_del(ocf_io_allocator_t allocator, void *obj)
|
void ocf_io_allocator_default_del(ocf_io_allocator_t allocator, void *obj)
|
||||||
@ -80,12 +91,8 @@ ocf_io_t ocf_io_new(ocf_volume_t volume, ocf_queue_t queue,
|
|||||||
|
|
||||||
env_atomic_set(&req->io.ref_count, 1);
|
env_atomic_set(&req->io.ref_count, 1);
|
||||||
req->io.volume = volume;
|
req->io.volume = volume;
|
||||||
req->io.io_queue = queue;
|
|
||||||
req->io.addr = addr;
|
|
||||||
req->io.bytes = bytes;
|
|
||||||
req->io.dir = dir;
|
|
||||||
req->io.io_class = io_class;
|
req->io.io_class = io_class;
|
||||||
req->io.flags = flags;
|
req->flags = flags;
|
||||||
|
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
@ -92,8 +92,8 @@ static inline void ocf_req_init(struct ocf_request *req, ocf_cache_t cache,
|
|||||||
|
|
||||||
env_atomic_set(&req->ref_count, 1);
|
env_atomic_set(&req->ref_count, 1);
|
||||||
|
|
||||||
req->byte_position = addr;
|
req->addr = addr;
|
||||||
req->byte_length = bytes;
|
req->bytes = bytes;
|
||||||
req->rw = rw;
|
req->rw = rw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ int ocf_req_alloc_map_discard(struct ocf_request *req)
|
|||||||
ENV_BUILD_BUG_ON(MAX_TRIM_RQ_SIZE / ocf_cache_line_size_4 *
|
ENV_BUILD_BUG_ON(MAX_TRIM_RQ_SIZE / ocf_cache_line_size_4 *
|
||||||
sizeof(struct ocf_map_info) > 4 * KiB);
|
sizeof(struct ocf_map_info) > 4 * KiB);
|
||||||
|
|
||||||
if (req->byte_length <= MAX_TRIM_RQ_SIZE)
|
if (req->bytes <= MAX_TRIM_RQ_SIZE)
|
||||||
return ocf_req_alloc_map(req);
|
return ocf_req_alloc_map(req);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -334,9 +334,9 @@ int ocf_req_alloc_map_discard(struct ocf_request *req)
|
|||||||
* can handle more than MAX_TRIM_RQ_SIZE, so for these cache line sizes
|
* can handle more than MAX_TRIM_RQ_SIZE, so for these cache line sizes
|
||||||
* discard request uses only part of the mapping array.
|
* discard request uses only part of the mapping array.
|
||||||
*/
|
*/
|
||||||
req->byte_length = MAX_TRIM_RQ_SIZE;
|
req->bytes = MAX_TRIM_RQ_SIZE;
|
||||||
req->core_line_last = ocf_bytes_2_lines(req->cache,
|
req->core_line_last = ocf_bytes_2_lines(req->cache,
|
||||||
req->byte_position + req->byte_length - 1);
|
req->addr + req->bytes - 1);
|
||||||
req->core_line_count = req->core_line_last - req->core_line_first + 1;
|
req->core_line_count = req->core_line_last - req->core_line_first + 1;
|
||||||
|
|
||||||
return ocf_req_alloc_map(req);
|
return ocf_req_alloc_map(req);
|
||||||
@ -596,7 +596,7 @@ uint64_t ocf_forward_get_flags(ocf_forward_token_t token)
|
|||||||
{
|
{
|
||||||
struct ocf_request *req = (struct ocf_request *)(token & ~1);
|
struct ocf_request *req = (struct ocf_request *)(token & ~1);
|
||||||
|
|
||||||
return (token & 1) ? 0 : req->io.flags;
|
return (token & 1) ? 0 : req->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _ocf_forward_get(ocf_forward_token_t token)
|
static inline void _ocf_forward_get(ocf_forward_token_t token)
|
||||||
|
@ -123,31 +123,12 @@ struct ocf_request;
|
|||||||
typedef int (*ocf_req_cb)(struct ocf_request *req);
|
typedef int (*ocf_req_cb)(struct ocf_request *req);
|
||||||
|
|
||||||
struct ocf_request_io {
|
struct ocf_request_io {
|
||||||
/**
|
|
||||||
* @brief OCF IO destination address
|
|
||||||
*/
|
|
||||||
uint64_t addr;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief OCF IO flags
|
|
||||||
*/
|
|
||||||
uint64_t flags;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief OCF IO size in bytes
|
|
||||||
*/
|
|
||||||
uint32_t bytes;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief OCF IO destination class
|
* @brief OCF IO destination class
|
||||||
*/
|
*/
|
||||||
uint8_t io_class;
|
uint8_t io_class;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief OCF IO direction
|
|
||||||
*/
|
|
||||||
uint8_t dir:1;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief OCF IO reference count
|
* @brief OCF IO reference count
|
||||||
*/
|
*/
|
||||||
@ -158,11 +139,6 @@ struct ocf_request_io {
|
|||||||
*/
|
*/
|
||||||
ocf_volume_t volume;
|
ocf_volume_t volume;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Queue handle
|
|
||||||
*/
|
|
||||||
ocf_queue_t io_queue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief OCF IO start function
|
* @brief OCF IO start function
|
||||||
*/
|
*/
|
||||||
@ -247,27 +223,30 @@ struct ocf_request {
|
|||||||
ctx_data_t *cp_data;
|
ctx_data_t *cp_data;
|
||||||
/*!< Copy of request data */
|
/*!< Copy of request data */
|
||||||
|
|
||||||
uint64_t byte_position;
|
|
||||||
/*!< LBA byte position of request in core domain */
|
|
||||||
|
|
||||||
uint64_t core_line_first;
|
uint64_t core_line_first;
|
||||||
/*! First core line */
|
/*! First core line */
|
||||||
|
|
||||||
uint64_t core_line_last;
|
uint64_t core_line_last;
|
||||||
/*! Last core line */
|
/*! Last core line */
|
||||||
|
|
||||||
uint32_t byte_length;
|
|
||||||
/*!< Byte length of OCF request */
|
|
||||||
|
|
||||||
uint32_t core_line_count;
|
uint32_t core_line_count;
|
||||||
/*! Core line count */
|
/*! Core line count */
|
||||||
|
|
||||||
uint32_t alloc_core_line_count;
|
uint32_t alloc_core_line_count;
|
||||||
/*! Number of core lines at time of request allocation */
|
/*! Number of core lines at time of request allocation */
|
||||||
|
|
||||||
|
uint64_t addr;
|
||||||
|
/*!< LBA byte position of request in core domain */
|
||||||
|
|
||||||
|
uint32_t bytes;
|
||||||
|
/*!< Byte length of OCF request */
|
||||||
|
|
||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
/*!< Offset into request data*/
|
/*!< Offset into request data*/
|
||||||
|
|
||||||
|
uint64_t flags;
|
||||||
|
/*!< IO flags */
|
||||||
|
|
||||||
int error;
|
int error;
|
||||||
/*!< This filed indicates an error for OCF request */
|
/*!< This filed indicates an error for OCF request */
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ bool ocf_core_seq_cutoff_check(ocf_core_t core, struct ocf_request *req)
|
|||||||
|
|
||||||
env_rwlock_read_lock(&req->io_queue->seq_cutoff->lock);
|
env_rwlock_read_lock(&req->io_queue->seq_cutoff->lock);
|
||||||
result = ocf_core_seq_cutoff_base_check(req->io_queue->seq_cutoff,
|
result = ocf_core_seq_cutoff_base_check(req->io_queue->seq_cutoff,
|
||||||
req->byte_position, req->byte_length, req->rw,
|
req->addr, req->bytes, req->rw,
|
||||||
threshold, &queue_stream);
|
threshold, &queue_stream);
|
||||||
env_rwlock_read_unlock(&req->io_queue->seq_cutoff->lock);
|
env_rwlock_read_unlock(&req->io_queue->seq_cutoff->lock);
|
||||||
if (queue_stream)
|
if (queue_stream)
|
||||||
@ -217,7 +217,7 @@ bool ocf_core_seq_cutoff_check(ocf_core_t core, struct ocf_request *req)
|
|||||||
|
|
||||||
env_rwlock_read_lock(&core->seq_cutoff->lock);
|
env_rwlock_read_lock(&core->seq_cutoff->lock);
|
||||||
result = ocf_core_seq_cutoff_base_check(core->seq_cutoff,
|
result = ocf_core_seq_cutoff_base_check(core->seq_cutoff,
|
||||||
req->byte_position, req->byte_length, req->rw,
|
req->addr, req->bytes, req->rw,
|
||||||
threshold, &core_stream);
|
threshold, &core_stream);
|
||||||
env_rwlock_read_unlock(&core->seq_cutoff->lock);
|
env_rwlock_read_unlock(&core->seq_cutoff->lock);
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ void ocf_core_seq_cutoff_update(ocf_core_t core, struct ocf_request *req)
|
|||||||
if (policy == ocf_seq_cutoff_policy_never)
|
if (policy == ocf_seq_cutoff_policy_never)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (req->byte_length >= threshold && promote_on_threshold)
|
if (req->bytes >= threshold && promote_on_threshold)
|
||||||
promote = true;
|
promote = true;
|
||||||
|
|
||||||
if (promotion_count == 1)
|
if (promotion_count == 1)
|
||||||
@ -318,7 +318,7 @@ void ocf_core_seq_cutoff_update(ocf_core_t core, struct ocf_request *req)
|
|||||||
if (req->seq_cutoff_core || promote) {
|
if (req->seq_cutoff_core || promote) {
|
||||||
env_rwlock_write_lock(&core->seq_cutoff->lock);
|
env_rwlock_write_lock(&core->seq_cutoff->lock);
|
||||||
stream = ocf_core_seq_cutoff_base_update(core->seq_cutoff,
|
stream = ocf_core_seq_cutoff_base_update(core->seq_cutoff,
|
||||||
req->byte_position, req->byte_length, req->rw,
|
req->addr, req->bytes, req->rw,
|
||||||
promote);
|
promote);
|
||||||
env_rwlock_write_unlock(&core->seq_cutoff->lock);
|
env_rwlock_write_unlock(&core->seq_cutoff->lock);
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ void ocf_core_seq_cutoff_update(ocf_core_t core, struct ocf_request *req)
|
|||||||
|
|
||||||
env_rwlock_write_lock(&req->io_queue->seq_cutoff->lock);
|
env_rwlock_write_lock(&req->io_queue->seq_cutoff->lock);
|
||||||
stream = ocf_core_seq_cutoff_base_update(req->io_queue->seq_cutoff,
|
stream = ocf_core_seq_cutoff_base_update(req->io_queue->seq_cutoff,
|
||||||
req->byte_position, req->byte_length, req->rw, true);
|
req->addr, req->bytes, req->rw, true);
|
||||||
env_rwlock_write_unlock(&req->io_queue->seq_cutoff->lock);
|
env_rwlock_write_unlock(&req->io_queue->seq_cutoff->lock);
|
||||||
|
|
||||||
if (stream->bytes >= threshold && promote_on_threshold)
|
if (stream->bytes >= threshold && promote_on_threshold)
|
||||||
|
@ -431,14 +431,14 @@ void ocf_core_update_stats(ocf_core_t core, ocf_io_t io)
|
|||||||
|
|
||||||
stats = &core->counters->debug_stats;
|
stats = &core->counters->debug_stats;
|
||||||
|
|
||||||
idx = to_packet_idx(req->io.bytes);
|
idx = to_packet_idx(req->bytes);
|
||||||
if (req->io.dir == OCF_WRITE)
|
if (req->rw == OCF_WRITE)
|
||||||
env_atomic64_inc(&stats->write_size[idx]);
|
env_atomic64_inc(&stats->write_size[idx]);
|
||||||
else
|
else
|
||||||
env_atomic64_inc(&stats->read_size[idx]);
|
env_atomic64_inc(&stats->read_size[idx]);
|
||||||
|
|
||||||
idx = to_align_idx(req->io.addr);
|
idx = to_align_idx(req->addr);
|
||||||
if (req->io.dir == OCF_WRITE)
|
if (req->rw == OCF_WRITE)
|
||||||
env_atomic64_inc(&stats->write_align[idx]);
|
env_atomic64_inc(&stats->write_align[idx]);
|
||||||
else
|
else
|
||||||
env_atomic64_inc(&stats->read_align[idx]);
|
env_atomic64_inc(&stats->read_align[idx]);
|
||||||
|
@ -300,8 +300,8 @@ void ocf_volume_submit_io(ocf_io_t io)
|
|||||||
volume->type->properties->ops.submit_io(io);
|
volume->type->properties->ops.submit_io(io);
|
||||||
} else {
|
} else {
|
||||||
req->volume_forward_end = ocf_volume_req_forward_complete;
|
req->volume_forward_end = ocf_volume_req_forward_complete;
|
||||||
ocf_req_forward_volume_io(req, volume, req->io.dir, req->io.addr,
|
ocf_req_forward_volume_io(req, volume, req->rw, req->addr,
|
||||||
req->io.bytes, req->offset);
|
req->bytes, req->offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ void ocf_volume_submit_discard(ocf_io_t io)
|
|||||||
} else {
|
} else {
|
||||||
req->volume_forward_end = ocf_volume_req_forward_complete;
|
req->volume_forward_end = ocf_volume_req_forward_complete;
|
||||||
ocf_req_forward_volume_discard(req, volume,
|
ocf_req_forward_volume_discard(req, volume,
|
||||||
req->io.addr, req->io.bytes);
|
req->addr, req->bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -192,17 +193,16 @@ static inline void ocf_purge_map_info(struct ocf_request *req)
|
|||||||
if (map_idx == 0) {
|
if (map_idx == 0) {
|
||||||
/* First */
|
/* First */
|
||||||
|
|
||||||
start_bit = BYTES_TO_SECTORS(req->byte_position)
|
start_bit = (BYTES_TO_SECTORS(req->addr)
|
||||||
% ocf_line_sectors(cache);
|
% ocf_line_sectors(cache));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map_idx == (count - 1)) {
|
if (map_idx == (count - 1)) {
|
||||||
/* Last */
|
/* Last */
|
||||||
|
|
||||||
end_bit = BYTES_TO_SECTORS(req->byte_position +
|
end_bit = (BYTES_TO_SECTORS(req->addr +
|
||||||
req->byte_length - 1) %
|
req->bytes - 1) %
|
||||||
ocf_line_sectors(cache);
|
ocf_line_sectors(cache));
|
||||||
}
|
}
|
||||||
|
|
||||||
ocf_metadata_start_collision_shared_access(cache, map[map_idx].
|
ocf_metadata_start_collision_shared_access(cache, map[map_idx].
|
||||||
@ -218,8 +218,8 @@ static inline
|
|||||||
uint8_t ocf_map_line_start_sector(struct ocf_request *req, uint32_t line)
|
uint8_t ocf_map_line_start_sector(struct ocf_request *req, uint32_t line)
|
||||||
{
|
{
|
||||||
if (line == 0) {
|
if (line == 0) {
|
||||||
return BYTES_TO_SECTORS(req->byte_position)
|
return (BYTES_TO_SECTORS(req->addr)
|
||||||
% ocf_line_sectors(req->cache);
|
% ocf_line_sectors(req->cache));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -229,9 +229,8 @@ static inline
|
|||||||
uint8_t ocf_map_line_end_sector(struct ocf_request *req, uint32_t line)
|
uint8_t ocf_map_line_end_sector(struct ocf_request *req, uint32_t line)
|
||||||
{
|
{
|
||||||
if (line == req->core_line_count - 1) {
|
if (line == req->core_line_count - 1) {
|
||||||
return BYTES_TO_SECTORS(req->byte_position +
|
return (BYTES_TO_SECTORS(req->addr + req->bytes - 1) %
|
||||||
req->byte_length - 1) %
|
ocf_line_sectors(req->cache));
|
||||||
ocf_line_sectors(req->cache);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ocf_line_end_sector(req->cache);
|
return ocf_line_end_sector(req->cache);
|
||||||
|
@ -560,7 +560,7 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req)
|
|||||||
ocf_part_id_t part_id;
|
ocf_part_id_t part_id;
|
||||||
|
|
||||||
req->cache_forward_end = _ocf_cleaner_cache_io_end;
|
req->cache_forward_end = _ocf_cleaner_cache_io_end;
|
||||||
req->byte_length = ocf_line_size(cache);
|
req->bytes = ocf_line_size(cache);
|
||||||
|
|
||||||
ocf_req_forward_cache_get(req);
|
ocf_req_forward_cache_get(req);
|
||||||
for (i = 0; i < req->core_line_count; i++, iter++) {
|
for (i = 0; i < req->core_line_count; i++, iter++) {
|
||||||
@ -581,7 +581,7 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req)
|
|||||||
ocf_core_stats_cache_block_update(req->core, part_id, OCF_READ,
|
ocf_core_stats_cache_block_update(req->core, part_id, OCF_READ,
|
||||||
ocf_line_size(cache));
|
ocf_line_size(cache));
|
||||||
|
|
||||||
req->byte_position = iter->core_line * ocf_line_size(cache);
|
req->addr = iter->core_line * ocf_line_size(cache);
|
||||||
|
|
||||||
ocf_req_forward_cache_io(req, OCF_READ, addr,
|
ocf_req_forward_cache_io(req, OCF_READ, addr,
|
||||||
ocf_line_size(cache), offset);
|
ocf_line_size(cache), offset);
|
||||||
@ -624,7 +624,7 @@ static int _ocf_cleaner_do_fire(struct ocf_request *req)
|
|||||||
int result;
|
int result;
|
||||||
|
|
||||||
req->engine_handler = _ocf_cleaner_check_map;
|
req->engine_handler = _ocf_cleaner_check_map;
|
||||||
req->byte_position = req->core_line_count * ocf_line_size(req->cache);
|
req->addr = req->core_line_count * ocf_line_size(req->cache);
|
||||||
|
|
||||||
master = (req->master_io_req_type == ocf_cleaner_req_type_master) ?
|
master = (req->master_io_req_type == ocf_cleaner_req_type_master) ?
|
||||||
req : req->master_io_req;
|
req : req->master_io_req;
|
||||||
|
@ -184,8 +184,8 @@ void ocf_submit_cache_page(ocf_cache_t cache, uint64_t addr, int dir,
|
|||||||
req->cache_forward_end = ocf_submit_cache_page_end;
|
req->cache_forward_end = ocf_submit_cache_page_end;
|
||||||
req->priv = context;
|
req->priv = context;
|
||||||
req->rw = dir;
|
req->rw = dir;
|
||||||
req->byte_position = addr;
|
req->addr = addr;
|
||||||
req->byte_length = PAGE_SIZE;
|
req->bytes = PAGE_SIZE;
|
||||||
|
|
||||||
ocf_req_forward_cache_io(req, dir, addr, PAGE_SIZE, 0);
|
ocf_req_forward_cache_io(req, dir, addr, PAGE_SIZE, 0);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ static int _ocf_parallelize_hndl(struct ocf_request *req)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = parallelize->handle(parallelize, parallelize->priv,
|
error = parallelize->handle(parallelize, parallelize->priv,
|
||||||
req->byte_position, parallelize->shards_cnt);
|
req->addr, parallelize->shards_cnt);
|
||||||
|
|
||||||
env_atomic_cmpxchg(¶llelize->error, 0, error);
|
env_atomic_cmpxchg(¶llelize->error, 0, error);
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ int ocf_parallelize_create(ocf_parallelize_t *parallelize,
|
|||||||
tmp_parallelize->reqs[i]->info.internal = true;
|
tmp_parallelize->reqs[i]->info.internal = true;
|
||||||
tmp_parallelize->reqs[i]->engine_handler =
|
tmp_parallelize->reqs[i]->engine_handler =
|
||||||
_ocf_parallelize_hndl;
|
_ocf_parallelize_hndl;
|
||||||
tmp_parallelize->reqs[i]->byte_position = i;
|
tmp_parallelize->reqs[i]->addr = i;
|
||||||
tmp_parallelize->reqs[i]->priv = tmp_parallelize;
|
tmp_parallelize->reqs[i]->priv = tmp_parallelize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user