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

@@ -128,14 +128,23 @@ int ocf_core_get(ocf_cache_t cache, ocf_core_id_t id, ocf_core_t *core);
* @brief Allocate new ocf_io
*
* @param[in] core Core object
* @param[in] queue IO queue handle
* @param[in] addr OCF IO destination address
* @param[in] bytes OCF IO size in bytes
* @param[in] dir OCF IO direction
* @param[in] io_class OCF IO destination class
* @param[in] flags OCF IO flags
*
* @retval ocf_io object
*/
static inline struct ocf_io *ocf_core_new_io(ocf_core_t core)
static inline struct ocf_io *ocf_core_new_io(ocf_core_t core, ocf_queue_t queue,
uint64_t addr, uint32_t bytes, uint32_t dir,
uint32_t io_class, uint64_t flags)
{
ocf_volume_t volume = ocf_core_get_front_volume(core);
return ocf_volume_new_io(volume);
return ocf_volume_new_io(volume, queue, addr, bytes, dir,
io_class, flags);
}
/**

View File

@@ -140,26 +140,6 @@ struct ocf_io_ops {
*/
void *ocf_io_get_priv(struct ocf_io *io);
/**
* @brief Configure OCF IO
*
* @param[in] io OCF IO
* @param[in] addr OCF IO destination address
* @param[in] bytes OCF IO size in bytes
* @param[in] dir OCF IO direction
* @param[in] io_class OCF IO destination class
* @param[in] flags OCF IO flags
*/
static inline void ocf_io_configure(struct ocf_io *io, uint64_t addr,
uint32_t bytes, uint32_t dir, uint32_t io_class, uint64_t flags)
{
io->addr = addr;
io->bytes = bytes;
io->io_class = io_class;
io->flags = flags;
io->dir = dir;
}
/**
* @brief Increase reference counter in OCF IO
*
@@ -240,17 +220,6 @@ int ocf_io_set_data(struct ocf_io *io, ctx_data_t *data, uint32_t offset);
*/
ctx_data_t *ocf_io_get_data(struct ocf_io *io);
/**
* @brief Set queue to which IO should be submitted
*
* @param[in] io OCF IO to set up
* @param[in] queue IO queue handle
*/
static inline void ocf_io_set_queue(struct ocf_io *io, ocf_queue_t queue)
{
io->io_queue = queue;
}
/**
* @brief Handle IO in cache engine
*

View File

@@ -256,10 +256,19 @@ int ocf_volume_is_atomic(ocf_volume_t volume);
* @brief Allocate new io
*
* @param[in] volume Volume
* @param[in] queue IO queue handle
* @param[in] addr OCF IO destination address
* @param[in] bytes OCF IO size in bytes
* @param[in] dir OCF IO direction
* @param[in] io_class OCF IO destination class
* @param[in] flags OCF IO flags
*
* @return ocf_io on success atomic, otherwise NULL
*/
struct ocf_io *ocf_volume_new_io(ocf_volume_t volume);
struct ocf_io *ocf_volume_new_io(ocf_volume_t volume, ocf_queue_t queue,
uint64_t addr, uint32_t bytes, uint32_t dir,
uint32_t io_class, uint64_t flags);
/**
* @brief Submit io to volume