Skip to content

Commit

Permalink
rbd: add docs for new format of rbd export.
Browse files Browse the repository at this point in the history
Signed-off-by: Dongsheng Yang <[email protected]>
  • Loading branch information
yangdongsheng committed Feb 19, 2017
1 parent 8d2a613 commit aa913ce
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 0 deletions.
77 changes: 77 additions & 0 deletions doc/dev/rbd-diff.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,83 @@ Zero data
- le64: length


Final Record
~~~~~~~~~~~~

End
---

- u8: 'e'


Header
~~~~~~

"rbd diff v2\\n"

Metadata records
~~~~~~~~~~~~~~~~

Every record has a one byte "tag" that identifies the record type,
followed by length of data, and then some other data.

Metadata records come in the first part of the image. Order is not
important, as long as all the metadata records come before the data
records.

In v2, we have the following metadata in each section:
(1 Bytes) tag.
(8 Bytes) length.
(n Bytes) data.

In this way, we can skip the unrecognized tag.

From snap
---------

- u8: 'f'
- le64: length of appending data (4 + length)
- le32: snap name length
- snap name

To snap
-------

- u8: 't'
- le64: length of appending data (4 + length)
- le32: snap name length
- snap name

Size
----

- u8: 's'
- le64: length of appending data (8)
- le64: (ending) image size

Data Records
~~~~~~~~~~~~

These records come in the second part of the sequence.

Updated data
------------

- u8: 'w'
- le64: length of appending data (8 + 8 + length)
- le64: offset
- le64: length
- length bytes of actual data

Zero data
---------

- u8: 'z'
- le64: length of appending data (8 + 8)
- le64: offset
- le64: length


Final Record
~~~~~~~~~~~~

Expand Down
84 changes: 84 additions & 0 deletions doc/dev/rbd-export.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
RBD Export & Import
===================

This is a file format of an RBD image or snapshot. It's a sparse format
for the full image. There are three recording sections in the file.

(1) Header.
(2) Metadata.
(3) Diffs.

Header
~~~~~~

"rbd image v2\\n"

Metadata records
~~~~~~~~~~~~~~~~

Every record has a one byte "tag" that identifies the record type,
followed by length of data, and then some other data.

Metadata records come in the first part of the image. Order is not
important, as long as all the metadata records come before the data
records.

In v2, we have the following metadata in each section:
(1 Bytes) tag.
(8 Bytes) length.
(n Bytes) data.

In this way, we can skip the unrecognized tag.

Image order
-----------

- u8: 'O'
- le64: length of appending data (8)
- le64: image order

Image format
------------

- u8: 'F'
- le64: length of appending data (8)
- le64: image format

Image Features
--------------

- u8: 'T'
- le64: length of appending data (8)
- le64: image features

Image Stripe unit
-----------------

- u8: 'U'
- le64: length of appending data (8)
- le64: image striping unit

Image Stripe count
------------------

- u8: 'C'
- le64: length of appending data (8)
- le64: image striping count

Final Record
~~~~~~~~~~~~

End
---

- u8: 'E'


Diffs records
~~~~~~~~~~~~~~~~~
Record the all snapshots and the HEAD in this section.

- le64: number of diffs
- Diffs ...

Detail please refer to rbd-diff.rst

0 comments on commit aa913ce

Please sign in to comment.