Commit b98deb14 authored by Jonathan Jenkins's avatar Jonathan Jenkins

lsm api switch to use annotations

parent 5af2ef2b
...@@ -43,7 +43,10 @@ typedef enum lsm_event_e ...@@ -43,7 +43,10 @@ typedef enum lsm_event_e
*/ */
/* given LP sender, find the LSM device LP in the same group */ /* given LP sender, find the LSM device LP in the same group */
tw_lpid lsm_find_local_device(tw_lp *sender); tw_lpid lsm_find_local_device(
const char * annotation,
int ignore_annotations,
tw_lpid sender_gid);
/* /*
* lsm_event_new * lsm_event_new
...@@ -69,6 +72,21 @@ tw_event* lsm_event_new(const char* category, ...@@ -69,6 +72,21 @@ tw_event* lsm_event_new(const char* category,
size_t message_bytes, size_t message_bytes,
tw_lp *sender, tw_lp *sender,
tw_stime delay); tw_stime delay);
/* equivalent to lsm_event_new, except it allows to specify an annotation to
* filter by. If ignore_annotations is nonzero, A null annotation parameter
* indicates that the lsm LP to issue to has no annotation */
tw_event* lsm_event_new_annotated(
const char* category,
tw_lpid dest_gid,
uint64_t io_object,
int64_t io_offset,
uint64_t io_size_bytes,
int io_type,
size_t message_bytes,
tw_lp *sender,
tw_stime delay,
const char * annotation,
int ignore_annotations);
void lsm_event_new_reverse(tw_lp *sender); void lsm_event_new_reverse(tw_lp *sender);
......
...@@ -266,42 +266,26 @@ static tw_lpid lsm_find_local_device_default( ...@@ -266,42 +266,26 @@ static tw_lpid lsm_find_local_device_default(
return rtn; return rtn;
} }
/* tw_lpid lsm_find_local_device(
* lsm_find_local_device() const char * annotation,
* int ignore_annotations,
* returns the LP id of the lsm device connected to the caller tw_lpid sender_gid) {
* return lsm_find_local_device_default(annotation, ignore_annotations,
* TODO: currently ignores annotations sender_gid);
*/
tw_lpid lsm_find_local_device(tw_lp *sender)
{
return lsm_find_local_device_default(NULL, 1, sender->gid);
} }
/* static tw_event* lsm_event_new_base(
* lsm_event_new const char* category,
* - creates a new event that is targeted for the corresponding tw_lpid dest_gid,
* LSM LP. uint64_t io_object,
* - this event will allow wrapping the callers completion event int64_t io_offset,
* - category: string name to identify the traffic category uint64_t io_size_bytes,
* - dest_gid: the gid to send the callers event to int io_type,
* - gid_offset: relative offset of the LSM LP to the originating LP size_t message_bytes,
* - io_object: id of byte stream the caller will modify tw_lp *sender,
* - io_offset: offset into byte stream tw_stime delay,
* - io_size_bytes: size in bytes of IO request const char * annotation,
* - io_type: read or write request int ignore_annotations)
* - message_bytes: size of the event message the caller will have
* - sender: id of the sender
*/
tw_event* lsm_event_new(const char* category,
tw_lpid dest_gid,
uint64_t io_object,
int64_t io_offset,
uint64_t io_size_bytes,
int io_type,
size_t message_bytes,
tw_lp *sender,
tw_stime delay)
{ {
tw_event *e; tw_event *e;
lsm_message_t *m; lsm_message_t *m;
...@@ -314,7 +298,7 @@ tw_event* lsm_event_new(const char* category, ...@@ -314,7 +298,7 @@ tw_event* lsm_event_new(const char* category,
/* Generate an event for the local storage model, and send the /* Generate an event for the local storage model, and send the
* event to an lsm LP. * event to an lsm LP.
*/ */
lsm_gid = lsm_find_local_device(sender); lsm_gid = lsm_find_local_device(annotation, ignore_annotations, sender->gid);
delta = codes_local_latency(sender) + delay; delta = codes_local_latency(sender) + delay;
if (lsm_in_sequence) { if (lsm_in_sequence) {
...@@ -338,6 +322,51 @@ tw_event* lsm_event_new(const char* category, ...@@ -338,6 +322,51 @@ tw_event* lsm_event_new(const char* category,
return e; return e;
} }
/*
* lsm_event_new
* - creates a new event that is targeted for the corresponding
* LSM LP.
* - this event will allow wrapping the callers completion event
* - category: string name to identify the traffic category
* - dest_gid: the gid to send the callers event to
* - gid_offset: relative offset of the LSM LP to the originating LP
* - io_object: id of byte stream the caller will modify
* - io_offset: offset into byte stream
* - io_size_bytes: size in bytes of IO request
* - io_type: read or write request
* - message_bytes: size of the event message the caller will have
* - sender: id of the sender
*/
tw_event* lsm_event_new(
const char* category,
tw_lpid dest_gid,
uint64_t io_object,
int64_t io_offset,
uint64_t io_size_bytes,
int io_type,
size_t message_bytes,
tw_lp *sender,
tw_stime delay) {
return lsm_event_new_base(category, dest_gid, io_object, io_offset,
io_size_bytes, io_type, message_bytes, sender, delay, NULL, 1);
}
tw_event* lsm_event_new_annotated(
const char* category,
tw_lpid dest_gid,
uint64_t io_object,
int64_t io_offset,
uint64_t io_size_bytes,
int io_type,
size_t message_bytes,
tw_lp *sender,
tw_stime delay,
const char * annotation,
int ignore_annotations) {
return lsm_event_new_base(category, dest_gid, io_object, io_offset,
io_size_bytes, io_type, message_bytes, sender, delay, annotation,
ignore_annotations);
}
/* /*
* lsm_event_data * lsm_event_data
* - returns the pointer to the message data for the callers data * - returns the pointer to the message data for the callers data
......
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