Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Xin Wang
codes-dev
Commits
e279a10e
Commit
e279a10e
authored
Jul 08, 2014
by
Jonathan Jenkins
Browse files
resource lp fixes (bitfield isn't reset after rollback)
parent
7d65c113
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/util/resource-lp.c
View file @
e279a10e
...
@@ -251,7 +251,8 @@ static void handle_resource_free_rc(
...
@@ -251,7 +251,8 @@ static void handle_resource_free_rc(
}
}
/* bitfield usage:
/* bitfield usage:
* c0 - dequeue+alloc success */
* c0 - queue was empty to begin with
* c1 - assuming !c0, alloc succeeded */
static
void
handle_resource_deq
(
static
void
handle_resource_deq
(
resource_state
*
ns
,
resource_state
*
ns
,
tw_bf
*
b
,
tw_bf
*
b
,
...
@@ -259,6 +260,7 @@ static void handle_resource_deq(
...
@@ -259,6 +260,7 @@ static void handle_resource_deq(
tw_lp
*
lp
){
tw_lp
*
lp
){
if
(
qlist_empty
(
&
ns
->
pending
[
m
->
i
.
tok
])){
if
(
qlist_empty
(
&
ns
->
pending
[
m
->
i
.
tok
])){
/* nothing to do */
/* nothing to do */
b
->
c0
=
1
;
return
;
return
;
}
}
...
@@ -267,7 +269,7 @@ static void handle_resource_deq(
...
@@ -267,7 +269,7 @@ static void handle_resource_deq(
int
ret
=
resource_get
(
p
->
m
.
req
,
p
->
m
.
tok
,
&
ns
->
r
);
int
ret
=
resource_get
(
p
->
m
.
req
,
p
->
m
.
tok
,
&
ns
->
r
);
assert
(
ret
!=
2
);
assert
(
ret
!=
2
);
if
(
!
ret
){
if
(
!
ret
){
b
->
c
0
=
1
;
b
->
c
1
=
1
;
/* success, dequeue (saving as rc) and send to client */
/* success, dequeue (saving as rc) and send to client */
qlist_del
(
front
);
qlist_del
(
front
);
m
->
i_rc
=
p
->
m
;
m
->
i_rc
=
p
->
m
;
...
@@ -291,12 +293,11 @@ static void handle_resource_deq_rc(
...
@@ -291,12 +293,11 @@ static void handle_resource_deq_rc(
tw_bf
*
b
,
tw_bf
*
b
,
resource_msg
*
m
,
resource_msg
*
m
,
tw_lp
*
lp
){
tw_lp
*
lp
){
if
(
qlist_empty
(
&
ns
->
pending
[
m
->
i
.
tok
])){
if
(
b
->
c0
){
/* nothing to do */
return
;
return
;
}
}
if
(
b
->
c
0
){
if
(
b
->
c
1
){
/* add operation back to the front of the queue */
/* add operation back to the front of the queue */
pending_op
*
op
=
malloc
(
sizeof
(
pending_op
));
pending_op
*
op
=
malloc
(
sizeof
(
pending_op
));
op
->
m
=
m
->
i_rc
;
op
->
m
=
m
->
i_rc
;
...
@@ -376,12 +377,21 @@ void resource_rev_handler(
...
@@ -376,12 +377,21 @@ void resource_rev_handler(
default:
default:
assert
(
0
);
assert
(
0
);
}
}
// NOTE: ross doesn't reset b in the case of multiple rollbacks...
*
(
int
*
)
b
=
0
;
}
}
void
resource_finalize
(
void
resource_finalize
(
resource_state
*
ns
,
resource_state
*
ns
,
tw_lp
*
lp
){
tw_lp
*
lp
){
/* Fill me in... */
/* Fill me in... */
struct
qlist_head
*
ent
;
qlist_for_each
(
ent
,
ns
->
pending
){
pending_op
*
op
=
qlist_entry
(
ent
,
pending_op
,
ql
);
fprintf
(
stderr
,
"WARNING: resource LP %lu has a pending allocation
\n
"
,
lp
->
gid
);
}
}
}
/**** END IMPLEMENTATIONS ****/
/**** END IMPLEMENTATIONS ****/
...
...
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