-
Notifications
You must be signed in to change notification settings - Fork 83
spec for writable layers #451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # Overlaybd layer blob format | ||
| # Overlaybd read-only layer blob format | ||
| ## Overview | ||
| Each layer blob consists of 4 sections, namely header, data, index and trailer, | ||
| as described below. | ||
|
|
@@ -53,8 +53,8 @@ index. | |
|
|
||
| ## index | ||
| The index section is a table that associates logical block addressing (LBA) with | ||
| raw data. Its format is simply a sorted array of record entries. Each entry is | ||
| a 128-bit struct defined as below: | ||
| raw data. Its format is simply a *sorted* array of *non-overlapping* record entries. | ||
| Each entry is a 128-bit struct defined as below: | ||
|
|
||
| | Field | Offset (bits) | Size (bits) | Type | Description | | ||
| | :---: | :----: | :----: | :----: | :--- | | ||
|
|
@@ -67,4 +67,46 @@ a 128-bit struct defined as below: | |
| ## trailer | ||
| An updated edition of header, in the same format. Trailer is useful in | ||
| append-only storage during creation of the blob. Use trailer whenever | ||
| possible. | ||
| possible. | ||
|
|
||
| # Overlaybd writable layer formats | ||
|
|
||
| There are 2 types of writable format defined in overlaybd -- append-only and sparse. | ||
|
|
||
| ## Append-only format | ||
|
|
||
| The append-only writable layer has 2 files, one is for appending data, | ||
| and the other is for appending index. Both of them is structured as | ||
| a header followed by raw data or index, as described below. | ||
|
|
||
| | Section | Size (bytes) | Description | | ||
| | :---: | :----: | :--- | | ||
| | header | 4096 | file header | | ||
| | payload | variable | raw data or index | | ||
|
|
||
| The `sealed` and `sparse_rw` flags are set to 0 (false) in both headers. | ||
|
|
||
| The index entries have the same format as defined in previous section, | ||
| except that they are not sorted and may have overlap. The field `moffset` | ||
| points to location in the coresspoding data file. | ||
|
|
||
| ## Sparse format | ||
|
|
||
| The sparse writable layer has only 1 sparse file, structured as | ||
| a header followed by raw data, as described below. | ||
|
|
||
| | Section | Size (bytes) | Description | | ||
| | :---: | :----: | :--- | | ||
| | header | 4096 | file header | | ||
| | raw data| virtual_size | sparse region; unwritten areas do not occupy disk space | | ||
|
|
||
| The `sparse_rw` flag is set to 1 (true) in the header. | ||
| The payload part of the file is initialized as a sparse region that | ||
| is as large as the `virtual_size` of the image, without occupying | ||
| disk space. Data will be written to coressponding locations with | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. coressponding -> corresponding |
||
| `pwrite` operations. The file must be placed on a file system that | ||
| supports sparseness and random write. The offsets have a simple equation: | ||
|
|
||
| ``` | ||
| I/O_offset = file_header_size + disk_LBA * sector_size | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coresspoding -> corresponding