Allow writers that have no pre_select functions.
authorAndre Noll <maan@systemlinux.org>
Fri, 8 May 2009 19:49:30 +0000 (21:49 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 8 May 2009 19:49:30 +0000 (21:49 +0200)
Also, fix the pointer being printed in a debug message of the scheduler.

sched.c
write_common.c

diff --git a/sched.c b/sched.c
index 9e346df..daf6603 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -50,7 +50,7 @@ static void sched_preselect(struct sched *s)
 {
        struct task *t, *tmp;
        list_for_each_entry_safe(t, tmp, &pre_select_list, pre_select_node) {
-               if (t->error >= 0)
+               if (t->error >= 0 && t->pre_select)
                        t->pre_select(s, t);
 //             PARA_INFO_LOG("%s \n", t->status);
                if (t->error >= 0)
@@ -157,7 +157,7 @@ void register_task(struct task *t)
                list_add_tail(&t->pre_select_node, &pre_select_list);
        }
        if (t->post_select) {
-               PARA_DEBUG_LOG("post_select: %p\n", &t->pre_select);
+               PARA_DEBUG_LOG("post_select: %p\n", &t->post_select);
                list_add_tail(&t->post_select_node, &post_select_list);
        }
 }
index dcf7bb1..b684661 100644 (file)
@@ -27,6 +27,8 @@ static void wng_pre_select(__a_unused struct sched *s, struct task *t)
 
        FOR_EACH_WRITER_NODE(i, g) {
                struct writer_node *wn = &g->writer_nodes[i];
+               if (!wn->writer->pre_select)
+                       continue;
                t->error = wn->writer->pre_select(s, wn);
                if (t->error < 0)
                        return;