block_session: SYNC and TRIM as async operations

This patch removes the blocking Block::Session::sync RPC function and
adds the asynchronous operations SYNC and TRIM to the block session's
packet-stream interface.

Even though the patch adjusts all block components to the interface
change, the components keep the former blocking handling of sync
internally for now because of the design of the 'Block::Driver'
interface. This old interface is not worth changing. We should instead
migrate the block servers step by step to the new
'Block::Request_stream' API.

Fixes #3274
This commit is contained in:
Norman Feske
2019-04-09 10:52:01 +02:00
committed by Christian Helmuth
parent e058adc4fe
commit 593e971121
10 changed files with 135 additions and 47 deletions

View File

@@ -34,6 +34,15 @@ class Backend
Block::Session::Info _info { _session.info() };
Genode::Lock _session_lock;
void _sync()
{
using Block::Session;
Session::Tag const tag { 0 };
_session.tx()->submit_packet(Session::sync_all_packet_descriptor(_info, tag));
_session.tx()->get_acked_packet();
}
public:
uint64_t block_count() const { return _info.block_count; }
@@ -43,7 +52,7 @@ class Backend
void sync()
{
Genode::Lock::Guard guard(_session_lock);
_session.sync();
_sync();
}
bool submit(int op, int64_t offset, size_t length, void *data)
@@ -83,7 +92,7 @@ class Backend
/* sync request */
if (op & RUMPUSER_BIO_SYNC) {
_session.sync();
_sync();
}
return succeeded;