Propagate I/O flags (e.g. FUA) to metadata flush I/O

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2020-09-29 14:46:03 +02:00
parent 9d07955640
commit c945db356c
4 changed files with 14 additions and 11 deletions

View File

@ -223,7 +223,7 @@ static int metadata_io_restart_req(struct ocf_request *req)
io = ocf_new_cache_io(cache, req->io_queue, io = ocf_new_cache_io(cache, req->io_queue,
PAGES_TO_BYTES(m_req->page), PAGES_TO_BYTES(m_req->page),
PAGES_TO_BYTES(m_req->count), PAGES_TO_BYTES(m_req->count),
m_req->req.rw, 0, 0); m_req->req.rw, 0, m_req->asynch->flags);
if (!io) { if (!io) {
metadata_io_io_end(m_req, -OCF_ERR_NO_MEM); metadata_io_io_end(m_req, -OCF_ERR_NO_MEM);
return 0; return 0;
@ -361,7 +361,7 @@ void metadata_io_req_complete(struct metadata_io_request *m_req)
* Iterative write request asynchronously * Iterative write request asynchronously
*/ */
static int metadata_io_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int dir, static int metadata_io_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int dir,
void *context, uint32_t page, uint32_t count, void *context, uint32_t page, uint32_t count, int flags,
ocf_metadata_io_event_t io_hndl, ocf_metadata_io_event_t io_hndl,
ocf_metadata_io_end_t compl_hndl) ocf_metadata_io_end_t compl_hndl)
{ {
@ -386,6 +386,7 @@ static int metadata_io_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int dir,
a_req->context = context; a_req->context = context;
a_req->page = page; a_req->page = page;
a_req->count = count; a_req->count = count;
a_req->flags = flags;
/* IO Requests initialization */ /* IO Requests initialization */
for (i = 0; i < req_count; i++) { for (i = 0; i < req_count; i++) {
@ -435,21 +436,21 @@ err:
} }
int metadata_io_write_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int metadata_io_write_i_asynch(ocf_cache_t cache, ocf_queue_t queue,
void *context, uint32_t page, uint32_t count, void *context, uint32_t page, uint32_t count, int flags,
ocf_metadata_io_event_t fill_hndl, ocf_metadata_io_event_t fill_hndl,
ocf_metadata_io_end_t compl_hndl) ocf_metadata_io_end_t compl_hndl)
{ {
return metadata_io_i_asynch(cache, queue, OCF_WRITE, context, return metadata_io_i_asynch(cache, queue, OCF_WRITE, context,
page, count, fill_hndl, compl_hndl); page, count, flags, fill_hndl, compl_hndl);
} }
int metadata_io_read_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int metadata_io_read_i_asynch(ocf_cache_t cache, ocf_queue_t queue,
void *context, uint32_t page, uint32_t count, void *context, uint32_t page, uint32_t count, int flags,
ocf_metadata_io_event_t drain_hndl, ocf_metadata_io_event_t drain_hndl,
ocf_metadata_io_end_t compl_hndl) ocf_metadata_io_end_t compl_hndl)
{ {
return metadata_io_i_asynch(cache, queue, OCF_READ, context, return metadata_io_i_asynch(cache, queue, OCF_READ, context,
page, count, drain_hndl, compl_hndl); page, count, flags, drain_hndl, compl_hndl);
} }
int ocf_metadata_io_init(ocf_cache_t cache) int ocf_metadata_io_init(ocf_cache_t cache)

View File

