From fe37582752e4f874f03f303a0548db115e9542ee Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 8 May 2009 21:49:30 +0200 Subject: [PATCH] Allow writers that have no pre_select functions. Also, fix the pointer being printed in a debug message of the scheduler. --- sched.c | 4 ++-- write_common.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sched.c b/sched.c index 9e346df2..daf6603f 100644 --- 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); } } diff --git a/write_common.c b/write_common.c index dcf7bb16..b684661b 100644 --- a/write_common.c +++ b/write_common.c @@ -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; -- 2.39.5