genode/repos/os/src/server/lx_block
Norman Feske bbe3ee8dc5 block_session: server-defined payload alignment
This patch replaces the formerly fixed 2 KiB data alignment within the
packet-stream buffer by a server-defined alignment. This has two
benefits.

First, when using block servers that provide small block sizes like 512
bytes, we avoid fragmenting the packet-stream buffer, which occurs when
aligning 512-byte requests at 2 KiB boundaries. This reduces meta data
costs for the packet-stream allocator and also allows fitting more
requests into the buffer.

Second, block drivers with alignment constraints dictated by the
hardware can now pass those constraints to the client, thereby easing
the use of zero-copy DMA directly into the packet stream.

The alignment is determined by the Block::Session_client at construction
time and applied by the Block::Session_client::alloc_packet method.
Block-session clients should always use this method, not the 'alloc_packet'
method of the packet stream (tx source) directly. The latter merely
applies a default alignment of 2 KiB.

At the server side, the alignment is automatically checked by
block/component.h (old API) and block/request_stream.h (new API).

Issue #3274
2019-05-03 13:53:12 +02:00
..
README lx_block: add file based Block driver for Linux 2017-11-30 11:23:04 +01:00
main.cc block_session: server-defined payload alignment 2019-05-03 13:53:12 +02:00
target.mk lx_block: add file based Block driver for Linux 2017-11-30 11:23:04 +01:00

README

This directory contains an Genode Block service that uses a file on
a Linux system as backing store.

Configuration
~~~~~~~~~~~~~

The backing store is specified by the 'file' attribute. The pretended
block size is specified by the 'block_size' attribute. In case it is
omitted, a default block size of 512 bytes is used. To allow write
access, the 'writeable' attribute must be set to 'yes'. By default only
read-only access it allowed.

An example configuration is shown in the the following config snippet:

!<config file="/foo/bar/block.img" block_size="512" writeable="yes"/>


Notes
~~~~~

The backing file is opened with blocking semantics and thereby the block
session is used synchronously.