Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Elsa Gonsiorowski
codes
Commits
98bd87dd
Commit
98bd87dd
authored
Jul 27, 2015
by
Jonathan Jenkins
Browse files
lsm: config, init scheduler (not hooked in)
parent
3bbbf2ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/util/local-storage-model.c
View file @
98bd87dd
...
...
@@ -12,6 +12,7 @@
#include <codes/codes_mapping.h>
#include <codes/lp-type-lookup.h>
#include <codes/local-storage-model.h>
#include <codes/quicklist.h>
#define CATEGORY_NAME_MAX 16
#define CATEGORY_MAX 12
...
...
@@ -58,8 +59,46 @@ typedef struct disk_model_s
double
*
write_seeks
;
double
*
read_seeks
;
unsigned
int
bins
;
// sched params
// 0 - no scheduling
// >0 - make scheduler with use_sched priority lanes
int
use_sched
;
}
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
* - state tracking structure for each LP node
...
...
@@ -75,24 +114,11 @@ typedef struct lsm_state_s
int64_t
current_offset
;
uint64_t
current_object
;
lsm_stats_t
lsm_stats_array
[
CATEGORY_MAX
];
/* scheduling state */
int
use_sched
;
lsm_sched_t
sched
;
}
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
* - event data to initiale model
...
...
@@ -403,6 +429,16 @@ static void lsm_lp_init (lsm_state_t *ns, tw_lp *lp)
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
;
}
...
...
@@ -811,6 +847,11 @@ static void read_config(ConfigHandle *ch, char * anno, disk_model_t *model)
model
->
read_seeks
[
i
]
=
strtod
(
values
[
i
],
NULL
);
}
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment