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:
Robert Baldyga
2024-08-02 16:06:32 +02:00
committed by Michal Mielewczyk
parent d8d750462a
commit 3fbb75756e
25 changed files with 121 additions and 136 deletions

View File

@@ -1,5 +1,6 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* 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) {
/* 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_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)
{
if (line == 0) {
return BYTES_TO_SECTORS(req->byte_position)
% ocf_line_sectors(req->cache);
return (BYTES_TO_SECTORS(req->addr)
% ocf_line_sectors(req->cache));
}
return 0;
@@ -229,9 +229,8 @@ static inline
uint8_t ocf_map_line_end_sector(struct ocf_request *req, uint32_t line)
{
if (line == req->core_line_count - 1) {
return BYTES_TO_SECTORS(req->byte_position +
req->byte_length - 1) %
ocf_line_sectors(req->cache);
return (BYTES_TO_SECTORS(req->addr + req->bytes - 1) %
ocf_line_sectors(req->cache));
}
return ocf_line_end_sector(req->cache);

View File

@@ -560,7 +560,7 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req)
ocf_part_id_t part_id;
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);
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_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_line_size(cache), offset);
@@ -624,7 +624,7 @@ static int _ocf_cleaner_do_fire(struct ocf_request *req)
int result;
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) ?
req : req->master_io_req;

View File

@@ -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->priv = context;
req->rw = dir;
req->byte_position = addr;
req->byte_length = PAGE_SIZE;
req->addr = addr;
req->bytes = PAGE_SIZE;
ocf_req_forward_cache_io(req, dir, addr, PAGE_SIZE, 0);

View File

@@ -47,7 +47,7 @@ static int _ocf_parallelize_hndl(struct ocf_request *req)
int error;
error = parallelize->handle(parallelize, parallelize->priv,
req->byte_position, parallelize->shards_cnt);
req->addr, parallelize->shards_cnt);
env_atomic_cmpxchg(&parallelize->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]->engine_handler =
_ocf_parallelize_hndl;
tmp_parallelize->reqs[i]->byte_position = i;
tmp_parallelize->reqs[i]->addr = i;
tmp_parallelize->reqs[i]->priv = tmp_parallelize;
}