Decrease memory requirements for metadata io

Magic child metadata request count (33) was deducted
experimentally.

Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Jan Musial 2021-02-09 10:53:43 +01:00
parent d2b5de7970
commit 9f8802e833
2 changed files with 19 additions and 18 deletions

View File

@ -179,10 +179,11 @@ int metadata_io_read_i_atomic(ocf_cache_t cache, ocf_queue_t queue, void *priv,
static void metadata_io_req_fill(struct metadata_io_request *m_req) static void metadata_io_req_fill(struct metadata_io_request *m_req)
{ {
ocf_cache_t cache = m_req->cache; ocf_cache_t cache = m_req->cache;
struct metadata_io_request_asynch *a_req = m_req->asynch;
int i; int i;
for (i = 0; i < m_req->count; i++) { for (i = 0; i < m_req->count; i++) {
m_req->on_meta_fill(cache, m_req->data, a_req->on_meta_fill(cache, m_req->data,
m_req->page + i, m_req->context); m_req->page + i, m_req->context);
} }
} }
@ -190,10 +191,11 @@ static void metadata_io_req_fill(struct metadata_io_request *m_req)
static void metadata_io_req_drain(struct metadata_io_request *m_req) static void metadata_io_req_drain(struct metadata_io_request *m_req)
{ {
ocf_cache_t cache = m_req->cache; ocf_cache_t cache = m_req->cache;
struct metadata_io_request_asynch *a_req = m_req->asynch;
int i; int i;
for (i = 0; i < m_req->count; i++) { for (i = 0; i < m_req->count; i++) {
m_req->on_meta_drain(cache, m_req->data, a_req->on_meta_drain(cache, m_req->data,
m_req->page + i, m_req->context); m_req->page + i, m_req->context);
} }
} }
@ -389,6 +391,8 @@ static int metadata_io_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int dir,
a_req->page = page; a_req->page = page;
a_req->count = count; a_req->count = count;
a_req->flags = flags; a_req->flags = flags;
a_req->on_meta_fill = io_hndl;
a_req->on_meta_drain = io_hndl;
/* IO Requests initialization */ /* IO Requests initialization */
for (i = 0; i < req_count; i++) { for (i = 0; i < req_count; i++) {
@ -397,8 +401,6 @@ static int metadata_io_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int dir,
m_req->asynch = a_req; m_req->asynch = a_req;
m_req->cache = cache; m_req->cache = cache;
m_req->context = context; m_req->context = context;
m_req->on_meta_fill = io_hndl;
m_req->on_meta_drain = io_hndl;
m_req->req.io_if = &metadata_io_restart_if; m_req->req.io_if = &metadata_io_restart_if;
m_req->req.io_queue = queue; m_req->req.io_queue = queue;
m_req->req.cache = cache; m_req->req.cache = cache;

View File

@ -45,22 +45,19 @@ struct metadata_io_request_asynch;
* IO request context * IO request context
*/ */
struct metadata_io_request { struct metadata_io_request {
ocf_cache_t cache;
void *context;
uint32_t page;
uint32_t count;
ocf_metadata_io_event_t on_meta_fill;
ocf_metadata_io_event_t on_meta_drain;
ctx_data_t *data;
int error;
struct metadata_io_request_asynch *asynch;
env_atomic finished;
struct ocf_request req; struct ocf_request req;
struct list_head list; struct list_head list;
ocf_cache_t cache;
void *context;
ctx_data_t *data;
struct metadata_io_request_asynch *asynch;
env_atomic finished;
uint32_t page;
uint32_t count;
int error;
}; };
#define METADATA_IO_REQS_LIMIT 128 #define METADATA_IO_REQS_LIMIT 33
/* /*
* Asynchronous IO request context * Asynchronous IO request context
@ -68,14 +65,16 @@ struct metadata_io_request {
struct metadata_io_request_asynch { struct metadata_io_request_asynch {
struct metadata_io_request reqs[METADATA_IO_REQS_LIMIT]; struct metadata_io_request reqs[METADATA_IO_REQS_LIMIT];
void *context; void *context;
int error;
env_atomic req_remaining; env_atomic req_remaining;
env_atomic req_active; env_atomic req_active;
env_atomic req_current; env_atomic req_current;
ocf_metadata_io_event_t on_meta_fill;
ocf_metadata_io_event_t on_meta_drain;
ocf_metadata_io_end_t on_complete;
uint32_t page; uint32_t page;
uint32_t count; uint32_t count;
int flags; int flags;
ocf_metadata_io_end_t on_complete; int error;
}; };
void metadata_io_req_complete(struct metadata_io_request *m_req); void metadata_io_req_complete(struct metadata_io_request *m_req);