Skip to content

Commit 55664af

Browse files
author
David Scott
committed
Write about shared-block-rings
Signed-off-by: David Scott <[email protected]>
1 parent a942404 commit 55664af

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

xapi/futures/thin-lvhd/thin-lvhd.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ When a host calls SMAPI ```sr_attach```, it will attach three LVM volumes:
7676
- ```host-<uuid>-free```: these are free blocks cached on the host.
7777
- ```host-<uuid>-toLVM```: these are metadata changes made locally which need
7878
to be replayed against the LVM metadata by the SRmaster
79-
```host-<uuid>-fromLVM```: these are metadata changes made by the SRmaster
79+
- ```host-<uuid>-fromLVM```: these are metadata changes made by the SRmaster
8080
to extend the ```host-<uuid>-free``` which should be replayed against
8181
local device mapper.
8282

@@ -151,6 +151,35 @@ request will block for a long time if
151151
- the master has failed and HA is disabled. The admin should re-enable
152152
HA or fix the problem manually.
153153

154+
Shared-block-rings
155+
==================
156+
157+
The `toLVM` and `fromLVM` queues will be implemented as rings over the shared
158+
storage blocks, similar to the Xenstore and Console ring protocols over
159+
shared memory. The ring will have the following format:
160+
161+
Sector | Name | Description
162+
-------|----------|----------------------
163+
0 | magic | Well-known magic string to identify an intact ring
164+
1 | producer | Producer pointer (byte offset)
165+
2 | consumer | Consumer pointer (byte offset)
166+
3... | data | Arbitrary data
167+
168+
When data is to be written to the ring the updates are ordered:
169+
170+
1. the data is written to the data section
171+
2. the producer pointer is incremented to "expose" the data to the consumer
172+
173+
When data is to be read from the ring the updates are similarly ordered:
174+
175+
1. the data is read from the data section and processed
176+
2. when the side-effects are fully persisted, the consumer pointer is incremented
177+
178+
The ring implementation will expect the ring data size to be always larger than
179+
any individual write.
180+
181+
Example ring implementation: [shared-block-ring](https://github.com/mirage/shared-block-ring).
182+
154183
The local-allocator
155184
===================
156185

@@ -312,7 +341,7 @@ Modifications to LVHD SR
312341
to be flushed to the LVM metadata
313342
- `vdi_activate` should:
314343
- if necessary, run a plugin on the SRmaster to deflate the LV to the new
315-
minimum size (+ some slack),
344+
minimum size (+ some slack),
316345

317346
Note that it is possible to attach and detach the individual hosts in any order
318347
but when the SRmaster is unplugged then there will be no "refilling" of the host

0 commit comments

Comments
 (0)