Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bake
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
bake
Commits
b47bf5c9
Commit
b47bf5c9
authored
Oct 18, 2017
by
Rob Latham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
break out pmem pool setup into separate function
parent
1da145eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
22 deletions
+44
-22
bake-bulk-server.h
include/bake-bulk-server.h
+12
-0
bake-bulk-server-daemon.c
src/bake-bulk-server-daemon.c
+3
-22
bake-bulk-server.c
src/bake-bulk-server.c
+29
-0
No files found.
include/bake-bulk-server.h
View file @
b47bf5c9
...
...
@@ -28,4 +28,16 @@ void bake_server_register(
PMEMobjpool
*
bb_pmem_pool
,
struct
bake_bulk_root
*
bb_pmem_root
);
/**
* Convienence function to set up a PMEM backend.
*
* @param[in] poolname path to pmem backend file
* @param[inout] pmem_pool libpmem pool to use for the bake storage service
* @param[inout] bb_mem_root libpmem root for the bake pool
*
* returns 0 on sucess, -1 if anything goes wrong
*/
int
bake_server_makepool
(
char
*
poolname
,
PMEMobjpool
**
bb_pmem_pool
,
struct
bake_bulk_root
*
bb_pmem_root
);
#endif
/* __BAKE_BULK_SERVER_H */
src/bake-bulk-server-daemon.c
View file @
b47bf5c9
...
...
@@ -16,10 +16,8 @@ int main(int argc, char **argv)
{
int
ret
;
margo_instance_id
mid
;
char
target_string
[
64
];
PMEMoid
root_oid
;
PMEMobjpool
*
bb_pmem_pool
=
NULL
;
struct
bake_bulk_root
*
bb_pmem_root
=
NULL
;
struct
bake_bulk_root
bb_pmem_root
;
if
(
argc
!=
3
)
{
...
...
@@ -28,24 +26,7 @@ int main(int argc, char **argv)
return
(
-
1
);
}
/* open pmem pool */
bb_pmem_pool
=
pmemobj_open
(
argv
[
2
],
NULL
);
if
(
!
bb_pmem_pool
)
{
fprintf
(
stderr
,
"pmemobj_open: %s
\n
"
,
pmemobj_errormsg
());
return
(
-
1
);
}
/* find root */
root_oid
=
pmemobj_root
(
bb_pmem_pool
,
sizeof
(
*
bb_pmem_root
));
bb_pmem_root
=
pmemobj_direct
(
root_oid
);
if
(
uuid_is_null
(
bb_pmem_root
->
target_id
.
id
))
{
uuid_generate
(
bb_pmem_root
->
target_id
.
id
);
pmemobj_persist
(
bb_pmem_pool
,
bb_pmem_root
,
sizeof
(
*
bb_pmem_root
));
}
uuid_unparse
(
bb_pmem_root
->
target_id
.
id
,
target_string
);
fprintf
(
stderr
,
"BAKE target ID: %s
\n
"
,
target_string
);
ret
=
bake_server_makepool
(
argv
[
2
],
&
bb_pmem_pool
,
&
bb_pmem_root
);
/* start margo */
/* use the main xstream for driving progress and executing rpc handlers */
...
...
@@ -53,7 +34,7 @@ int main(int argc, char **argv)
assert
(
mid
);
/* register the bake bulk server */
bake_server_register
(
mid
,
bb_pmem_pool
,
bb_pmem_root
);
bake_server_register
(
mid
,
bb_pmem_pool
,
&
bb_pmem_root
);
/* NOTE: at this point this server ULT has two options. It can wait on
* whatever mechanism it wants to (however long the daemon should run and
...
...
src/bake-bulk-server.c
View file @
b47bf5c9
...
...
@@ -21,6 +21,35 @@ typedef struct {
static
PMEMobjpool
*
g_pmem_pool
=
NULL
;
static
struct
bake_bulk_root
*
g_pmem_root
=
NULL
;
int
bake_server_makepool
(
char
*
poolname
,
PMEMobjpool
**
bb_pmem_pool
,
struct
bake_bulk_root
*
bb_pmem_root
)
{
PMEMoid
root_oid
;
char
target_string
[
64
];
/* open pmem pool */
*
bb_pmem_pool
=
pmemobj_open
(
poolname
,
NULL
);
if
(
!
bb_pmem_pool
)
{
fprintf
(
stderr
,
"pmemobj_open: %s
\n
"
,
pmemobj_errormsg
());
return
(
-
1
);
}
/* find root */
root_oid
=
pmemobj_root
(
*
bb_pmem_pool
,
sizeof
(
*
bb_pmem_root
));
bb_pmem_root
=
pmemobj_direct
(
root_oid
);
if
(
uuid_is_null
(
bb_pmem_root
->
target_id
.
id
))
{
uuid_generate
(
bb_pmem_root
->
target_id
.
id
);
pmemobj_persist
(
*
bb_pmem_pool
,
bb_pmem_root
,
sizeof
(
*
bb_pmem_root
));
}
uuid_unparse
(
bb_pmem_root
->
target_id
.
id
,
target_string
);
fprintf
(
stderr
,
"BAKE target ID: %s
\n
"
,
target_string
);
return
0
;
}
void
bake_server_register
(
margo_instance_id
mid
,
PMEMobjpool
*
bb_pmem_pool
,
struct
bake_bulk_root
*
bb_pmem_root
)
...
...
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