On 10/20/2014 11:38 PM, Mike Christie wrote:
Hey,
I just wanted to say overall it looks ok. I am now going over the last
patch line by line to check for bugs and things like that.
Thanks. BTW I sent this to you privately before, but for the list here's
a follow-on patch (should be squashed if applying for real) that fixes
the list insertion logic.
Regards -- Andy
--
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.
commit 22e522a83600953b93e0d1ccb4a5ab61ab4af6fc
Author: Andy Grover <agro...@redhat.com>
Date: Thu Oct 9 15:15:19 2014 -0700
Fix pend_list insertion logic
The for_each only will insert if the new item is before an existing item.
If the new item is after all existing items (or there are none), add to
tail.
Signed-off-by: Andy Grover <agro...@redhat.com>
diff --git a/usr/actor.c b/usr/actor.c
index d859756..6f9fb57 100644
--- a/usr/actor.c
+++ b/usr/actor.c
@@ -80,30 +80,26 @@ actor_insert_on_pend_list(actor_t *thread, uint32_t delay_secs)
{
struct actor *orig_head;
struct actor *new_head;
+ struct actor *next_thread;
orig_head = list_first_entry_or_null(&pend_list,
struct actor, list);
- if (!orig_head) {
- list_add_tail(&thread->list, &pend_list);
- } else {
- struct actor *next_thread;
-
- /* insert new entry in sort order */
- list_for_each_entry(next_thread, &pend_list, list) {
- log_debug(7, "thread %p %lld",
- next_thread,
- (long long)next_thread->ttschedule);
-
- if (time_after(next_thread->ttschedule,
- thread->ttschedule)) {
- list_add(&thread->list,
- &next_thread->list);
- break;
- }
+ /* insert new entry in sort order */
+ list_for_each_entry(next_thread, &pend_list, list) {
+ log_debug(7, "thread %p %lld", next_thread,
+ (long long)next_thread->ttschedule);
+
+ if (time_after(next_thread->ttschedule, thread->ttschedule)) {
+ list_add(&thread->list, &next_thread->list);
+ goto inserted;
}
}
+ /* Not before any existing entries */
+ list_add_tail(&thread->list, &pend_list);
+
+inserted:
new_head = list_first_entry(&pend_list, struct actor, list);
if (orig_head != new_head) {
int result = alarm(delay_secs);