Skip to content

Commit

Permalink
Merge pull request #826 from mmichal10/errors-in-engines
Browse files Browse the repository at this point in the history
Errors in engines
  • Loading branch information
robertbaldyga committed Sep 18, 2024
2 parents b3f5ca1 + 194e5a9 commit 5531b9c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 25 deletions.
4 changes: 1 addition & 3 deletions src/engine/engine_d2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ static void _ocf_d2c_completion(struct ocf_request *req, int error)

OCF_DEBUG_RQ(req, "Completion");

if (req->error) {
req->info.core_error = 1;
if (req->error)
ocf_core_stats_core_error_update(req->core, req->rw);
}

/* Complete request */
req->complete(req, req->error);
Expand Down
4 changes: 1 addition & 3 deletions src/engine/engine_pt.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ static void _ocf_read_pt_complete(struct ocf_request *req, int error)

OCF_DEBUG_RQ(req, "Completion");

if (req->error) {
req->info.core_error = 1;
if (req->error)
ocf_core_stats_core_error_update(req->core, OCF_READ);
}

/* Complete request */
req->complete(req, req->error);
Expand Down
1 change: 0 additions & 1 deletion src/engine/engine_rd.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ static void _ocf_read_generic_miss_complete(struct ocf_request *req, int error)
*/
req->complete(req, req->error);

req->info.core_error = 1;
ocf_core_stats_core_error_update(req->core, OCF_READ);

ctx_data_free(cache->owner, req->cp_data);
Expand Down
1 change: 0 additions & 1 deletion src/engine/engine_wi.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ static void _ocf_write_wi_core_complete(struct ocf_request *req, int error)
{
if (error) {
req->error = error;
req->info.core_error = 1;
ocf_core_stats_core_error_update(req->core, OCF_WRITE);
}

Expand Down
1 change: 0 additions & 1 deletion src/engine/engine_wo.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ static void _ocf_read_wo_core_complete(struct ocf_request *req, int error)
{
if (error) {
req->error |= error;
req->info.core_error = 1;
ocf_core_stats_core_error_update(req->core, OCF_READ);
}

Expand Down
26 changes: 11 additions & 15 deletions src/engine/engine_wt.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static void _ocf_write_wt_do_flush_metadata_compl(struct ocf_request *req,

ocf_req_unlock_wr(ocf_cache_line_concurrency(req->cache), req);

req->complete(req, req->info.core_error ? req->error : 0);
req->complete(req, error);

ocf_req_put(req);
}
Expand Down Expand Up @@ -100,14 +100,9 @@ static void _ocf_write_wt_req_complete(struct ocf_request *req)

OCF_DEBUG_RQ(req, "Completion");

if (req->error) {
/* An error occured */

/* Complete request */
req->complete(req, req->info.core_error ? req->error : 0);

if (req->info.cache_error || req->info.core_error) {
req->complete(req, req->error);
ocf_engine_invalidate(req);

return;
}

Expand All @@ -117,21 +112,22 @@ static void _ocf_write_wt_req_complete(struct ocf_request *req)
OCF_QUEUE_ALLOW_SYNC | OCF_QUEUE_PRIO_HIGH);
} else {
ocf_req_unlock_wr(ocf_cache_line_concurrency(req->cache), req);

req->complete(req, req->info.core_error ? req->error : 0);

req->complete(req, 0);
ocf_req_put(req);
}
}

static void _ocf_write_wt_cache_complete(struct ocf_request *req, int error)
{
if (error) {
req->error = req->error ?: error;
/* Cache error code is not propagated further to the user here
* because data could be successfully written to the core device
* despite the cache IO error.
* Error flag is set though to indicate that the error occurred
* and to invalidate the request in completion. */
req->info.cache_error = 1;
ocf_core_stats_cache_error_update(req->core, OCF_WRITE);

if (req->error)
inc_fallback_pt_error_counter(req->cache);
inc_fallback_pt_error_counter(req->cache);
}

_ocf_write_wt_req_complete(req);
Expand Down
11 changes: 10 additions & 1 deletion src/ocf_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ struct ocf_req_info {
uint32_t cleaning_required : 1;
/*!< Eviction failed, need to request cleaning */

uint32_t cache_error : 1;
/*!< Error occurred during I/O on cache device */

uint32_t core_error : 1;
/*!< Error occured during I/O on core device */
/*!< Error occurred during I/O on core device */

uint32_t cleaner_cache_line_lock : 1;
/*!< Cleaner flag - acquire cache line lock */
Expand Down Expand Up @@ -192,6 +195,12 @@ struct ocf_request {
int error;
/*!< This filed indicates an error for OCF request */

int cache_error;
/*!< Indicator of forward IO cache device error */

int core_error;
/*!< Indicator of forward IO core device error */

ocf_part_id_t part_id;
/*!< Targeted partition of requests */

Expand Down

0 comments on commit 5531b9c

Please sign in to comment.