From 103ae9df4a3898928fd61eb12e3bae8f0ab239e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Sun, 24 May 2020 15:14:15 +0200 Subject: [PATCH] block_tester: limit batching in sequential test So far the condition whether to spawn a new job or not depended on the amount of data already processed. This could lead to spawning more jobs than necessary if batching is used and in return could result in creating invalid requests in case the tested block session is not large enough. In addition to checking the amount of data the test now stores the number of the last block and checks if the current request is in range. This properly limits the total amount of requests. Issue #3781. --- repos/os/src/app/block_tester/test_sequential.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repos/os/src/app/block_tester/test_sequential.h b/repos/os/src/app/block_tester/test_sequential.h index f1032994ee..7607006fd5 100644 --- a/repos/os/src/app/block_tester/test_sequential.h +++ b/repos/os/src/app/block_tester/test_sequential.h @@ -29,6 +29,8 @@ struct Test::Sequential : Test_base size_t const _size = _node.attribute_value("size", Number_of_bytes()); size_t const _length = _node.attribute_value("length", Number_of_bytes()); + block_number_t _end = 0; + Block::Operation::Type const _op_type = _node.attribute_value("write", false) ? Block::Operation::Type::WRITE : Block::Operation::Type::READ; @@ -49,11 +51,12 @@ struct Test::Sequential : Test_base _size_in_blocks = _size / _info.block_size; _length_in_blocks = _length / _info.block_size; + _end = _start + _length_in_blocks; } void _spawn_job() override { - if (_bytes >= _length) + if (_bytes >= _length || _start >= _end) return; _job_cnt++;