General packing of structs
Get back some memory/cachelines by packing any leftover static fields together. Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
This commit is contained in:
parent
642527d72a
commit
fdd6b88cc4
@ -27,6 +27,9 @@ struct ocf_cache_info {
|
||||
uint8_t volume_type;
|
||||
/*!< Cache volume type */
|
||||
|
||||
uint8_t state;
|
||||
/*!< Cache state (running/flushing/stopping etc...) */
|
||||
|
||||
uint32_t size;
|
||||
/*!< Actual cache size (in cache lines) */
|
||||
|
||||
@ -69,9 +72,6 @@ struct ocf_cache_info {
|
||||
set as a result of reaching IO error threshold */
|
||||
} fallback_pt;
|
||||
|
||||
uint8_t state;
|
||||
/*!< Cache state (running/flushing/stopping etc...) */
|
||||
|
||||
ocf_eviction_t eviction_policy;
|
||||
/*!< Eviction policy selected */
|
||||
|
||||
|
20
inc/ocf_io.h
20
inc/ocf_io.h
@ -83,16 +83,6 @@ struct ocf_io {
|
||||
*/
|
||||
ocf_start_io_t start;
|
||||
|
||||
/**
|
||||
* @brief OCF IO handle function
|
||||
*/
|
||||
ocf_handle_io_t handle;
|
||||
|
||||
/**
|
||||
* @brief OCF IO completion function
|
||||
*/
|
||||
ocf_end_io_t end;
|
||||
|
||||
/**
|
||||
* @brief OCF IO private 1
|
||||
*/
|
||||
@ -102,6 +92,16 @@ struct ocf_io {
|
||||
* @brief OCF IO private 2
|
||||
*/
|
||||
void *priv2;
|
||||
|
||||
/**
|
||||
* @brief OCF IO handle function
|
||||
*/
|
||||
ocf_handle_io_t handle;
|
||||
|
||||
/**
|
||||
* @brief OCF IO completion function
|
||||
*/
|
||||
ocf_end_io_t end;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -851,25 +851,25 @@ struct ocf_mngt_io_class_config {
|
||||
*/
|
||||
uint32_t class_id;
|
||||
|
||||
/**
|
||||
* @brief IO class maximum size
|
||||
*/
|
||||
uint32_t max_size;
|
||||
|
||||
/**
|
||||
* @brief IO class name
|
||||
*/
|
||||
const char *name;
|
||||
|
||||
/**
|
||||
* @brief IO class eviction priority
|
||||
*/
|
||||
int16_t prio;
|
||||
|
||||
/**
|
||||
* @brief IO class cache mode
|
||||
*/
|
||||
ocf_cache_mode_t cache_mode;
|
||||
|
||||
/**
|
||||
* @brief IO class maximum size
|
||||
* @brief IO class eviction priority
|
||||
*/
|
||||
uint32_t max_size;
|
||||
int16_t prio;
|
||||
};
|
||||
|
||||
struct ocf_mngt_io_classes_config {
|
||||
|
@ -101,6 +101,15 @@ struct ocf_volume_ops {
|
||||
*/
|
||||
void (*close)(ocf_volume_t volume);
|
||||
|
||||
/**
|
||||
* @brief Get volume length
|
||||
*
|
||||
* @param[in] volume Volume
|
||||
*
|
||||
* @return Volume length in bytes
|
||||
*/
|
||||
uint64_t (*get_length)(ocf_volume_t volume);
|
||||
|
||||
/**
|
||||
* @brief Get maximum io size
|
||||
*
|
||||
@ -109,15 +118,6 @@ struct ocf_volume_ops {
|
||||
* @return Maximum io size in bytes
|
||||
*/
|
||||
unsigned int (*get_max_io_size)(ocf_volume_t volume);
|
||||
|
||||
/**
|
||||
* @brief Get volume length
|
||||
*
|
||||
* @param[in] volume Volume
|
||||
*
|
||||
* @return Volume lenght in bytes
|
||||
*/
|
||||
uint64_t (*get_length)(ocf_volume_t volume);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -136,14 +136,14 @@ struct ocf_volume_properties {
|
||||
struct ocf_volume_caps caps;
|
||||
/*!< Volume capabilities */
|
||||
|
||||
struct ocf_volume_ops ops;
|
||||
/*!< Volume operations */
|
||||
|
||||
struct ocf_io_ops io_ops;
|
||||
/*!< IO operations */
|
||||
|
||||
void (*deinit)(void);
|
||||
/*!< Deinitialize volume type */
|
||||
|
||||
struct ocf_volume_ops ops;
|
||||
/*!< Volume operations */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -37,8 +37,8 @@
|
||||
|
||||
struct __waiter {
|
||||
ocf_cache_line_t line;
|
||||
void *ctx;
|
||||
uint32_t ctx_id;
|
||||
void *ctx;
|
||||
ocf_req_async_lock_cb cb;
|
||||
struct list_head item;
|
||||
int rw;
|
||||
|
@ -199,8 +199,8 @@ struct ocf_metadata_load_properties {
|
||||
enum ocf_metadata_shutdown_status shutdown_status;
|
||||
uint8_t dirty_flushed;
|
||||
ocf_metadata_layout_t layout;
|
||||
ocf_cache_line_size_t line_size;
|
||||
ocf_cache_mode_t cache_mode;
|
||||
ocf_cache_line_size_t line_size;
|
||||
char *cache_name;
|
||||
};
|
||||
|
||||
|
@ -14,8 +14,6 @@ struct ocf_user_part_config {
|
||||
char name[OCF_IO_CLASS_NAME_MAX];
|
||||
uint32_t min_size;
|
||||
uint32_t max_size;
|
||||
int16_t priority;
|
||||
ocf_cache_mode_t cache_mode;
|
||||
struct {
|
||||
uint8_t valid : 1;
|
||||
uint8_t added : 1;
|
||||
@ -24,6 +22,8 @@ struct ocf_user_part_config {
|
||||
* and means that can evict from this partition
|
||||
*/
|
||||
} flags;
|
||||
int16_t priority;
|
||||
ocf_cache_mode_t cache_mode;
|
||||
};
|
||||
|
||||
struct ocf_user_part_runtime {
|
||||
@ -40,12 +40,12 @@ typedef bool ( *_lru_hash_locked_pfn)(struct ocf_request *req,
|
||||
in round robin order */
|
||||
struct ocf_lru_iter
|
||||
{
|
||||
/* per-partition cacheline iterator */
|
||||
ocf_cache_line_t curr_cline[OCF_NUM_EVICTION_LISTS];
|
||||
/* cache object */
|
||||
ocf_cache_t cache;
|
||||
/* target partition */
|
||||
struct ocf_user_part *part;
|
||||
/* per-partition cacheline iterator */
|
||||
ocf_cache_line_t curr_cline[OCF_NUM_EVICTION_LISTS];
|
||||
/* available (non-empty) eviction list bitmap rotated so that current
|
||||
@evp is on the most significant bit */
|
||||
unsigned long long next_avail_evp;
|
||||
|
@ -20,6 +20,10 @@ struct ocf_superblock_config {
|
||||
* shouldn't change!! */
|
||||
uint8_t clean_shutdown;
|
||||
uint8_t dirty_flushed;
|
||||
|
||||
/* Current core sequence number */
|
||||
ocf_core_id_t curr_core_seq_no;
|
||||
|
||||
uint32_t magic_number;
|
||||
|
||||
uint32_t metadata_version;
|
||||
@ -47,9 +51,6 @@ struct ocf_superblock_config {
|
||||
|
||||
ocf_eviction_t eviction_policy_type;
|
||||
|
||||
/* Current core sequence number */
|
||||
ocf_core_id_t curr_core_seq_no;
|
||||
|
||||
/*
|
||||
* Checksum for each metadata region.
|
||||
* This field has to be the last one!
|
||||
|
@ -39,8 +39,6 @@
|
||||
* @brief Helpful struct to start cache
|
||||
*/
|
||||
struct ocf_cache_mngt_init_params {
|
||||
bool metadata_volatile;
|
||||
|
||||
ocf_ctx_t ctx;
|
||||
/*!< OCF context */
|
||||
|
||||
@ -50,6 +48,8 @@ struct ocf_cache_mngt_init_params {
|
||||
uint8_t locked;
|
||||
/*!< Keep cache locked */
|
||||
|
||||
bool metadata_volatile;
|
||||
|
||||
/**
|
||||
* @brief initialization state (in case of error, it is used to know
|
||||
* which assets have to be deallocated in premature exit from function
|
||||
|
@ -86,6 +86,7 @@ struct ocf_cache {
|
||||
ocf_eviction_t eviction_policy_init;
|
||||
|
||||
uint32_t fallback_pt_error_threshold;
|
||||
ocf_queue_t mngt_queue;
|
||||
|
||||
struct ocf_metadata metadata;
|
||||
|
||||
@ -99,39 +100,32 @@ struct ocf_cache {
|
||||
struct ocf_refcnt metadata __attribute__((aligned(64)));
|
||||
} refcnt;
|
||||
|
||||
ocf_pipeline_t stop_pipeline;
|
||||
|
||||
struct ocf_core core[OCF_CORE_MAX];
|
||||
|
||||
ocf_pipeline_t stop_pipeline;
|
||||
|
||||
env_atomic fallback_pt_error_counter;
|
||||
|
||||
env_atomic pending_read_misses_list_blocked;
|
||||
env_atomic pending_read_misses_list_count;
|
||||
|
||||
env_atomic last_access_ms;
|
||||
|
||||
env_atomic pending_eviction_clines;
|
||||
|
||||
env_atomic flush_in_progress;
|
||||
env_mutex flush_mutex;
|
||||
|
||||
struct list_head io_queues;
|
||||
ocf_queue_t mngt_queue;
|
||||
struct ocf_metadata_updater metadata_updater;
|
||||
|
||||
struct ocf_cleaner cleaner;
|
||||
struct ocf_metadata_updater metadata_updater;
|
||||
|
||||
struct list_head io_queues;
|
||||
ocf_promotion_policy_t promotion_policy;
|
||||
|
||||
struct ocf_async_lock lock;
|
||||
|
||||
env_mutex flush_mutex;
|
||||
|
||||
struct {
|
||||
uint32_t max_queue_size;
|
||||
uint32_t queue_unblock_size;
|
||||
} backfill;
|
||||
|
||||
struct ocf_trace trace;
|
||||
|
||||
void *priv;
|
||||
|
||||
/*
|
||||
@ -145,6 +139,12 @@ struct ocf_cache {
|
||||
bool pt_unaligned_io;
|
||||
|
||||
bool use_submit_io_fast;
|
||||
|
||||
struct ocf_trace trace;
|
||||
|
||||
struct ocf_async_lock lock;
|
||||
// This should be on it's own cacheline ideally
|
||||
env_atomic last_access_ms;
|
||||
};
|
||||
|
||||
static inline ocf_core_t ocf_cache_get_core(ocf_cache_t cache,
|
||||
|
@ -17,22 +17,25 @@
|
||||
* @brief OCF main control structure
|
||||
*/
|
||||
struct ocf_ctx {
|
||||
const struct ocf_ctx_ops *ops;
|
||||
const struct ocf_ctx_config *cfg;
|
||||
struct ocf_logger logger;
|
||||
struct ocf_volume_type *volume_type[OCF_VOLUME_TYPE_MAX];
|
||||
env_atomic ref_count;
|
||||
|
||||
env_rmutex lock;
|
||||
struct ocf_logger logger;
|
||||
|
||||
const struct ocf_ctx_ops *ops;
|
||||
struct {
|
||||
struct env_mpool *req;
|
||||
struct env_mpool *mio;
|
||||
} resources;
|
||||
struct list_head caches;
|
||||
struct {
|
||||
struct list_head core_pool_head;
|
||||
int core_pool_count;
|
||||
} core_pool;
|
||||
|
||||
struct {
|
||||
struct env_mpool *req;
|
||||
struct env_mpool *mio;
|
||||
} resources;
|
||||
|
||||
const struct ocf_ctx_config *cfg;
|
||||
env_atomic ref_count;
|
||||
};
|
||||
|
||||
#define ocf_log_prefix(ctx, lvl, prefix, fmt, ...) \
|
||||
|
@ -11,12 +11,9 @@
|
||||
struct ocf_queue {
|
||||
ocf_cache_t cache;
|
||||
|
||||
env_atomic io_no;
|
||||
|
||||
env_atomic ref_count;
|
||||
void *priv;
|
||||
|
||||
struct list_head io_list;
|
||||
env_spinlock io_list_lock;
|
||||
|
||||
/* per-queue free running global metadata lock index */
|
||||
unsigned lock_idx;
|
||||
@ -24,19 +21,21 @@ struct ocf_queue {
|
||||
/* per-queue free running eviction list index */
|
||||
unsigned eviction_idx;
|
||||
|
||||
/* Tracing reference counter */
|
||||
env_atomic64 trace_ref_cntr;
|
||||
|
||||
/* Tracing stop request */
|
||||
env_atomic trace_stop;
|
||||
struct ocf_seq_cutoff *seq_cutoff;
|
||||
|
||||
struct list_head list;
|
||||
|
||||
const struct ocf_queue_ops *ops;
|
||||
|
||||
struct ocf_seq_cutoff *seq_cutoff;
|
||||
/* Tracing reference counter */
|
||||
env_atomic64 trace_ref_cntr;
|
||||
|
||||
void *priv;
|
||||
/* Tracing stop request */
|
||||
env_atomic trace_stop;
|
||||
env_atomic io_no;
|
||||
|
||||
env_atomic ref_count;
|
||||
env_spinlock io_list_lock;
|
||||
};
|
||||
|
||||
static inline void ocf_queue_kick(ocf_queue_t queue, bool allow_sync)
|
||||
|
@ -106,9 +106,6 @@ struct ocf_request {
|
||||
struct ocf_io_internal ioi;
|
||||
/*!< OCF IO associated with request */
|
||||
|
||||
const struct ocf_engine_callbacks *engine_cbs;
|
||||
/*!< Engine owning the request */
|
||||
|
||||
env_atomic ref_count;
|
||||
/*!< Reference usage count, once OCF request reaches zero it
|
||||
* will be de-initialed. Get/Put method are intended to modify
|
||||
@ -128,6 +125,9 @@ struct ocf_request {
|
||||
env_atomic master_remaining;
|
||||
/*!< Atomic counter for core device */
|
||||
|
||||
const struct ocf_engine_callbacks *engine_cbs;
|
||||
/*!< Engine owning the request */
|
||||
|
||||
ocf_cache_t cache;
|
||||
/*!< Handle to cache instance */
|
||||
|
||||
|
@ -23,15 +23,15 @@ struct ocf_volume_type {
|
||||
struct ocf_volume {
|
||||
ocf_volume_type_t type;
|
||||
struct ocf_volume_uuid uuid;
|
||||
struct {
|
||||
unsigned discard_zeroes:1;
|
||||
/* true if reading discarded pages returns 0 */
|
||||
} features;
|
||||
bool opened;
|
||||
bool uuid_copy;
|
||||
void *priv;
|
||||
ocf_cache_t cache;
|
||||
struct list_head core_pool_item;
|
||||
struct {
|
||||
unsigned discard_zeroes:1;
|
||||
/* true if reading discarded pages returns 0 */
|
||||
} features;
|
||||
struct ocf_refcnt refcnt __attribute__((aligned(64)));
|
||||
} __attribute__((aligned(64)));
|
||||
|
||||
|
@ -96,6 +96,7 @@ struct nhit_list_elem {
|
||||
};
|
||||
|
||||
struct nhit_hash {
|
||||
env_spinlock rb_pointer_lock;
|
||||
ocf_cache_line_t hash_entries;
|
||||
uint64_t rb_entries;
|
||||
|
||||
@ -104,7 +105,6 @@ struct nhit_hash {
|
||||
|
||||
struct nhit_list_elem *ring_buffer;
|
||||
uint64_t rb_pointer;
|
||||
env_spinlock rb_pointer_lock;
|
||||
};
|
||||
|
||||
static uint64_t calculate_hash_buckets(uint64_t hash_size)
|
||||
|
@ -41,13 +41,13 @@ typedef int (*ocf_mlst_cmp)(struct ocf_cache *cache,
|
||||
struct ocf_lst {
|
||||
struct ocf_lst_entry *head;
|
||||
ocf_cache_line_t invalid;
|
||||
ocf_mlst_getter getter;
|
||||
ocf_mlst_cmp cmp;
|
||||
struct ocf_cache *cache;
|
||||
|
||||
struct {
|
||||
uint32_t active : 1;
|
||||
} flags;
|
||||
|
||||
ocf_mlst_getter getter;
|
||||
ocf_mlst_cmp cmp;
|
||||
struct ocf_cache *cache;
|
||||
};
|
||||
|
||||
static inline void ocf_lst_init_entry(struct ocf_lst *lst,
|
||||
|
Loading…
Reference in New Issue
Block a user