engine_rd: Ignore backfill buffer allocation error
It's OK to proceed with a read even if failed to allocate a buffer for backfill Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
parent
a3bccbba6c
commit
9c65ec955f
@ -60,10 +60,12 @@ static void _ocf_backfill_complete(struct ocf_request *req, int error)
|
|||||||
backfill_queue_dec_unblock(req->cache);
|
backfill_queue_dec_unblock(req->cache);
|
||||||
|
|
||||||
/* We must free the pages we have allocated */
|
/* We must free the pages we have allocated */
|
||||||
|
if (likely(req->data)) {
|
||||||
ctx_data_secure_erase(cache->owner, req->data);
|
ctx_data_secure_erase(cache->owner, req->data);
|
||||||
ctx_data_munlock(cache->owner, req->data);
|
ctx_data_munlock(cache->owner, req->data);
|
||||||
ctx_data_free(cache->owner, req->data);
|
ctx_data_free(cache->owner, req->data);
|
||||||
req->data = NULL;
|
req->data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (req->error) {
|
if (req->error) {
|
||||||
ocf_engine_invalidate(req);
|
ocf_engine_invalidate(req);
|
||||||
@ -79,13 +81,18 @@ static int _ocf_backfill_do(struct ocf_request *req)
|
|||||||
{
|
{
|
||||||
unsigned int reqs_to_issue;
|
unsigned int reqs_to_issue;
|
||||||
|
|
||||||
|
req->data = req->cp_data;
|
||||||
|
if (unlikely(req->data == NULL)) {
|
||||||
|
env_atomic_set(&req->req_remaining, 1);
|
||||||
|
_ocf_backfill_complete(req, -OCF_ERR_NO_MEM);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
reqs_to_issue = ocf_engine_io_count(req);
|
reqs_to_issue = ocf_engine_io_count(req);
|
||||||
|
|
||||||
/* There will be #reqs_to_issue completions */
|
/* There will be #reqs_to_issue completions */
|
||||||
env_atomic_set(&req->req_remaining, reqs_to_issue);
|
env_atomic_set(&req->req_remaining, reqs_to_issue);
|
||||||
|
|
||||||
req->data = req->cp_data;
|
|
||||||
|
|
||||||
ocf_submit_cache_reqs(req->cache, req, OCF_WRITE, 0, req->byte_length,
|
ocf_submit_cache_reqs(req->cache, req, OCF_WRITE, 0, req->byte_length,
|
||||||
reqs_to_issue, _ocf_backfill_complete);
|
reqs_to_issue, _ocf_backfill_complete);
|
||||||
|
|
||||||
|
@ -103,21 +103,25 @@ static inline void _ocf_read_generic_submit_miss(struct ocf_request *req)
|
|||||||
|
|
||||||
req->cp_data = ctx_data_alloc(cache->owner,
|
req->cp_data = ctx_data_alloc(cache->owner,
|
||||||
BYTES_TO_PAGES(req->byte_length));
|
BYTES_TO_PAGES(req->byte_length));
|
||||||
if (!req->cp_data)
|
if (!req->cp_data) {
|
||||||
|
/* If buffer allocation for backfill fails, ignore the error */
|
||||||
|
ocf_cache_log(cache, log_warn, "Backfill buffer allocation "
|
||||||
|
"error (size %u)\n",
|
||||||
|
req->byte_length);
|
||||||
goto err_alloc;
|
goto err_alloc;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ctx_data_mlock(cache->owner, req->cp_data);
|
ret = ctx_data_mlock(cache->owner, req->cp_data);
|
||||||
if (ret)
|
if (ret) {
|
||||||
goto err_alloc;
|
ocf_cache_log(cache, log_warn, "Backfill error\n");
|
||||||
|
ctx_data_free(cache->owner, req->cp_data);
|
||||||
|
req->cp_data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
err_alloc:
|
||||||
/* Submit read request to core device. */
|
/* Submit read request to core device. */
|
||||||
ocf_submit_volume_req(&req->core->volume, req,
|
ocf_submit_volume_req(&req->core->volume, req,
|
||||||
_ocf_read_generic_miss_complete);
|
_ocf_read_generic_miss_complete);
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
err_alloc:
|
|
||||||
_ocf_read_generic_miss_complete(req, -OCF_ERR_NO_MEM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _ocf_read_generic_do(struct ocf_request *req)
|
static int _ocf_read_generic_do(struct ocf_request *req)
|
||||||
|
Loading…
Reference in New Issue
Block a user