Unify req naming convention (rq -> req)

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2018-12-12 13:25:26 +01:00
parent 131148adac
commit db92083432
70 changed files with 1815 additions and 1815 deletions

View File

@@ -8,7 +8,7 @@
#include "engine_zero.h"
#include "engine_common.h"
#include "../concurrency/ocf_concurrency.h"
#include "../utils/utils_rq.h"
#include "../utils/utils_req.h"
#include "../utils/utils_cache_line.h"
#include "../utils/utils_io.h"
#include "../metadata/metadata.h"
@@ -16,28 +16,28 @@
#define OCF_ENGINE_DEBUG_IO_NAME "zero"
#include "engine_debug.h"
static int ocf_zero_purge(struct ocf_request *rq)
static int ocf_zero_purge(struct ocf_request *req)
{
struct ocf_cache *cache = rq->cache;
struct ocf_cache *cache = req->cache;
if (rq->error) {
ocf_engine_error(rq, true, "Failed to discard data on cache");
if (req->error) {
ocf_engine_error(req, true, "Failed to discard data on cache");
} else {
/* There are mapped cache line, need to remove them */
OCF_METADATA_LOCK_WR(); /*- Metadata WR access ---------------*/
/* Remove mapped cache lines from metadata */
ocf_purge_map_info(rq);
ocf_purge_map_info(req);
OCF_METADATA_UNLOCK_WR(); /*- END Metadata WR access ---------*/
}
ocf_rq_unlock_wr(rq);
ocf_req_unlock_wr(req);
rq->complete(rq, rq->error);
req->complete(req, req->error);
ocf_rq_put(rq);
ocf_req_put(req);
return 0;
}
@@ -47,28 +47,28 @@ static const struct ocf_io_if _io_if_zero_purge = {
.write = ocf_zero_purge,
};
static void _ocf_zero_io_flush_metadata(struct ocf_request *rq, int error)
static void _ocf_zero_io_flush_metadata(struct ocf_request *req, int error)
{
if (error) {
env_atomic_inc(&rq->cache->core_obj[rq->core_id].counters->
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
cache_errors.write);
rq->error = error;
req->error = error;
}
if (env_atomic_dec_return(&rq->req_remaining))
if (env_atomic_dec_return(&req->req_remaining))
return;
ocf_engine_push_rq_front_if(rq, &_io_if_zero_purge, true);
ocf_engine_push_req_front_if(req, &_io_if_zero_purge, true);
}
static inline void ocf_zero_map_info(struct ocf_request *rq)
static inline void ocf_zero_map_info(struct ocf_request *req)
{
uint32_t map_idx = 0;
uint8_t start_bit;
uint8_t end_bit;
struct ocf_map_info *map = rq->map;
struct ocf_cache *cache = rq->cache;
uint32_t count = rq->core_line_count;
struct ocf_map_info *map = req->map;
struct ocf_cache *cache = req->cache;
uint32_t count = req->core_line_count;
/* Purge range on the basis of map info
*
@@ -86,43 +86,43 @@ static inline void ocf_zero_map_info(struct ocf_request *rq)
if (map_idx == 0) {
/* First */
start_bit = BYTES_TO_SECTORS(rq->byte_position)
start_bit = BYTES_TO_SECTORS(req->byte_position)
% ocf_line_sectors(cache);
}
if (map_idx == (count - 1)) {
/* Last */
end_bit = BYTES_TO_SECTORS(rq->byte_position +
rq->byte_length - 1) %
end_bit = BYTES_TO_SECTORS(req->byte_position +
req->byte_length - 1) %
ocf_line_sectors(cache);
}
ocf_metadata_flush_mark(cache, rq, map_idx, INVALID,
ocf_metadata_flush_mark(cache, req, map_idx, INVALID,
start_bit, end_bit);
}
}
static int _ocf_zero_do(struct ocf_request *rq)
static int _ocf_zero_do(struct ocf_request *req)
{
struct ocf_cache *cache = rq->cache;
struct ocf_cache *cache = req->cache;
/* Get OCF request - increase reference counter */
ocf_rq_get(rq);
ocf_req_get(req);
/* Mark cache lines for zeroing/discarding */
ocf_zero_map_info(rq);
ocf_zero_map_info(req);
/* Discard marked cache lines */
env_atomic_set(&rq->req_remaining, 1);
if (rq->info.flush_metadata) {
env_atomic_set(&req->req_remaining, 1);
if (req->info.flush_metadata) {
/* Request was dirty and need to flush metadata */
ocf_metadata_flush_do_asynch(cache, rq,
ocf_metadata_flush_do_asynch(cache, req,
_ocf_zero_io_flush_metadata);
}
_ocf_zero_io_flush_metadata(rq, 0);
_ocf_zero_io_flush_metadata(req, 0);
/* Put OCF request - decrease reference counter */
ocf_rq_put(rq);
ocf_req_put(req);
return 0;
}
@@ -137,30 +137,30 @@ static const struct ocf_io_if _io_if_ocf_zero_do = {
* - Caller has to have metadata write lock
* - Core line has to be mapped
*/
void ocf_engine_zero_line(struct ocf_request *rq)
void ocf_engine_zero_line(struct ocf_request *req)
{
int lock = OCF_LOCK_NOT_ACQUIRED;
ENV_BUG_ON(rq->core_line_count != 1);
ENV_BUG_ON(req->core_line_count != 1);
/* Traverse to check if request is mapped */
ocf_engine_traverse(rq);
ocf_engine_traverse(req);
ENV_BUG_ON(!ocf_engine_is_mapped(rq));
ENV_BUG_ON(!ocf_engine_is_mapped(req));
rq->resume = ocf_engine_on_resume;
rq->io_if = &_io_if_ocf_zero_do;
req->resume = ocf_engine_on_resume;
req->io_if = &_io_if_ocf_zero_do;
/* Some cache line are mapped, lock request for WRITE access */
lock = ocf_rq_trylock_wr(rq);
lock = ocf_req_trylock_wr(req);
if (lock >= 0) {
ENV_BUG_ON(lock != OCF_LOCK_ACQUIRED);
ocf_engine_push_rq_front_if(rq, &_io_if_ocf_zero_do, true);
ocf_engine_push_req_front_if(req, &_io_if_ocf_zero_do, true);
} else {
OCF_DEBUG_RQ(rq, "LOCK ERROR %d", lock);
rq->complete(rq, lock);
ocf_rq_put(rq);
OCF_DEBUG_RQ(req, "LOCK ERROR %d", lock);
req->complete(req, lock);
ocf_req_put(req);
}
}