[fxfs] Initial revision.

Squashed commit with the following:

(Attempt to) add an initial volume

mkfs adds a volume named "default", which mount will open up.

Adds a "root object ID" to object stores.

Volumes are managed in a directory which is the root object for the root
object store. Entries in the directory point to object stores which root
each volume; the root object ID for these volume object stores is the
root directory.

Added a test which unfortunately fails ATM (disabled_test_add_volume).
The volume doesn't appear after remounting the filesystem.

[fxfs] Fixed volume creation.

Object stores need to be registered with store manager so that we can
find them when replaying the log. When we're replaying the log we need a
way to lazily open stores.

Volume information is stored in a new reserved object (0) that exists
for all object stores. This volume information points at the root
directory for the volume.

[fxfs] Change everything to be async.

Figured it's probably better to switch to async sooner rather than
later.

Also took the opportunity to refactor Log a bit and separate out
LogReader.

[fxfs] Remove unwanted file.

[fxfs] Stand up server on mount

Serves /svc and the root directory handle out of the "default" volume.
Currently we're baking in an assumption that we just support a single
volume, but we should change that later and support multiple.

After this CL, the fs_test suite gets a bit further. It still crashes
and burns, though. :)

[fxfs] open root dir handle on mount

Adds support for DirectoryEntry::open() to FxDirectory.

[fxfs] Support file/dir creation

basic-test.cm in fs_test gets a bit further with this change.

[fxfs] fix runner syntax

[fxfs] Add FxFile

Supports read and write (although, read is suspect; see stubbed out test
case in file.rs).

[fxfs] Fix File::read

[fxfs] Log when we call unimplemented APIs

[fxfs] Fix lots of bugs

 1. Rewrite the allocator merger so that it uses reference counted
    extents rather than full back references. Full backreferences are
    hard to handle if/when we ever support cloning files because we
    would potentially have to split an unbounded number of extents, or
    we would need to make the layers support some kind of interval tree
    (which would be complicated).

 2. Change the API to the merger so that it is simpler and MergeResult
    is a bit more flexible.

 3. Reserve the first 100 object IDs for well-known objects. This
    will likely make debugging a little easier.

 4. Make the log file a child of the root parent store rather than
    the root store. This is necessary so that we can defer opening
    the root store until all log records are replayed.

 5. Refactor application of mutation records so that it is handled
    within the objects that they apply to rather than within log.rs.

 6. Add TreeSeal and TreeCompact so that we correctly capture what
    we need to in the log when compacting trees.

[fxfs] Convert println to syslog

[fxfs] First pass at File::append

This doesn't sort out atomicity yet; left a TODO for that.
lliv@jfsulliv:~/src/fuchsia$ head -n200 /tmp/log
it 21f3c9ac043b2dc7ca2053a0dcd2646aac8ad091
or: Chris Suter <csuter@google.com>
:   Fri Mar 12 19:05:55 2021 +1100

[fxfs] Initial revision.

Squashed commit with the following:

(Attempt to) add an initial volume

mkfs adds a volume named "default", which mount will open up.

Adds a "root object ID" to object stores.

Volumes are managed in a directory which is the root object for the root
object store. Entries in the directory point to object stores which root
each volume; the root object ID for these volume object stores is the
root directory.

Added a test which unfortunately fails ATM (disabled_test_add_volume).
The volume doesn't appear after remounting the filesystem.

[fxfs] Fixed volume creation.

Object stores need to be registered with store manager so that we can
find them when replaying the log. When we're replaying the log we need a
way to lazily open stores.

Volume information is stored in a new reserved object (0) that exists
for all object stores. This volume information points at the root
directory for the volume.

[fxfs] Change everything to be async.

Figured it's probably better to switch to async sooner rather than
later.

Also took the opportunity to refactor Log a bit and separate out
LogReader.

[fxfs] Remove unwanted file.

[fxfs] Stand up server on mount

Serves /svc and the root directory handle out of the "default" volume.
Currently we're baking in an assumption that we just support a single
volume, but we should change that later and support multiple.

After this CL, the fs_test suite gets a bit further. It still crashes
and burns, though. :)

