Commit 98bd87dd authored by Jonathan Jenkins's avatar Jonathan Jenkins
Browse files

lsm: config, init scheduler (not hooked in)

parent 3bbbf2ec
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <codes/codes_mapping.h> #include <codes/codes_mapping.h>
#include <codes/lp-type-lookup.h> #include <codes/lp-type-lookup.h>
#include <codes/local-storage-model.h> #include <codes/local-storage-model.h>
#include <codes/quicklist.h>
#define CATEGORY_NAME_MAX 16 #define CATEGORY_NAME_MAX 16
#define CATEGORY_MAX 12 #define CATEGORY_MAX 12
...@@ -58,8 +59,46 @@ typedef struct disk_model_s ...@@ -58,8 +59,46 @@ typedef struct disk_model_s
double *write_seeks; double *write_seeks;
double *read_seeks; double *read_seeks;
unsigned int bins; unsigned int bins;
// sched params
// 0 - no scheduling
// >0 - make scheduler with use_sched priority lanes
int use_sched;
} disk_model_t; } disk_model_t;
/*
* lsm_message_data_t
* - data used for input in transfer time calculation
* - data comes for caller
* - object: id of byte stream which could be a file, object, etc.
* - offset: offset into byte stream
* - size: size in bytes of request
*/
typedef struct lsm_message_data_s
{
uint64_t object;
uint64_t offset;
uint64_t size;
char category[CATEGORY_NAME_MAX]; /* category for traffic */
} lsm_message_data_t;
/*
* lsm_sched_op_s - operation to be scheduled
*/
typedef struct lsm_sched_op_s
{
lsm_message_data_t data;
struct qlist_head ql;
} lsm_sched_op_t;
/*
* lsm_sched_s - data structure for implementing scheduling loop
*/
typedef struct lsm_sched_s
{
int num_prios;
struct qlist_head *queues;
} lsm_sched_t;
/* /*
* lsm_state_s * lsm_state_s
* - state tracking structure for each LP node * - state tracking structure for each LP node
...@@ -75,24 +114,11 @@ typedef struct lsm_state_s ...@@ -75,24 +114,11 @@ typedef struct lsm_state_s
int64_t current_offset; int64_t current_offset;
uint64_t current_object; uint64_t current_object;
lsm_stats_t lsm_stats_array[CATEGORY_MAX]; lsm_stats_t lsm_stats_array[CATEGORY_MAX];
/* scheduling state */
int use_sched;
lsm_sched_t sched;
} lsm_state_t; } lsm_state_t;
/*
* lsm_message_data_t
* - data used for input in transfer time calculation
* - data comes for caller
* - object: id of byte stream which could be a file, object, etc.
* - offset: offset into byte stream
* - size: size in bytes of request
*/
typedef struct lsm_message_data_s
{
uint64_t object;
uint64_t offset;
uint64_t size;
char category[CATEGORY_NAME_MAX]; /* category for traffic */
} lsm_message_data_t;
/* /*
* lsm_message_init_t * lsm_message_init_t
* - event data to initiale model * - event data to initiale model
...@@ -403,6 +429,16 @@ static void lsm_lp_init (lsm_state_t *ns, tw_lp *lp) ...@@ -403,6 +429,16 @@ static void lsm_lp_init (lsm_state_t *ns, tw_lp *lp)
ns->model = &models_anno[id]; ns->model = &models_anno[id];
} }
// initialize the scheduler if need be
ns->use_sched = ns->model->use_sched > 0;
if (ns->use_sched) {
ns->sched.num_prios = ns->model->use_sched;
ns->sched.queues =
malloc(ns->sched.num_prios * sizeof(*ns->sched.queues));
for (int i = 0; i < ns->sched.num_prios; i++)
INIT_QLIST_HEAD(&ns->sched.queues[i]);
}
return; return;
} }
...@@ -811,6 +847,11 @@ static void read_config(ConfigHandle *ch, char * anno, disk_model_t *model) ...@@ -811,6 +847,11 @@ static void read_config(ConfigHandle *ch, char * anno, disk_model_t *model)
model->read_seeks[i] = strtod(values[i], NULL); model->read_seeks[i] = strtod(values[i], NULL);
} }
free(values); free(values);
// scheduling parameters (this can fail)
configuration_get_value_int(ch, LSM_NAME, "enable_scheduler", anno,
&model->use_sched);
assert(model->use_sched >= 0);
} }
void lsm_configure(void) void lsm_configure(void)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment