summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-07-06 14:39:00 (UTC)
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-07-09 08:42:08 (UTC)
commit5b29a08d691c589b337a0446ca60263fe22d93db (patch)
tree7426c065a58a0e41cfae2e806441c95b0236a475
parent2cc4f3ca45e5cb20649c2733330977a2307e2e19 (diff)
downloadrtems-5b29a08d691c589b337a0446ca60263fe22d93db.tar.bz2
libblock: Fix read-ahead task wake-up
In case the read-ahead task is not configured we must not send a wake-up event. This would send the wake-up event to the executing task. We must send the wake-up event only in case the request list changes from empty to non-empty. Since otherwise we may send a false transfer event.
-rw-r--r--cpukit/libblock/src/bdbuf.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
index 5b66656..f5da0fc 100644
--- a/cpukit/libblock/src/bdbuf.c
+++ b/cpukit/libblock/src/bdbuf.c
@@ -2039,17 +2039,22 @@ static void
rtems_bdbuf_check_read_ahead_trigger (rtems_disk_device *dd,
rtems_blkdev_bnum block)
{
- if (dd->read_ahead.trigger == block
+ if (bdbuf_cache.read_ahead_task != 0
+ && dd->read_ahead.trigger == block
&& !rtems_bdbuf_is_read_ahead_active (dd))
{
rtems_status_code sc;
rtems_chain_control *chain = &bdbuf_cache.read_ahead_chain;
+ if (rtems_chain_is_empty (chain))
+ {
+ sc = rtems_event_send (bdbuf_cache.read_ahead_task,
+ RTEMS_BDBUF_READ_AHEAD_WAKE_UP);
+ if (sc != RTEMS_SUCCESSFUL)
+ rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_RA_WAKE_UP);
+ }
+
rtems_chain_append_unprotected (chain, &dd->read_ahead.node);
- sc = rtems_event_send (bdbuf_cache.read_ahead_task,
- RTEMS_BDBUF_READ_AHEAD_WAKE_UP);
- if (sc != RTEMS_SUCCESSFUL)
- rtems_fatal_error_occurred (RTEMS_BLKDEV_FATAL_BDBUF_RA_WAKE_UP);
}
}