Merge new_io and configure into one function

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2019-05-31 14:51:06 +02:00
parent 1454b75c0f
commit e254c9b587
19 changed files with 130 additions and 156 deletions

View File

@@ -263,19 +263,17 @@ void read_end(struct ocf_io *io, int error)
ocf_io_put(io);
}
int read(ocf_core_t core, void *data, addr, uint32_t length)
int read(ocf_core_t core, ocf_queue_t queue, void *data, addr, uint32_t length)
{
/* Allocate IO */
struct ocf_io *io = ocf_new_io(core);
struct ocf_io *io;
io = ocf_core_new_io(core, queue, addr, length, OCF_READ, 0, 0);
if (!io) {
/* Cannot allocate IO */
return -ENOMEM;
}
/* Configure IO, set address, flags, IO class, and etc... */
ocf_io_configure(io, addr, length, OCF_READ, 0, 0);
/* Set completion context and function */
ocf_io_set_cmpl(io, NULL, NULL, read_end);
@@ -286,7 +284,7 @@ int read(ocf_core_t core, void *data, addr, uint32_t length)
}
/* Send IO requests to the cache */
ocf_submit_io(io);
ocf_core_submit_io(io);
/* Just it */
return 0;