libblock: Fix read-ahead trigger and next update

The previous version was sub-optimal for read-ahead transfer counts of
one.
This commit is contained in:
Sebastian Huber
2012-07-02 16:58:01 +02:00
parent c8a86d4d6f
commit 71092f7c94
2 changed files with 6 additions and 6 deletions

View File

@@ -3027,7 +3027,7 @@ rtems_bdbuf_read_ahead_task (rtems_task_argument arg)
if (transfer_count >= max_transfer_count)
{
transfer_count = max_transfer_count;
dd->read_ahead.trigger = block + (transfer_count + 1) / 2;
dd->read_ahead.trigger = block + transfer_count / 2;
dd->read_ahead.next = block + transfer_count;
}
else

View File

@@ -42,7 +42,7 @@ static const int action_sequence [READ_COUNT] = {
RESET_CACHE,
7, 8,
RESET_CACHE,
6, 7, 10
6, 7, 9
};
#define UNUSED_LINE { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
@@ -52,12 +52,12 @@ static const int expected_block_access_counts [READ_COUNT] [BLOCK_COUNT] = {
{ 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
{ 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
{ 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
{ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
{ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
{ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
{ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
UNUSED_LINE,
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
UNUSED_LINE,
@@ -78,7 +78,7 @@ static const int expected_block_access_counts [READ_COUNT] [BLOCK_COUNT] = {
#define TRIGGER_AFTER_RESET RTEMS_DISK_READ_AHEAD_NO_TRIGGER
static const rtems_blkdev_bnum trigger [READ_COUNT] = {
1, 3, 6, 6, 6, 9, 9, 9, NO_TRIGGER, NO_TRIGGER,
1, 3, 5, 5, 8, 8, 8, NO_TRIGGER, NO_TRIGGER, NO_TRIGGER,
TRIGGER_AFTER_RESET,
11,
TRIGGER_AFTER_RESET,
@@ -88,13 +88,13 @@ static const rtems_blkdev_bnum trigger [READ_COUNT] = {
TRIGGER_AFTER_RESET,
8, NO_TRIGGER,
TRIGGER_AFTER_RESET,
7, 10, NO_TRIGGER
7, 9, NO_TRIGGER
};
#define NOT_CHANGED_BY_RESET(i) (i)
static const rtems_blkdev_bnum next [READ_COUNT] = {
2, 4, 7, 7, 7, 10, 10, 10, 10, 10,
2, 4, 7, 7, 10, 10, 10, 10, 10, 10,
NOT_CHANGED_BY_RESET(10),
12,
NOT_CHANGED_BY_RESET(12),