Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bake
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
bake
Commits
76558b82
Commit
76558b82
authored
May 08, 2016
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encode region size in id
parent
cf9857ad
Pipeline
#341
skipped
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
25 deletions
+25
-25
include/bake-bulk.h
include/bake-bulk.h
+3
-2
src/bake-bulk-rpc.c
src/bake-bulk-rpc.c
+19
-22
src/bake-bulk-rpc.h
src/bake-bulk-rpc.h
+3
-1
No files found.
include/bake-bulk.h
View file @
76558b82
...
...
@@ -20,9 +20,10 @@ typedef uint64_t bake_target_id_t;
/**
* Persistent, opaque identifier for a bulk region within a BAKE target.
*/
#define BAKE_BULK_REGION_ID_
SIZE 16
#define BAKE_BULK_REGION_ID_
DATA_SIZE 24
typedef
struct
{
char
data
[
BAKE_BULK_REGION_ID_SIZE
];
uint32_t
type
;
char
data
[
BAKE_BULK_REGION_ID_DATA_SIZE
];
}
bake_bulk_region_id_t
;
/**
...
...
src/bake-bulk-rpc.c
View file @
76558b82
...
...
@@ -14,6 +14,12 @@
*/
extern
PMEMobjpool
*
pmem_pool
;
/* definition of internal region_id_t identifier for libpmemobj back end */
typedef
struct
{
PMEMoid
oid
;
uint64_t
size
;
}
pmemobj_region_id_t
;
/* service a remote RPC that instructs the server daemon to shut down */
static
void
bake_bulk_shutdown_ult
(
hg_handle_t
handle
)
{
...
...
@@ -47,9 +53,11 @@ static void bake_bulk_create_ult(hg_handle_t handle)
{
bake_bulk_create_out_t
out
;
bake_bulk_create_in_t
in
;
PMEMoid
oid
;
hg_return_t
hret
;
pmemobj_region_id_t
*
prid
;
/* TODO: this check needs to be somewhere else */
assert
(
sizeof
(
pmemobj_region_id_t
)
<=
BAKE_BULK_REGION_ID_DATA_SIZE
);
printf
(
"Got RPC request to create bulk region.
\n
"
);
memset
(
&
out
,
0
,
sizeof
(
out
));
...
...
@@ -63,12 +71,9 @@ static void bake_bulk_create_ult(hg_handle_t handle)
return
;
}
out
.
ret
=
pmemobj_alloc
(
pmem_pool
,
&
oid
,
in
.
region_size
,
0
,
NULL
,
NULL
);
if
(
out
.
ret
==
0
)
{
/* TODO: real translation functions for opaque type */
memcpy
(
&
out
.
rid
,
&
oid
,
sizeof
(
oid
));
}
prid
=
(
pmemobj_region_id_t
*
)
out
.
rid
.
data
;
prid
->
size
=
in
.
region_size
;
out
.
ret
=
pmemobj_alloc
(
pmem_pool
,
&
prid
->
oid
,
in
.
region_size
,
0
,
NULL
,
NULL
);
HG_Free_input
(
handle
,
&
in
);
HG_Respond
(
handle
,
NULL
,
NULL
,
&
out
);
...
...
@@ -83,12 +88,12 @@ static void bake_bulk_write_ult(hg_handle_t handle)
bake_bulk_write_out_t
out
;
bake_bulk_write_in_t
in
;
hg_return_t
hret
;
PMEMoid
oid
;
char
*
buffer
;
hg_size_t
size
;
hg_bulk_t
bulk_handle
;
struct
hg_info
*
hgi
;
margo_instance_id
mid
;
pmemobj_region_id_t
*
prid
;
printf
(
"Got RPC request to write bulk region.
\n
"
);
...
...
@@ -107,11 +112,10 @@ static void bake_bulk_write_ult(hg_handle_t handle)
return
;
}
/* TODO: real translation functions for opaque type */
memcpy
(
&
oid
,
&
in
.
rid
,
sizeof
(
oid
));
prid
=
(
pmemobj_region_id_t
*
)
in
.
rid
.
data
;
/* find memory address for target object */
buffer
=
pmemobj_direct
(
oid
);
buffer
=
pmemobj_direct
(
prid
->
oid
);
if
(
!
buffer
)
{
out
.
ret
=
-
1
;
...
...
@@ -163,9 +167,8 @@ static void bake_bulk_persist_ult(hg_handle_t handle)
bake_bulk_persist_out_t
out
;
bake_bulk_persist_in_t
in
;
hg_return_t
hret
;
PMEMoid
oid
;
char
*
buffer
;
hg_size_t
size
;
pmemobj_region_id_t
*
prid
;
printf
(
"Got RPC request to persist bulk region.
\n
"
);
...
...
@@ -180,11 +183,10 @@ static void bake_bulk_persist_ult(hg_handle_t handle)
return
;
}
/* TODO: real translation functions for opaque type */
memcpy
(
&
oid
,
&
in
.
rid
,
sizeof
(
oid
));
prid
=
(
pmemobj_region_id_t
*
)
in
.
rid
.
data
;
/* find memory address for target object */
buffer
=
pmemobj_direct
(
oid
);
buffer
=
pmemobj_direct
(
prid
->
oid
);
if
(
!
buffer
)
{
out
.
ret
=
-
1
;
...
...
@@ -194,12 +196,7 @@ static void bake_bulk_persist_ult(hg_handle_t handle)
return
;
}
/* TODO: how to get the size of the object? */
/* TODO: let's put a header on each object with a magic number and a size
*/
size
=
1
;
pmemobj_persist
(
pmem_pool
,
buffer
,
size
);
pmemobj_persist
(
pmem_pool
,
buffer
,
prid
->
size
);
out
.
ret
=
0
;
...
...
src/bake-bulk-rpc.h
View file @
76558b82
...
...
@@ -52,10 +52,12 @@ DECLARE_MARGO_RPC_HANDLER(bake_bulk_persist_ult)
static
inline
hg_return_t
hg_proc_bake_bulk_region_id_t
(
hg_proc_t
proc
,
bake_bulk_region_id_t
*
rid
)
{
/* TODO: update later depending on final region_id_t type */
/* TODO: need separate encoders for different backend types */
int
i
;
hg_return_t
ret
;
for
(
i
=
0
;
i
<
BAKE_BULK_REGION_ID_SIZE
;
i
++
)
hg_proc_hg_uint32_t
(
proc
,
&
rid
->
type
);
for
(
i
=
0
;
i
<
BAKE_BULK_REGION_ID_DATA_SIZE
;
i
++
)
{
ret
=
hg_proc_hg_uint8_t
(
proc
,
(
uint8_t
*
)
&
rid
->
data
[
i
]);
if
(
ret
!=
HG_SUCCESS
)
...
...
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