Move common user and freelist partition data to a new struct
New structure ocf_part is added to contain all the data common for both user partitions and freelist partition: part_runtime and part_id. ocf_user_part now contains ocf_part structure as well as pointer to cleaning partition runtime metadata (moved out from part_runtime) and user partition config (no change here). Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include "engine_discard.h"
|
||||
#include "engine_d2c.h"
|
||||
#include "engine_ops.h"
|
||||
#include "../utils/utils_part.h"
|
||||
#include "../utils/utils_user_part.h"
|
||||
#include "../utils/utils_refcnt.h"
|
||||
#include "../ocf_request.h"
|
||||
#include "../metadata/metadata.h"
|
||||
@@ -192,8 +192,8 @@ void ocf_resolve_effective_cache_mode(ocf_cache_t cache,
|
||||
return;
|
||||
}
|
||||
|
||||
req->cache_mode = ocf_part_get_cache_mode(cache,
|
||||
ocf_part_class2id(cache, req->part_id));
|
||||
req->cache_mode = ocf_user_part_get_cache_mode(cache,
|
||||
ocf_user_part_class2id(cache, req->part_id));
|
||||
if (!ocf_cache_mode_is_valid(req->cache_mode))
|
||||
req->cache_mode = cache->conf_meta->cache_mode;
|
||||
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#include "../utils/utils_cache_line.h"
|
||||
#include "../ocf_request.h"
|
||||
#include "../utils/utils_cleaner.h"
|
||||
#include "../utils/utils_part.h"
|
||||
#include "../utils/utils_user_part.h"
|
||||
#include "../metadata/metadata.h"
|
||||
#include "../eviction/eviction.h"
|
||||
#include "../promotion/promotion.h"
|
||||
@@ -517,7 +517,7 @@ static inline int ocf_prepare_clines_evict(struct ocf_request *req)
|
||||
int lock_status = -OCF_ERR_NO_LOCK;
|
||||
bool part_has_space;
|
||||
|
||||
part_has_space = ocf_part_has_space(req);
|
||||
part_has_space = ocf_user_part_has_space(req);
|
||||
if (!part_has_space) {
|
||||
/* adding more cachelines to target partition would overflow
|
||||
it - requesting eviction from target partition only */
|
||||
@@ -544,16 +544,16 @@ static inline int ocf_prepare_clines_miss(struct ocf_request *req)
|
||||
int lock_status = -OCF_ERR_NO_LOCK;
|
||||
|
||||
/* requests to disabled partitions go in pass-through */
|
||||
if (!ocf_part_is_enabled(&req->cache->user_parts[req->part_id])) {
|
||||
if (!ocf_user_part_is_enabled(&req->cache->user_parts[req->part_id])) {
|
||||
ocf_req_set_mapping_error(req);
|
||||
return lock_status;
|
||||
}
|
||||
|
||||
/* NOTE: ocf_part_has_space() below uses potentially stale request
|
||||
/* NOTE: ocf_user_part_has_space() below uses potentially stale request
|
||||
* statistics (collected before hash bucket lock had been upgraded).
|
||||
* It is ok since this check is opportunistic, as partition occupancy
|
||||
* is also subject to change. */
|
||||
if (!ocf_part_has_space(req)) {
|
||||
if (!ocf_user_part_has_space(req)) {
|
||||
ocf_engine_lookup(req);
|
||||
return ocf_prepare_clines_evict(req);
|
||||
}
|
||||
@@ -579,7 +579,7 @@ static inline int ocf_prepare_clines_miss(struct ocf_request *req)
|
||||
|
||||
int ocf_engine_prepare_clines(struct ocf_request *req)
|
||||
{
|
||||
struct ocf_user_part *part = &req->cache->user_parts[req->part_id];
|
||||
struct ocf_user_part *user_part = &req->cache->user_parts[req->part_id];
|
||||
bool mapped;
|
||||
bool promote = true;
|
||||
int lock = -OCF_ERR_NO_LOCK;
|
||||
@@ -628,7 +628,7 @@ int ocf_engine_prepare_clines(struct ocf_request *req)
|
||||
ocf_hb_req_prot_unlock_wr(req);
|
||||
|
||||
if (ocf_req_test_clean_eviction(req)) {
|
||||
ocf_eviction_flush_dirty(req->cache, part, req->io_queue,
|
||||
ocf_eviction_flush_dirty(req->cache, user_part, req->io_queue,
|
||||
128);
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include "engine_pt.h"
|
||||
#include "engine_wb.h"
|
||||
#include "../ocf_request.h"
|
||||
#include "../utils/utils_part.h"
|
||||
#include "../utils/utils_user_part.h"
|
||||
#include "../utils/utils_io.h"
|
||||
#include "../concurrency/ocf_concurrency.h"
|
||||
#include "../metadata/metadata.h"
|
||||
@@ -77,7 +77,7 @@ static int _ocf_read_fast_do(struct ocf_request *req)
|
||||
/* Probably some cache lines are assigned into wrong
|
||||
* partition. Need to move it to new one
|
||||
*/
|
||||
ocf_part_move(req);
|
||||
ocf_user_part_move(req);
|
||||
|
||||
ocf_hb_req_prot_unlock_wr(req);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ int ocf_read_fast(struct ocf_request *req)
|
||||
|
||||
hit = ocf_engine_is_hit(req);
|
||||
|
||||
part_has_space = ocf_part_has_space(req);
|
||||
part_has_space = ocf_user_part_has_space(req);
|
||||
|
||||
if (hit && part_has_space) {
|
||||
ocf_io_start(&req->ioi.io);
|
||||
@@ -198,7 +198,7 @@ int ocf_write_fast(struct ocf_request *req)
|
||||
|
||||
mapped = ocf_engine_is_mapped(req);
|
||||
|
||||
part_has_space = ocf_part_has_space(req);
|
||||
part_has_space = ocf_user_part_has_space(req);
|
||||
|
||||
if (mapped && part_has_space) {
|
||||
ocf_io_start(&req->ioi.io);
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include "cache_engine.h"
|
||||
#include "../ocf_request.h"
|
||||
#include "../utils/utils_io.h"
|
||||
#include "../utils/utils_part.h"
|
||||
#include "../utils/utils_user_part.h"
|
||||
#include "../metadata/metadata.h"
|
||||
#include "../concurrency/ocf_concurrency.h"
|
||||
|
||||
@@ -75,7 +75,7 @@ int ocf_read_pt_do(struct ocf_request *req)
|
||||
/* Probably some cache lines are assigned into wrong
|
||||
* partition. Need to move it to new one
|
||||
*/
|
||||
ocf_part_move(req);
|
||||
ocf_user_part_move(req);
|
||||
|
||||
ocf_hb_req_prot_unlock_wr(req);
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include "../utils/utils_io.h"
|
||||
#include "../ocf_request.h"
|
||||
#include "../utils/utils_cache_line.h"
|
||||
#include "../utils/utils_part.h"
|
||||
#include "../utils/utils_user_part.h"
|
||||
#include "../metadata/metadata.h"
|
||||
#include "../ocf_def_priv.h"
|
||||
|
||||
@@ -182,7 +182,7 @@ static int _ocf_read_generic_do(struct ocf_request *req)
|
||||
/* Probably some cache lines are assigned into wrong
|
||||
* partition. Need to move it to new one
|
||||
*/
|
||||
ocf_part_move(req);
|
||||
ocf_user_part_move(req);
|
||||
|
||||
ocf_hb_req_prot_unlock_wr(req);
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#include "../utils/utils_io.h"
|
||||
#include "../utils/utils_cache_line.h"
|
||||
#include "../utils/utils_request.h"
|
||||
#include "../utils/utils_part.h"
|
||||
#include "../utils/utils_user_part.h"
|
||||
#include "../concurrency/ocf_concurrency.h"
|
||||
|
||||
#define OCF_ENGINE_DEBUG_IO_NAME "wb"
|
||||
@@ -135,7 +135,7 @@ static inline void _ocf_write_wb_submit(struct ocf_request *req)
|
||||
/* Probably some cache lines are assigned into wrong
|
||||
* partition. Need to move it to new one
|
||||
*/
|
||||
ocf_part_move(req);
|
||||
ocf_user_part_move(req);
|
||||
|
||||
ocf_hb_req_prot_unlock_wr(req);
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include "../metadata/metadata.h"
|
||||
#include "../utils/utils_io.h"
|
||||
#include "../utils/utils_cache_line.h"
|
||||
#include "../utils/utils_part.h"
|
||||
#include "../utils/utils_user_part.h"
|
||||
#include "../concurrency/ocf_concurrency.h"
|
||||
|
||||
#define OCF_ENGINE_DEBUG_IO_NAME "wo"
|
||||
|
@@ -11,7 +11,7 @@
|
||||
#include "../ocf_request.h"
|
||||
#include "../utils/utils_io.h"
|
||||
#include "../utils/utils_cache_line.h"
|
||||
#include "../utils/utils_part.h"
|
||||
#include "../utils/utils_user_part.h"
|
||||
#include "../metadata/metadata.h"
|
||||
#include "../concurrency/ocf_concurrency.h"
|
||||
|
||||
@@ -123,7 +123,7 @@ static void _ocf_write_wt_update_bits(struct ocf_request *req)
|
||||
/* Probably some cache lines are assigned into wrong
|
||||
* partition. Need to move it to new one
|
||||
*/
|
||||
ocf_part_move(req);
|
||||
ocf_user_part_move(req);
|
||||
}
|
||||
|
||||
ocf_hb_req_prot_unlock_wr(req);
|
||||
|
Reference in New Issue
Block a user