Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
codes
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
38
Issues
38
List
Boards
Labels
Milestones
Merge Requests
8
Merge Requests
8
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
codes
codes
Commits
a0021e16
Commit
a0021e16
authored
Jul 28, 2015
by
Jonathan Jenkins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add iface/impl for LSM req priorities
parent
75ba7b7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
1 deletion
+71
-1
codes/local-storage-model.h
codes/local-storage-model.h
+17
-0
src/util/local-storage-model.c
src/util/local-storage-model.c
+54
-1
No files found.
codes/local-storage-model.h
View file @
a0021e16
...
...
@@ -97,6 +97,23 @@ void lsm_event_new_reverse(tw_lp *sender);
*/
void
*
lsm_event_data
(
tw_event
*
event
);
/* get the priority count for the LSM scheduler.
* returns 0 if priorities aren't being used, -1 if no LSMs were configured,
* and >0 otherwise.
* This should not be called before lsm_configure */
int
lsm_get_num_priorities
(
char
const
*
annotation
,
int
ignore_annotations
);
/* set a request priority for the following lsm_event_*.
* - tw_error will be called if the priority ends up being out-of-bounds
* (won't able to tell until the lsm_event call b/c annotations)
* - not setting a priority (or setting a negative priority) is equivalent to
* setting the message to the lowest priority
*/
void
lsm_set_event_priority
(
int
prio
);
/* registers the storage model LP with CODES/ROSS */
void
lsm_register
(
void
);
...
...
src/util/local-storage-model.c
View file @
a0021e16
...
...
@@ -174,6 +174,9 @@ static int lsm_magic = 0;
static
disk_model_t
model_unanno
,
*
models_anno
=
NULL
;
static
const
config_anno_map_t
*
anno_map
=
NULL
;
/* sched temporary for lsm_set_event_priority */
static
int
temp_prio
=
-
1
;
/*
* lsm_lp
* - implements ROSS callback interfaces
...
...
@@ -336,7 +339,22 @@ static tw_event* lsm_event_new_base(
m
->
data
.
offset
=
io_offset
;
m
->
data
.
size
=
io_size_bytes
;
strcpy
(
m
->
data
.
category
,
category
);
m
->
data
.
prio
=
0
;
// TODO
// get the priority count for checking
int
num_prios
=
lsm_get_num_priorities
(
annotation
,
ignore_annotations
);
// prio checks and sets
if
(
num_prios
<=
0
)
// disabled scheduler - ignore
m
->
data
.
prio
=
0
;
else
if
(
temp_prio
<
0
)
// unprovided priority - defer to max possible
m
->
data
.
prio
=
num_prios
-
1
;
else
if
(
temp_prio
<
num_prios
)
// valid priority
m
->
data
.
prio
=
temp_prio
;
else
tw_error
(
TW_LOC
,
"LP %lu, LSM LP %lu: Bad priority (%d supplied, %d lanes)
\n
"
,
sender
->
gid
,
dest_gid
,
temp_prio
,
num_prios
);
// reset temp_prio
temp_prio
=
-
1
;
/* save callers dest_gid and message size */
m
->
wrap
.
id
=
dest_gid
;
...
...
@@ -407,6 +425,41 @@ void* lsm_event_data(tw_event *event)
return
m
->
wrap
.
message
;
}
int
lsm_get_num_priorities
(
char
const
*
annotation
,
int
ignore_annotations
)
{
if
(
ignore_annotations
)
{
/* find the first valid model
* (unannotated if listed first, annotated otherwise) */
if
(
anno_map
->
is_unanno_first
)
return
model_unanno
.
use_sched
;
else
if
(
anno_map
->
num_annos
)
return
models_anno
->
use_sched
;
else
return
-
1
;
}
else
if
(
annotation
==
NULL
)
{
if
(
anno_map
->
has_unanno_lp
)
return
model_unanno
.
use_sched
;
else
return
-
1
;
}
else
{
for
(
int
i
=
0
;
i
<
anno_map
->
num_annos
;
i
++
)
{
if
(
strcmp
(
anno_map
->
annotations
[
i
],
annotation
)
==
0
)
return
models_anno
[
i
].
use_sched
;
}
// bad annotation
return
-
1
;
}
}
void
lsm_set_event_priority
(
int
prio
)
{
temp_prio
=
prio
;
}
/*
* lsm_lp_init
* - initialize the lsm model
...
...
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