@ -74,6 +74,7 @@ struct metadata_io_request_asynch {
env_atomic req_current; env_atomic req_current;
uint32_t page; uint32_t page;
uint32_t count; uint32_t count;
int flags;
ocf_metadata_io_end_t on_complete; ocf_metadata_io_end_t on_complete;
}; };
@ -122,7 +123,7 @@ int metadata_io_read_i_atomic(ocf_cache_t cache, ocf_queue_t queue,
* @return 0 - No errors, otherwise error occurred * @return 0 - No errors, otherwise error occurred
*/ */
int metadata_io_write_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int metadata_io_write_i_asynch(ocf_cache_t cache, ocf_queue_t queue,
void *context, uint32_t page, uint32_t count, void *context, uint32_t page, uint32_t count, int flags,
ocf_metadata_io_event_t fill_hndl, ocf_metadata_io_event_t fill_hndl,
ocf_metadata_io_end_t compl_hndl); ocf_metadata_io_end_t compl_hndl);
@ -140,7 +141,7 @@ int metadata_io_write_i_asynch(ocf_cache_t cache, ocf_queue_t queue,
* @return 0 - No errors, otherwise error occurred * @return 0 - No errors, otherwise error occurred
*/ */
int metadata_io_read_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int metadata_io_read_i_asynch(ocf_cache_t cache, ocf_queue_t queue,
void *context, uint32_t page, uint32_t count, void *context, uint32_t page, uint32_t count, int flags,
ocf_metadata_io_event_t drain_hndl, ocf_metadata_io_event_t drain_hndl,
ocf_metadata_io_end_t compl_hndl); ocf_metadata_io_end_t compl_hndl);

View File

@ -259,7 +259,7 @@ static void _raw_ram_load_all(ocf_cache_t cache, struct ocf_metadata_raw *raw,
context->priv = priv; context->priv = priv;
result = metadata_io_read_i_asynch(cache, cache->mngt_queue, context, result = metadata_io_read_i_asynch(cache, cache->mngt_queue, context,
raw->ssd_pages_offset, raw->ssd_pages, raw->ssd_pages_offset, raw->ssd_pages, 0,
_raw_ram_load_all_drain, _raw_ram_load_all_complete); _raw_ram_load_all_drain, _raw_ram_load_all_complete);
if (result) if (result)
_raw_ram_load_all_complete(cache, context, result); _raw_ram_load_all_complete(cache, context, result);
@ -331,7 +331,7 @@ static void _raw_ram_flush_all(ocf_cache_t cache, struct ocf_metadata_raw *raw,
context->priv = priv; context->priv = priv;
result = metadata_io_write_i_asynch(cache, cache->mngt_queue, context, result = metadata_io_write_i_asynch(cache, cache->mngt_queue, context,
raw->ssd_pages_offset, raw->ssd_pages, raw->ssd_pages_offset, raw->ssd_pages, 0,
_raw_ram_flush_all_fill, _raw_ram_flush_all_complete); _raw_ram_flush_all_fill, _raw_ram_flush_all_complete);
if (result) if (result)
_raw_ram_flush_all_complete(cache, context, result); _raw_ram_flush_all_complete(cache, context, result);
@ -536,6 +536,7 @@ static int _raw_ram_flush_do_asynch(ocf_cache_t cache,
result |= metadata_io_write_i_asynch(cache, req->io_queue, ctx, result |= metadata_io_write_i_asynch(cache, req->io_queue, ctx,
raw->ssd_pages_offset + start_page, count, raw->ssd_pages_offset + start_page, count,
req->ioi.io.flags,
_raw_ram_flush_do_asynch_fill, _raw_ram_flush_do_asynch_fill,
_raw_ram_flush_do_asynch_io_complete); _raw_ram_flush_do_asynch_io_complete);

View File

@ -550,7 +550,7 @@ void raw_dynamic_flush_all(ocf_cache_t cache, struct ocf_metadata_raw *raw,
context->priv = priv; context->priv = priv;
result = metadata_io_write_i_asynch(cache, cache->mngt_queue, context, result = metadata_io_write_i_asynch(cache, cache->mngt_queue, context,
raw->ssd_pages_offset, raw->ssd_pages, raw->ssd_pages_offset, raw->ssd_pages, 0,
raw_dynamic_flush_all_fill, raw_dynamic_flush_all_fill,
raw_dynamic_flush_all_complete); raw_dynamic_flush_all_complete);
if (result) if (result)