[fxfs] open root dir handle on mount

Adds support for DirectoryEntry::open() to FxDirectory.

[fxfs] Support file/dir creation

basic-test.cm in fs_test gets a bit further with this change.

[fxfs] fix runner syntax

[fxfs] Add FxFile

Supports read and write (although, read is suspect; see stubbed out test
case in file.rs).

[fxfs] Fix File::read

[fxfs] Log when we call unimplemented APIs

[fxfs] Fix lots of bugs

 1. Rewrite the allocator merger so that it uses reference counted
    extents rather than full back references. Full backreferences are
    hard to handle if/when we ever support cloning files because we
    would potentially have to split an unbounded number of extents, or
    we would need to make the layers support some kind of interval tree
    (which would be complicated).

 2. Change the API to the merger so that it is simpler and MergeResult
    is a bit more flexible.

 3. Reserve the first 100 object IDs for well-known objects. This
    will likely make debugging a little easier.

 4. Make the log file a child of the root parent store rather than
    the root store. This is necessary so that we can defer opening
    the root store until all log records are replayed.

 5. Refactor application of mutation records so that it is handled
    within the objects that they apply to rather than within log.rs.

 6. Add TreeSeal and TreeCompact so that we correctly capture what
    we need to in the log when compacting trees.

[fxfs] Convert println to syslog

[fxfs] First pass at File::append

This doesn't sort out atomicity yet; left a TODO for that.

Also cleaned up the existing tests with some helpers.

[fxfs] Implement seek

This actually just required implementing get_size.

[fxfs] Rename log -> journal

[fxfs] Implement the extension case for truncate

The shrinking case isn't implemented yet.

[fxfs] Fix truncate bug

Truncate didn't work quite right with file holes due to a logic bug.

Fixed the test to actually spans blocks, which is much more interesting
(since it exercises the file-hole logic).

[fxfs] Implement truncate

Truncate (in the shrinking case) does the following transactionally:
- Inserts a deleted extent (represented as an ExtentValue with an
  absent device offset) into the tree,
- Overwrites the tail of the last extent with zeroes, and
- Sets the file's length.

During reads, we simply skip past deleted extents. The existing merge
implementation already handled deleted extents (although we do need to
eventually delete mutations at the base layer, which is a TODO).

Left a TODO in delete_old_extents to deal with deleted extent records; I
think we'll still need to do some work on them.

Also did a bit of refactoring on the write path.

[fxfs] Fix a bug in truncate

Truncate (or write) could hang because we weren't incrementing the
iterator when skipping past deleted extents.

[fxfs] Fixed merge issues

 + Fixed merge issues resulting from earlier commit.
 + Changed everything to use anyhow::Error.
 + Refactored some tests.

[fxfs] remove syslog lib dependency

Use the log crate instead of syslog (which only needs to be included in
main.rs for initialization).

This is pre-work to include the fxfs library in host code.

[fxfs] merge issues

[fxfs] Make a Filesystem trait

[fxfs] Use Buffer/Device abstractions

Change-Id: Iec86cb571021f585c50eed010e4ead6102104cd7
6 files changed
tree: 3b54c61e525cc2e50b4496bd4ebda35e35192f00
  1. .clang-format
  2. .clang-tidy
  3. .git-blame-ignore-revs
  4. .gitattributes
  5. .gitignore
  6. .gn
  7. .style.yapf
  8. AUTHORS
  9. BUILD.gn
  10. CODE_OF_CONDUCT.md
  11. CONTRIBUTING.md
  12. LICENSE
  13. OWNERS
  14. PATENTS
  15. README.md
  16. boards/
  17. build/
  18. buildtools/
  19. bundles/
  20. docs/
  21. examples/
  22. garnet/
  23. products/
  24. rustfmt.toml
  25. scripts/
  26. sdk/
  27. src/
  28. third_party/
  29. tools/
  30. zircon/
README.md

Fuchsia

Pink + Purple == Fuchsia (a new operating system)

What is Fuchsia?

Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.

Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.

Read more about Fuchsia's principles.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See fuchsia.dev.