Remove unused functions
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com> Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
parent
1ed707361f
commit
10098ccedd
@ -154,17 +154,6 @@ const char *ocf_get_io_iface_name(ocf_req_cache_mode_t cache_mode)
|
|||||||
return cache_mode_io_if_map[cache_mode]->name;
|
return cache_mode_io_if_map[cache_mode]->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ocf_req_cb ocf_io_if_type_to_engine_cb(
|
|
||||||
enum ocf_io_if_type io_if_type, int rw)
|
|
||||||
{
|
|
||||||
if (unlikely(io_if_type == OCF_IO_MAX_IF ||
|
|
||||||
io_if_type == OCF_IO_PRIV_MAX_IF)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return IO_IFS[io_if_type].cbs[rw];
|
|
||||||
}
|
|
||||||
|
|
||||||
static ocf_req_cb ocf_cache_mode_to_engine_cb(
|
static ocf_req_cb ocf_cache_mode_to_engine_cb(
|
||||||
ocf_req_cache_mode_t req_cache_mode, int rw)
|
ocf_req_cache_mode_t req_cache_mode, int rw)
|
||||||
{
|
{
|
||||||
|
@ -214,158 +214,3 @@ err_io:
|
|||||||
env_vfree(context);
|
env_vfree(context);
|
||||||
cmpl(priv, result);
|
cmpl(priv, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ocf_submit_volume_req_cmpl(struct ocf_io *io, int error)
|
|
||||||
{
|
|
||||||
struct ocf_request *req = io->priv1;
|
|
||||||
ocf_req_end_t callback = io->priv2;
|
|
||||||
|
|
||||||
callback(req, error);
|
|
||||||
|
|
||||||
ocf_io_put(io);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ocf_submit_cache_flush(struct ocf_request *req, ocf_req_end_t callback)
|
|
||||||
{
|
|
||||||
uint64_t flags = req->ioi.io.flags;
|
|
||||||
struct ocf_io *io;
|
|
||||||
|
|
||||||
io = ocf_new_cache_io(req->cache, req->io_queue, 0, 0, OCF_WRITE, 0,
|
|
||||||
flags);
|
|
||||||
if (!io) {
|
|
||||||
callback(req, -OCF_ERR_NO_MEM);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
|
||||||
|
|
||||||
ocf_volume_submit_flush(io);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ocf_submit_cache_reqs(struct ocf_cache *cache,
|
|
||||||
struct ocf_request *req, int dir, uint64_t offset,
|
|
||||||
uint64_t size, unsigned int reqs, ocf_req_end_t callback)
|
|
||||||
{
|
|
||||||
uint64_t flags = req->ioi.io.flags;
|
|
||||||
uint32_t io_class = req->ioi.io.io_class;
|
|
||||||
uint64_t addr, bytes, total_bytes = 0;
|
|
||||||
struct ocf_io *io;
|
|
||||||
int err;
|
|
||||||
uint32_t i;
|
|
||||||
uint32_t first_cl = ocf_bytes_2_lines(cache, req->byte_position +
|
|
||||||
offset) - ocf_bytes_2_lines(cache, req->byte_position);
|
|
||||||
|
|
||||||
ENV_BUG_ON(req->byte_length < offset + size);
|
|
||||||
ENV_BUG_ON(first_cl + reqs > req->core_line_count);
|
|
||||||
|
|
||||||
if (reqs == 1) {
|
|
||||||
addr = req->map[first_cl].coll_idx;
|
|
||||||
addr *= ocf_line_size(cache);
|
|
||||||
addr += cache->device->metadata_offset;
|
|
||||||
addr += ((req->byte_position + offset) % ocf_line_size(cache));
|
|
||||||
bytes = size;
|
|
||||||
|
|
||||||
io = ocf_new_cache_io(cache, req->io_queue,
|
|
||||||
addr, bytes, dir, io_class, flags);
|
|
||||||
if (!io) {
|
|
||||||
callback(req, -OCF_ERR_NO_MEM);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
|
||||||
|
|
||||||
err = ocf_io_set_data(io, req->data, req->offset + offset);
|
|
||||||
if (err) {
|
|
||||||
ocf_io_put(io);
|
|
||||||
callback(req, err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ocf_core_stats_cache_block_update(req->core, io_class,
|
|
||||||
dir, bytes);
|
|
||||||
|
|
||||||
ocf_volume_submit_io(io);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Issue requests to cache. */
|
|
||||||
for (i = 0; i < reqs; i++) {
|
|
||||||
addr = req->map[first_cl + i].coll_idx;
|
|
||||||
addr *= ocf_line_size(cache);
|
|
||||||
addr += cache->device->metadata_offset;
|
|
||||||
bytes = ocf_line_size(cache);
|
|
||||||
|
|
||||||
if (i == 0) {
|
|
||||||
uint64_t seek = ((req->byte_position + offset) %
|
|
||||||
ocf_line_size(cache));
|
|
||||||
|
|
||||||
addr += seek;
|
|
||||||
bytes -= seek;
|
|
||||||
} else if (i == (reqs - 1)) {
|
|
||||||
uint64_t skip = (ocf_line_size(cache) -
|
|
||||||
((req->byte_position + offset + size) %
|
|
||||||
ocf_line_size(cache))) % ocf_line_size(cache);
|
|
||||||
|
|
||||||
bytes -= skip;
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes = OCF_MIN(bytes, size - total_bytes);
|
|
||||||
ENV_BUG_ON(bytes == 0);
|
|
||||||
|
|
||||||
io = ocf_new_cache_io(cache, req->io_queue,
|
|
||||||
addr, bytes, dir, io_class, flags);
|
|
||||||
if (!io) {
|
|
||||||
/* Finish all IOs which left with ERROR */
|
|
||||||
for (; i < reqs; i++)
|
|
||||||
callback(req, -OCF_ERR_NO_MEM);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
|
||||||
|
|
||||||
err = ocf_io_set_data(io, req->data,
|
|
||||||
req->offset + offset + total_bytes);
|
|
||||||
if (err) {
|
|
||||||
ocf_io_put(io);
|
|
||||||
/* Finish all IOs which left with ERROR */
|
|
||||||
for (; i < reqs; i++)
|
|
||||||
callback(req, err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ocf_core_stats_cache_block_update(req->core, io_class,
|
|
||||||
dir, bytes);
|
|
||||||
ocf_volume_submit_io(io);
|
|
||||||
total_bytes += bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
ENV_BUG_ON(total_bytes != size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ocf_submit_volume_req(ocf_volume_t volume, struct ocf_request *req,
|
|
||||||
ocf_req_end_t callback)
|
|
||||||
{
|
|
||||||
uint64_t flags = req->ioi.io.flags;
|
|
||||||
uint32_t io_class = req->ioi.io.io_class;
|
|
||||||
int dir = req->rw;
|
|
||||||
struct ocf_io *io;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
ocf_core_stats_core_block_update(req->core, io_class, dir,
|
|
||||||
req->byte_length);
|
|
||||||
|
|
||||||
io = ocf_volume_new_io(volume, req->io_queue, req->byte_position,
|
|
||||||
req->byte_length, dir, io_class, flags);
|
|
||||||
if (!io) {
|
|
||||||
callback(req, -OCF_ERR_NO_MEM);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
|
||||||
err = ocf_io_set_data(io, req->data, req->offset);
|
|
||||||
if (err) {
|
|
||||||
ocf_io_put(io);
|
|
||||||
callback(req, err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ocf_volume_submit_io(io);
|
|
||||||
}
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright(c) 2012-2022 Intel Corporation
|
* Copyright(c) 2012-2022 Intel Corporation
|
||||||
|
* Copyright(c) 2024 Huawei Technologies
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -8,41 +9,6 @@
|
|||||||
|
|
||||||
#include "../ocf_request.h"
|
#include "../ocf_request.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if 2 IOs are overlapping.
|
|
||||||
* @param start1 start of first range (inclusive)
|
|
||||||
* @param end1 end of first range (exclusive)
|
|
||||||
* @param start2 start of second range (inclusive)
|
|
||||||
* @param end2 end of second range (exclusive)
|
|
||||||
* @return 0 in case overlap is not detected, otherwise 1
|
|
||||||
*/
|
|
||||||
static inline int ocf_io_range_overlaps(uint32_t start1, uint32_t end1,
|
|
||||||
uint32_t start2, uint32_t end2)
|
|
||||||
{
|
|
||||||
if (start2 <= start1 && end2 >= start1)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (start2 >= start1 && end1 >= start2)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if 2 IOs are overlapping.
|
|
||||||
* @param start1 start of first range (inclusive)
|
|
||||||
* @param count1 no of bytes, cachelines (etc) for first range
|
|
||||||
* @param start2 start of second range (inclusive)
|
|
||||||
* @param count2 no of bytes, cachelines (etc) for second range
|
|
||||||
* @return 0 in case overlap is not detected, otherwise 1
|
|
||||||
*/
|
|
||||||
static inline int ocf_io_overlaps(uint32_t start1, uint32_t count1,
|
|
||||||
uint32_t start2, uint32_t count2)
|
|
||||||
{
|
|
||||||
return ocf_io_range_overlaps(start1, start1 + count1 - 1, start2,
|
|
||||||
start2 + count2 - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef void (*ocf_submit_end_t)(void *priv, int error);
|
typedef void (*ocf_submit_end_t)(void *priv, int error);
|
||||||
|
|
||||||
void ocf_submit_volume_flush(ocf_volume_t volume,
|
void ocf_submit_volume_flush(ocf_volume_t volume,
|
||||||
@ -57,15 +23,6 @@ void ocf_submit_write_zeros(ocf_volume_t volume, uint64_t addr,
|
|||||||
void ocf_submit_cache_page(ocf_cache_t cache, uint64_t addr, int dir,
|
void ocf_submit_cache_page(ocf_cache_t cache, uint64_t addr, int dir,
|
||||||
void *buffer, ocf_submit_end_t cmpl, void *priv);
|
void *buffer, ocf_submit_end_t cmpl, void *priv);
|
||||||
|
|
||||||
void ocf_submit_volume_req(ocf_volume_t volume, struct ocf_request *req,
|
|
||||||
ocf_req_end_t callback);
|
|
||||||
|
|
||||||
void ocf_submit_cache_reqs(struct ocf_cache *cache,
|
|
||||||
struct ocf_request *req, int dir, uint64_t offset,
|
|
||||||
uint64_t size, unsigned int reqs, ocf_req_end_t callback);
|
|
||||||
|
|
||||||
void ocf_submit_cache_flush(struct ocf_request *req, ocf_req_end_t callback);
|
|
||||||
|
|
||||||
static inline struct ocf_io *ocf_new_cache_io(ocf_cache_t cache,
|
static inline struct ocf_io *ocf_new_cache_io(ocf_cache_t cache,
|
||||||
ocf_queue_t queue, uint64_t addr, uint32_t bytes,
|
ocf_queue_t queue, uint64_t addr, uint32_t bytes,
|
||||||
uint32_t dir, uint32_t io_class, uint64_t flags)
|
uint32_t dir, uint32_t io_class, uint64_t flags)
|
||||||
|
Loading…
Reference in New Issue
Block a user