@@ -440,6 +440,16 @@ void ocf_io_end_func(ocf_io_t io, int error)
440440 req -> io .end (io , req -> io .priv1 , req -> io .priv2 , error );
441441}
442442
443+ void ocf_req_forward_volume_init (struct ocf_request * req ,
444+ ocf_req_end_t callback )
445+ {
446+ /* For forward_volume we reuse cache_* fields. This kind of forward
447+ operation should never happen together with forward_cache.
448+ */
449+ req -> cache_error = 0 ;
450+ req -> cache_forward_end = callback ;
451+ }
452+
443453void ocf_req_forward_volume_io (struct ocf_request * req , ocf_volume_t volume ,
444454 int dir , uint64_t addr , uint64_t bytes , uint64_t offset )
445455{
@@ -471,20 +481,23 @@ void ocf_req_forward_volume_io_simple(struct ocf_request *req,
471481{
472482 ocf_forward_token_t token = ocf_req_to_cache_forward_token (req );
473483
474- req -> cache_error = 0 ;
475-
476484 ocf_req_forward_cache_get (req );
477485 ocf_volume_forward_io_simple (volume , token , dir , addr , bytes );
478486}
479487
488+ void ocf_req_forward_cache_init (struct ocf_request * req ,
489+ ocf_req_end_t callback )
490+ {
491+ req -> cache_error = 0 ;
492+ req -> cache_forward_end = callback ;
493+ }
494+
480495void ocf_req_forward_cache_io (struct ocf_request * req , int dir , uint64_t addr ,
481496 uint64_t bytes , uint64_t offset )
482497{
483498 ocf_volume_t volume = ocf_cache_get_volume (req -> cache );
484499 ocf_forward_token_t token = ocf_req_to_cache_forward_token (req );
485500
486- req -> cache_error = 0 ;
487-
488501 ocf_req_forward_cache_get (req );
489502 ocf_volume_forward_io (volume , token , dir , addr , bytes , offset );
490503}
@@ -494,8 +507,6 @@ void ocf_req_forward_cache_flush(struct ocf_request *req)
494507 ocf_volume_t volume = ocf_cache_get_volume (req -> cache );
495508 ocf_forward_token_t token = ocf_req_to_cache_forward_token (req );
496509
497- req -> cache_error = 0 ;
498-
499510 ocf_req_forward_cache_get (req );
500511 ocf_volume_forward_flush (volume , token );
501512}
@@ -506,8 +517,6 @@ void ocf_req_forward_cache_discard(struct ocf_request *req, uint64_t addr,
506517 ocf_volume_t volume = ocf_cache_get_volume (req -> cache );
507518 ocf_forward_token_t token = ocf_req_to_cache_forward_token (req );
508519
509- req -> cache_error = 0 ;
510-
511520 ocf_req_forward_cache_get (req );
512521 ocf_volume_forward_discard (volume , token , addr , bytes );
513522}
@@ -518,8 +527,6 @@ void ocf_req_forward_cache_write_zeros(struct ocf_request *req, uint64_t addr,
518527 ocf_volume_t volume = ocf_cache_get_volume (req -> cache );
519528 ocf_forward_token_t token = ocf_req_to_cache_forward_token (req );
520529
521- req -> cache_error = 0 ;
522-
523530 ocf_req_forward_cache_get (req );
524531 ocf_volume_forward_write_zeros (volume , token , addr , bytes );
525532}
@@ -530,20 +537,23 @@ void ocf_req_forward_cache_metadata(struct ocf_request *req, int dir,
530537 ocf_volume_t volume = ocf_cache_get_volume (req -> cache );
531538 ocf_forward_token_t token = ocf_req_to_cache_forward_token (req );
532539
533- req -> cache_error = 0 ;
534-
535540 ocf_req_forward_cache_get (req );
536541 ocf_volume_forward_metadata (volume , token , dir , addr , bytes , offset );
537542}
538543
544+ void ocf_req_forward_core_init (struct ocf_request * req ,
545+ ocf_req_end_t callback )
546+ {
547+ req -> core_error = 0 ;
548+ req -> core_forward_end = callback ;
549+ }
550+
539551void ocf_req_forward_core_io (struct ocf_request * req , int dir , uint64_t addr ,
540552 uint64_t bytes , uint64_t offset )
541553{
542554 ocf_volume_t volume = ocf_core_get_volume (req -> core );
543555 ocf_forward_token_t token = ocf_req_to_core_forward_token (req );
544556
545- req -> core_error = 0 ;
546-
547557 ocf_req_forward_core_get (req );
548558 ocf_volume_forward_io (volume , token , dir , addr , bytes , offset );
549559}
@@ -553,8 +563,6 @@ void ocf_req_forward_core_flush(struct ocf_request *req)
553563 ocf_volume_t volume = ocf_core_get_volume (req -> core );
554564 ocf_forward_token_t token = ocf_req_to_core_forward_token (req );
555565
556- req -> core_error = 0 ;
557-
558566 ocf_req_forward_core_get (req );
559567 ocf_volume_forward_flush (volume , token );
560568}
@@ -565,8 +573,6 @@ void ocf_req_forward_core_discard(struct ocf_request *req, uint64_t addr,
565573 ocf_volume_t volume = ocf_core_get_volume (req -> core );
566574 ocf_forward_token_t token = ocf_req_to_core_forward_token (req );
567575
568- req -> core_error = 0 ;
569-
570576 ocf_req_forward_core_get (req );
571577 ocf_volume_forward_discard (volume , token , addr , bytes );
572578}
0 commit comments