Dynamic I/O queue management
- Queue allocation is now separated from starting cache. - Queue can be created and destroyed in runtime. - All queue ops accept queue handle instead of queue id. - Cache stores queues as list instead of array. Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com> Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:

committed by
Robert Baldyga

parent
1771228a46
commit
e53944d472
@@ -44,7 +44,7 @@ static struct ocf_io_if meta_restart_if = {
|
||||
/*
|
||||
* Get max pages for IO
|
||||
*/
|
||||
static uint32_t metadata_io_max_page(struct ocf_cache *cache)
|
||||
static uint32_t metadata_io_max_page(ocf_cache_t cache)
|
||||
{
|
||||
return ocf_volume_get_max_io_size(&cache->device->volume) / PAGE_SIZE;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ static void metadata_io_read_i_atomic_end(struct ocf_io *io, int error)
|
||||
/*
|
||||
* Iterative read request
|
||||
*/
|
||||
int metadata_io_read_i_atomic(struct ocf_cache *cache,
|
||||
int metadata_io_read_i_atomic(ocf_cache_t cache,
|
||||
ocf_metadata_atomic_io_event_t hndl)
|
||||
{
|
||||
uint64_t i;
|
||||
@@ -159,7 +159,7 @@ static int ocf_restart_meta_io(struct ocf_request *req)
|
||||
{
|
||||
struct ocf_io *io;
|
||||
struct metadata_io_request *meta_io_req;
|
||||
struct ocf_cache *cache;
|
||||
ocf_cache_t cache;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
@@ -205,7 +205,7 @@ static void metadata_io_write_i_asynch_end(struct metadata_io_request *request,
|
||||
int error)
|
||||
{
|
||||
struct metadata_io_request_asynch *a_req;
|
||||
struct ocf_cache *cache;
|
||||
ocf_cache_t cache;
|
||||
|
||||
OCF_CHECK_NULL(request);
|
||||
|
||||
@@ -247,7 +247,7 @@ static void metadata_io_write_i_asynch_end(struct metadata_io_request *request,
|
||||
ocf_metadata_updater_kick(cache);
|
||||
}
|
||||
|
||||
static void metadata_io_req_error(struct ocf_cache *cache,
|
||||
static void metadata_io_req_error(ocf_cache_t cache,
|
||||
struct metadata_io_request_asynch *a_req,
|
||||
uint32_t i, int error)
|
||||
{
|
||||
@@ -262,7 +262,7 @@ static void metadata_io_req_error(struct ocf_cache *cache,
|
||||
/*
|
||||
* Iterative write request asynchronously
|
||||
*/
|
||||
int metadata_io_write_i_asynch(struct ocf_cache *cache, uint32_t queue,
|
||||
int metadata_io_write_i_asynch(ocf_cache_t cache, ocf_queue_t queue,
|
||||
void *context, uint32_t page, uint32_t count,
|
||||
ocf_metadata_io_event_t fill_hndl,
|
||||
ocf_metadata_io_hndl_on_write_t compl_hndl)
|
||||
@@ -439,7 +439,7 @@ static void metadata_io_end(struct ocf_io *io, int error)
|
||||
ctx_data_t *data = ocf_io_get_data(io);
|
||||
uint32_t page = BYTES_TO_PAGES(io->addr);
|
||||
uint32_t count = BYTES_TO_PAGES(io->bytes);
|
||||
struct ocf_cache *cache = mio->cache;
|
||||
ocf_cache_t cache = mio->cache;
|
||||
uint32_t i = 0;
|
||||
|
||||
if (error) {
|
||||
@@ -463,7 +463,7 @@ out:
|
||||
}
|
||||
|
||||
static int metadata_submit_io(
|
||||
struct ocf_cache *cache,
|
||||
ocf_cache_t cache,
|
||||
struct metadata_io *mio,
|
||||
uint32_t count,
|
||||
uint32_t written)
|
||||
@@ -532,7 +532,7 @@ static int metadata_io(struct metadata_io *mio)
|
||||
unsigned char step = 0;
|
||||
int err;
|
||||
|
||||
struct ocf_cache *cache = mio->cache;
|
||||
ocf_cache_t cache = mio->cache;
|
||||
|
||||
/* Check direction value correctness */
|
||||
switch (mio->dir) {
|
||||
@@ -572,7 +572,7 @@ static int metadata_io(struct metadata_io *mio)
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int metadata_io_write_i(struct ocf_cache *cache,
|
||||
int metadata_io_write_i(ocf_cache_t cache,
|
||||
uint32_t page, uint32_t count,
|
||||
ocf_metadata_io_event_t hndl_fn, void *hndl_cntx)
|
||||
{
|
||||
@@ -591,7 +591,7 @@ int metadata_io_write_i(struct ocf_cache *cache,
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int metadata_io_read_i(struct ocf_cache *cache,
|
||||
int metadata_io_read_i(ocf_cache_t cache,
|
||||
uint32_t page, uint32_t count,
|
||||
ocf_metadata_io_event_t hndl_fn, void *hndl_cntx)
|
||||
{
|
||||
@@ -610,7 +610,7 @@ int metadata_io_read_i(struct ocf_cache *cache,
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static int metadata_io_write_fill(struct ocf_cache *cache,
|
||||
static int metadata_io_write_fill(ocf_cache_t cache,
|
||||
ctx_data_t *data, uint32_t page, void *context)
|
||||
{
|
||||
ctx_data_wr_check(cache->owner, data, context, PAGE_SIZE);
|
||||
@@ -620,7 +620,7 @@ static int metadata_io_write_fill(struct ocf_cache *cache,
|
||||
/*
|
||||
* Write request
|
||||
*/
|
||||
int metadata_io_write(struct ocf_cache *cache,
|
||||
int metadata_io_write(ocf_cache_t cache,
|
||||
void *data, uint32_t page)
|
||||
{
|
||||
struct metadata_io mio = {
|
||||
|
@@ -25,7 +25,7 @@
|
||||
* @retval 0 Success
|
||||
* @retval Non-zero Error which will bee finally returned to the caller
|
||||
*/
|
||||
typedef int (*ocf_metadata_io_event_t)(struct ocf_cache *cache,
|
||||
typedef int (*ocf_metadata_io_event_t)(ocf_cache_t cache,
|
||||
ctx_data_t *data, uint32_t page, void *context);
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ typedef int (*ocf_metadata_io_event_t)(struct ocf_cache *cache,
|
||||
* @param error - error
|
||||
* @param page - page that was written
|
||||
*/
|
||||
typedef void (*ocf_metadata_io_hndl_on_write_t)(struct ocf_cache *cache,
|
||||
typedef void (*ocf_metadata_io_hndl_on_write_t)(ocf_cache_t cache,
|
||||
void *context, int error);
|
||||
|
||||
struct metadata_io_request_asynch;
|
||||
@@ -45,7 +45,7 @@ struct metadata_io_request_asynch;
|
||||
* IO request context
|
||||
*/
|
||||
struct metadata_io_request {
|
||||
struct ocf_cache *cache;
|
||||
ocf_cache_t cache;
|
||||
void *context;
|
||||
uint32_t page;
|
||||
uint32_t count;
|
||||
@@ -75,7 +75,7 @@ struct metadata_io_request_atomic {
|
||||
struct metadata_io {
|
||||
int error;
|
||||
int dir;
|
||||
struct ocf_cache *cache;
|
||||
ocf_cache_t cache;
|
||||
uint32_t page;
|
||||
uint32_t count;
|
||||
env_completion completion;
|
||||
@@ -88,7 +88,7 @@ struct metadata_io {
|
||||
* Asynchronous IO request context
|
||||
*/
|
||||
struct metadata_io_request_asynch {
|
||||
struct ocf_cache *cache;
|
||||
ocf_cache_t cache;
|
||||
struct metadata_io_request *reqs;
|
||||
void *context;
|
||||
int error;
|
||||
@@ -111,7 +111,7 @@ struct metadata_io_request_asynch {
|
||||
* @retval Non-zero Error which will bee finally returned to the caller
|
||||
*/
|
||||
typedef int (*ocf_metadata_atomic_io_event_t)(
|
||||
struct ocf_cache *cache, uint64_t sector_addr,
|
||||
ocf_cache_t cache, uint64_t sector_addr,
|
||||
uint32_t sector_no, ctx_data_t *data);
|
||||
|
||||
/**
|
||||
@@ -122,10 +122,10 @@ typedef int (*ocf_metadata_atomic_io_event_t)(
|
||||
* @param page - Page of SSD (cache device) where data has to be placed
|
||||
* @return 0 - No errors, otherwise error occurred
|
||||
*/
|
||||
int metadata_io_write(struct ocf_cache *cache,
|
||||
int metadata_io_write(ocf_cache_t cache,
|
||||
void *data, uint32_t page);
|
||||
|
||||
int metadata_io_read_i_atomic(struct ocf_cache *cache,
|
||||
int metadata_io_read_i_atomic(ocf_cache_t cache,
|
||||
ocf_metadata_atomic_io_event_t hndl);
|
||||
|
||||
/**
|
||||
@@ -139,7 +139,7 @@ int metadata_io_read_i_atomic(struct ocf_cache *cache,
|
||||
*
|
||||
* @return 0 - No errors, otherwise error occurred
|
||||
*/
|
||||
int metadata_io_write_i(struct ocf_cache *cache,
|
||||
int metadata_io_write_i(ocf_cache_t cache,
|
||||
uint32_t page, uint32_t count,
|
||||
ocf_metadata_io_event_t hndl_fn, void *hndl_cntx);
|
||||
|
||||
@@ -154,7 +154,7 @@ int metadata_io_write_i(struct ocf_cache *cache,
|
||||
*
|
||||
* @return 0 - No errors, otherwise error occurred
|
||||
*/
|
||||
int metadata_io_read_i(struct ocf_cache *cache,
|
||||
int metadata_io_read_i(ocf_cache_t cache,
|
||||
uint32_t page, uint32_t count,
|
||||
ocf_metadata_io_event_t hndl_fn, void *hndl_cntx);
|
||||
|
||||
@@ -170,7 +170,7 @@ int metadata_io_read_i(struct ocf_cache *cache,
|
||||
*
|
||||
* @return 0 - No errors, otherwise error occurred
|
||||
*/
|
||||
int metadata_io_write_i_asynch(struct ocf_cache *cache, uint32_t queue,
|
||||
int metadata_io_write_i_asynch(ocf_cache_t cache, ocf_queue_t queue,
|
||||
void *context, uint32_t page, uint32_t count,
|
||||
ocf_metadata_io_event_t fill_hndl,
|
||||
ocf_metadata_io_hndl_on_write_t compl_hndl);
|
||||
|
@@ -72,7 +72,7 @@ static bool _raw_ssd_page_is_valid(struct ocf_metadata_raw *raw, uint32_t page)
|
||||
/*
|
||||
* RAM Implementation - De-Initialize
|
||||
*/
|
||||
static int _raw_ram_deinit(struct ocf_cache *cache,
|
||||
static int _raw_ram_deinit(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw)
|
||||
{
|
||||
OCF_DEBUG_TRACE(cache);
|
||||
@@ -88,7 +88,7 @@ static int _raw_ram_deinit(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Initialize
|
||||
*/
|
||||
static int _raw_ram_init(struct ocf_cache *cache,
|
||||
static int _raw_ram_init(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw)
|
||||
{
|
||||
size_t mem_pool_size;
|
||||
@@ -109,7 +109,7 @@ static int _raw_ram_init(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Size of
|
||||
*/
|
||||
static size_t _raw_ram_size_of(struct ocf_cache *cache,
|
||||
static size_t _raw_ram_size_of(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw)
|
||||
{
|
||||
size_t size;
|
||||
@@ -123,7 +123,7 @@ static size_t _raw_ram_size_of(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Size on SSD
|
||||
*/
|
||||
static uint32_t _raw_ram_size_on_ssd(struct ocf_cache *cache,
|
||||
static uint32_t _raw_ram_size_on_ssd(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw)
|
||||
{
|
||||
const size_t alignment = 128 * KiB / PAGE_SIZE;
|
||||
@@ -134,7 +134,7 @@ static uint32_t _raw_ram_size_on_ssd(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Checksum
|
||||
*/
|
||||
static uint32_t _raw_ram_checksum(struct ocf_cache *cache,
|
||||
static uint32_t _raw_ram_checksum(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw)
|
||||
{
|
||||
uint64_t i;
|
||||
@@ -152,7 +152,7 @@ static uint32_t _raw_ram_checksum(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Get entry
|
||||
*/
|
||||
static int _raw_ram_get(struct ocf_cache *cache,
|
||||
static int _raw_ram_get(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw, ocf_cache_line_t line,
|
||||
void *data, uint32_t size)
|
||||
{
|
||||
@@ -164,7 +164,7 @@ static int _raw_ram_get(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Read only entry access
|
||||
*/
|
||||
static const void *_raw_ram_rd_access(struct ocf_cache *cache,
|
||||
static const void *_raw_ram_rd_access(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw, ocf_cache_line_t line,
|
||||
uint32_t size)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ static const void *_raw_ram_rd_access(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Read only entry access
|
||||
*/
|
||||
static void *_raw_ram_wr_access(struct ocf_cache *cache,
|
||||
static void *_raw_ram_wr_access(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw, ocf_cache_line_t line,
|
||||
uint32_t size)
|
||||
{
|
||||
@@ -188,7 +188,7 @@ static void *_raw_ram_wr_access(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Set Entry
|
||||
*/
|
||||
static int _raw_ram_set(struct ocf_cache *cache,
|
||||
static int _raw_ram_set(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw, ocf_cache_line_t line,
|
||||
void *data, uint32_t size)
|
||||
{
|
||||
@@ -200,7 +200,7 @@ static int _raw_ram_set(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Flush specified element from SSD
|
||||
*/
|
||||
static int _raw_ram_flush(struct ocf_cache *cache,
|
||||
static int _raw_ram_flush(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw, ocf_cache_line_t line)
|
||||
{
|
||||
OCF_DEBUG_PARAM(cache, "Line = %u", line);
|
||||
@@ -215,7 +215,7 @@ static int _raw_ram_flush(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Load all IO callback
|
||||
*/
|
||||
static int _raw_ram_load_all_io(struct ocf_cache *cache,
|
||||
static int _raw_ram_load_all_io(ocf_cache_t cache,
|
||||
ctx_data_t *data, uint32_t page, void *context)
|
||||
{
|
||||
ocf_cache_line_t line;
|
||||
@@ -241,7 +241,7 @@ static int _raw_ram_load_all_io(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Load all metadata elements from SSD
|
||||
*/
|
||||
static int _raw_ram_load_all(struct ocf_cache *cache,
|
||||
static int _raw_ram_load_all(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw)
|
||||
{
|
||||
OCF_DEBUG_TRACE(cache);
|
||||
@@ -253,7 +253,7 @@ static int _raw_ram_load_all(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Flush IO callback - Fill page
|
||||
*/
|
||||
static int _raw_ram_flush_all_fill(struct ocf_cache *cache,
|
||||
static int _raw_ram_flush_all_fill(ocf_cache_t cache,
|
||||
ctx_data_t *data, uint32_t page, void *context)
|
||||
{
|
||||
ocf_cache_line_t line;
|
||||
@@ -278,7 +278,7 @@ static int _raw_ram_flush_all_fill(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Flush all elements
|
||||
*/
|
||||
static int _raw_ram_flush_all(struct ocf_cache *cache,
|
||||
static int _raw_ram_flush_all(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw)
|
||||
{
|
||||
OCF_DEBUG_TRACE(cache);
|
||||
@@ -290,7 +290,7 @@ static int _raw_ram_flush_all(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM RAM Implementation - Mark to Flush
|
||||
*/
|
||||
static void _raw_ram_flush_mark(struct ocf_cache *cache,
|
||||
static void _raw_ram_flush_mark(ocf_cache_t cache,
|
||||
struct ocf_request *req, uint32_t map_idx, int to_state,
|
||||
uint8_t start, uint8_t stop)
|
||||
{
|
||||
@@ -311,7 +311,7 @@ struct _raw_ram_flush_ctx {
|
||||
int error;
|
||||
};
|
||||
|
||||
static void _raw_ram_flush_do_asynch_io_complete(struct ocf_cache *cache,
|
||||
static void _raw_ram_flush_do_asynch_io_complete(ocf_cache_t cache,
|
||||
void *context, int error)
|
||||
{
|
||||
struct _raw_ram_flush_ctx *ctx = context;
|
||||
@@ -336,7 +336,7 @@ static void _raw_ram_flush_do_asynch_io_complete(struct ocf_cache *cache,
|
||||
/*
|
||||
* RAM Implementation - Flush IO callback - Fill page
|
||||
*/
|
||||
static int _raw_ram_flush_do_asynch_fill(struct ocf_cache *cache,
|
||||
static int _raw_ram_flush_do_asynch_fill(ocf_cache_t cache,
|
||||
ctx_data_t *data, uint32_t page, void *context)
|
||||
{
|
||||
ocf_cache_line_t line;
|
||||
@@ -400,7 +400,7 @@ static void __raw_ram_flush_do_asynch_add_pages(struct ocf_request *req,
|
||||
*pages_to_flush = j;
|
||||
}
|
||||
|
||||
static int _raw_ram_flush_do_asynch(struct ocf_cache *cache,
|
||||
static int _raw_ram_flush_do_asynch(ocf_cache_t cache,
|
||||
struct ocf_request *req, struct ocf_metadata_raw *raw,
|
||||
ocf_req_end_t complete)
|
||||
{
|
||||
@@ -575,7 +575,7 @@ static const struct raw_iface IRAW[metadata_raw_type_max] = {
|
||||
* RAW Top interface implementation
|
||||
******************************************************************************/
|
||||
|
||||
int ocf_metadata_raw_init(struct ocf_cache *cache,
|
||||
int ocf_metadata_raw_init(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw)
|
||||
{
|
||||
ENV_BUG_ON(raw->raw_type < metadata_raw_type_min);
|
||||
@@ -585,7 +585,7 @@ int ocf_metadata_raw_init(struct ocf_cache *cache,
|
||||
return raw->iface->init(cache, raw);
|
||||
}
|
||||
|
||||
int ocf_metadata_raw_deinit(struct ocf_cache *cache,
|
||||
int ocf_metadata_raw_deinit(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw *raw)
|
||||
{
|
||||
int result;
|
||||
@@ -599,7 +599,7 @@ int ocf_metadata_raw_deinit(struct ocf_cache *cache,
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t ocf_metadata_raw_size_on_ssd(struct ocf_cache* cache,
|
||||
size_t ocf_metadata_raw_size_on_ssd(ocf_cache_t cache,
|
||||
struct ocf_metadata_raw* raw)
|
||||
{
|
||||
ENV_BUG_ON(raw->raw_type < metadata_raw_type_min);
|
||||
|
Reference in New Issue
Block a user