7 Commits
Author SHA1 Message Date
Tiwei Bie 0da79ed4bf erofs: support block based dirent lookup
This patch adds the block based dirent lookup support to pkg/erofs,
which will do the dirent lookup by doing binary search on disk data
directly. This is helpful for searching files in large directories
and also reduces the memory overhead.

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
2023-11-28 12:59:35 +08:00
Tiwei Bie 3bcfd77929 erofs: cleanups and hardening
- Add more sanity checks on dirent name offset and length.
- Both of "super block" and "superblock" are used in comments and
  strings now, let's convert all "super block" to "superblock".
- Add some comments that can add clarity.
- Refactor the code in tests to make it easier to add more tests.

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
2023-11-28 10:32:58 +08:00
Tiwei Bie 56ce124756 erofs: eliminate unnecessary escapes and memory copies
Currently, when we access the on-disk filesystem objects, the objects
will be copied to temporary buffers and will escape to heap. This patch
gets rid of these unnecessary copies and escapes by casting and using
the memory backed by the image file directly.

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
2023-10-26 21:28:41 +08:00
gVisor bot f4b7b8f5e3 Merge pull request #9577 from btw616:erofs-checkpoint-restore-support
PiperOrigin-RevId: 576593626
2023-10-25 11:41:16 -07:00
Tiwei Bie 78a667cb8a erofs: add checkpoint/restore support
Updates #8956

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
2023-10-23 22:02:41 +08:00
Tiwei Bie 15e4366487 erofs: fix wrong assumption on the order of on-disk directory entries
For each directory, _all_ the on-disk directory entries are _strictly_
recorded in alphabetical order. There is no special treatment of "." and
"..". Thanks to @hsiangkao for pointing out this bug.

Fixes: eca83ac68c ("Add initial support for EROFS")
Reported-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
2023-10-07 21:15:16 +08:00
Tiwei Bie eca83ac68c Add initial support for EROFS
This patch adds initial support for EROFS [1]. Below is a brief
summary of the supported features.

Both inode formats are supported:

- compact format (32 bytes);
- extended format (64 bytes);

Below data layouts are supported:

- flat file data without data inline (no extent);
- flat file data with tail packing data inline (no extent);

Below file types are supported:

- directory;
- regular file;
- symlink;

Special files (e.g. fifo) can be listed, but cannot be accessed.

With this patch, sentry will be able to mount the EROFS image
created with below command and access the files on it.

 mkfs.erofs -E noinline_data <IMAGE FILE> <SOURCE DIRECTORY>

[1] https://docs.kernel.org/filesystems/erofs.html

Updates #8956

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
2023-10-04 18:15:30 +08:00