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:
committed by
Michal Mielewczyk
parent
d8d750462a
commit
3fbb75756e
@@ -157,8 +157,7 @@ void ocf_resolve_effective_cache_mode(ocf_cache_t cache,
|
||||
return;
|
||||
}
|
||||
|
||||
if (cache->pt_unaligned_io && !ocf_req_is_4k(req->byte_position,
|
||||
req->byte_length)) {
|
||||
if (cache->pt_unaligned_io && !ocf_req_is_4k(req->addr, req->bytes)) {
|
||||
req->cache_mode = ocf_req_cache_mode_pt;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ void ocf_engine_error(struct ocf_request *req,
|
||||
if (ocf_cache_log_rl(cache)) {
|
||||
ocf_core_log(req->core, log_err,
|
||||
"%s sector: %" ENV_PRIu64 ", bytes: %u\n", msg,
|
||||
BYTES_TO_SECTORS(req->byte_position),
|
||||
req->byte_length);
|
||||
BYTES_TO_SECTORS(req->addr),
|
||||
req->bytes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ void ocf_engine_clean(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,
|
||||
req->byte_length);
|
||||
req->bytes);
|
||||
}
|
||||
|
||||
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_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,
|
||||
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_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,
|
||||
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_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,
|
||||
req->info.hit_no, req->core_line_count);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright(c) 2012-2021 Intel Corporation
|
||||
* Copyright(c) 2024 Huawei Technologies
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
@@ -33,8 +34,8 @@
|
||||
#define OCF_DEBUG_RQ(req, format, ...) \
|
||||
ocf_cache_log(req->cache, log_info, "[Engine][%s][%s, %llu, %u] %s - " \
|
||||
format"\n", OCF_ENGINE_DEBUG_IO_NAME, \
|
||||
OCF_READ == (req)->rw ? "RD" : "WR", req->byte_position, \
|
||||
req->byte_length, __func__, ##__VA_ARGS__)
|
||||
OCF_READ == (req)->rw ? "RD" : "WR", req->addr, \
|
||||
req->bytes, __func__, ##__VA_ARGS__)
|
||||
|
||||
#else
|
||||
#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)
|
||||
{
|
||||
req->byte_position = SECTORS_TO_BYTES(req->discard.sector);
|
||||
req->byte_length = SECTORS_TO_BYTES(req->discard.nr_sects);
|
||||
req->addr = SECTORS_TO_BYTES(req->discard.sector);
|
||||
req->bytes = SECTORS_TO_BYTES(req->discard.nr_sects);
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
req->engine_handler = _ocf_discard_step;
|
||||
@@ -149,13 +149,13 @@ static int _ocf_discard_step(struct ocf_request *req)
|
||||
|
||||
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->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->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 =
|
||||
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->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)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
|
||||
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,
|
||||
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)) {
|
||||
addr = cache->device->metadata_offset;
|
||||
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,
|
||||
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);
|
||||
return;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ void ocf_engine_forward_cache_io_req(struct ocf_request *req, int dir,
|
||||
bytes = ocf_line_size(cache);
|
||||
|
||||
if (i == 0) {
|
||||
uint64_t seek = (req->byte_position) %
|
||||
uint64_t seek = (req->addr) %
|
||||
ocf_line_size(cache);
|
||||
|
||||
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)) {
|
||||
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);
|
||||
|
||||
bytes -= skip;
|
||||
}
|
||||
|
||||
bytes = OCF_MIN(bytes, req->byte_length - total_bytes);
|
||||
bytes = OCF_MIN(bytes, req->bytes - total_bytes);
|
||||
ENV_BUG_ON(bytes == 0);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
ENV_BUG_ON(total_bytes != req->byte_length);
|
||||
ENV_BUG_ON(total_bytes != req->bytes);
|
||||
|
||||
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;
|
||||
|
||||
ocf_req_forward_cache_discard(req, req->byte_position,
|
||||
req->byte_length);
|
||||
ocf_req_forward_cache_discard(req, req->addr,
|
||||
req->bytes);
|
||||
}
|
||||
|
||||
void ocf_engine_forward_core_io_req(struct ocf_request *req,
|
||||
ocf_req_end_t callback)
|
||||
{
|
||||
ocf_core_stats_core_block_update(req->core, req->part_id, req->rw,
|
||||
req->byte_length);
|
||||
req->bytes);
|
||||
|
||||
req->core_forward_end = callback;
|
||||
|
||||
ocf_req_forward_core_io(req, req->rw, req->byte_position,
|
||||
req->byte_length, req->offset);
|
||||
ocf_req_forward_core_io(req, req->rw, req->addr,
|
||||
req->bytes, req->offset);
|
||||
}
|
||||
|
||||
void ocf_engine_forward_core_flush_req(struct ocf_request *req,
|
||||
ocf_req_end_t callback)
|
||||
{
|
||||
ocf_core_stats_core_block_update(req->core, req->part_id, req->rw,
|
||||
req->byte_length);
|
||||
req->bytes);
|
||||
|
||||
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_core_stats_core_block_update(req->core, req->part_id, req->rw,
|
||||
req->byte_length);
|
||||
req->bytes);
|
||||
|
||||
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_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,
|
||||
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 */
|
||||
if (req->cp_data) {
|
||||
ctx_data_cpy(cache->owner, req->cp_data, req->data, 0, 0,
|
||||
req->byte_length);
|
||||
req->bytes);
|
||||
}
|
||||
|
||||
req->complete(req, error);
|
||||
@@ -85,12 +85,12 @@ static inline void _ocf_read_generic_submit_miss(struct ocf_request *req)
|
||||
int ret;
|
||||
|
||||
req->cp_data = ctx_data_alloc(cache->owner,
|
||||
BYTES_TO_PAGES(req->byte_length));
|
||||
BYTES_TO_PAGES(req->bytes));
|
||||
if (!req->cp_data) {
|
||||
/* If buffer allocation for backfill fails, ignore the error */
|
||||
ocf_cache_log(cache, log_warn, "Backfill buffer allocation "
|
||||
"error (size %u)\n",
|
||||
req->byte_length);
|
||||
req->bytes);
|
||||
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_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,
|
||||
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) {
|
||||
/* First */
|
||||
start_bit = BYTES_TO_SECTORS(req->byte_position)
|
||||
% ocf_line_sectors(cache);
|
||||
start_bit = (BYTES_TO_SECTORS(req->addr)
|
||||
% ocf_line_sectors(cache));
|
||||
}
|
||||
|
||||
if (map_idx == (count - 1)) {
|
||||
/* Last */
|
||||
end_bit = BYTES_TO_SECTORS(req->byte_position +
|
||||
req->byte_length - 1) %
|
||||
ocf_line_sectors(cache);
|
||||
end_bit = (BYTES_TO_SECTORS(req->addr +
|
||||
req->bytes - 1) %
|
||||
ocf_line_sectors(cache));
|
||||
}
|
||||
|
||||
ocf_metadata_flush_mark(cache, req, map_idx, INVALID,
|
||||
|
||||
Reference in New Issue
Block a user