__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<!DOCTYPE html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>EROFS - Enhanced Read-Only File System — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=3918102e" />
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="The Second Extended Filesystem" href="ext2.html" />
<link rel="prev" title="efivarfs - a (U)EFI variable filesystem" href="efivarfs.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#human-interfaces">Human interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#networking-interfaces">Networking interfaces</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../subsystem-apis.html#storage-interfaces">Storage interfaces</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="index.html">Filesystems in the Linux kernel</a></li>
<li class="toctree-l3"><a class="reference internal" href="../block/index.html">Block</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cdrom/index.html">CD-ROM</a></li>
<li class="toctree-l3"><a class="reference internal" href="../scsi/index.html">SCSI Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../target/index.html">TCM Virtual Device</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nvme/index.html">NVMe Subsystem</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/filesystems/erofs.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="erofs-enhanced-read-only-file-system">
<h1>EROFS - Enhanced Read-Only File System<a class="headerlink" href="#erofs-enhanced-read-only-file-system" title="Link to this heading">¶</a></h1>
<section id="overview">
<h2>Overview<a class="headerlink" href="#overview" title="Link to this heading">¶</a></h2>
<p>EROFS filesystem stands for Enhanced Read-Only File System. It aims to form a
generic read-only filesystem solution for various read-only use cases instead
of just focusing on storage space saving without considering any side effects
of runtime performance.</p>
<p>It is designed to meet the needs of flexibility, feature extendability and user
payload friendly, etc. Apart from those, it is still kept as a simple
random-access friendly high-performance filesystem to get rid of unneeded I/O
amplification and memory-resident overhead compared to similar approaches.</p>
<p>It is implemented to be a better choice for the following scenarios:</p>
<blockquote>
<div><ul class="simple">
<li><p>read-only storage media or</p></li>
<li><p>part of a fully trusted read-only solution, which means it needs to be
immutable and bit-for-bit identical to the official golden image for
their releases due to security or other considerations and</p></li>
<li><p>hope to minimize extra storage space with guaranteed end-to-end performance
by using compact layout, transparent file compression and direct access,
especially for those embedded devices with limited memory and high-density
hosts with numerous containers.</p></li>
</ul>
</div></blockquote>
<p>Here are the main features of EROFS:</p>
<blockquote>
<div><ul>
<li><p>Little endian on-disk design;</p></li>
<li><p>Block-based distribution and file-based distribution over fscache are
supported;</p></li>
<li><p>Support multiple devices to refer to external blobs, which can be used
for container images;</p></li>
<li><p>32-bit block addresses for each device, therefore 16TiB address space at
most with 4KiB block size for now;</p></li>
<li><p>Two inode layouts for different requirements:</p>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"></th>
<th class="head"></th>
<th class="head"></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Inode metadata size</p></td>
<td><p>32 bytes</p></td>
<td><p>64 bytes</p></td>
</tr>
<tr class="row-odd"><td><p>Max file size</p></td>
<td><p>4 GiB</p></td>
<td><p>16 EiB (also limited by max. vol size)</p></td>
</tr>
<tr class="row-even"><td><p>Max uids/gids</p></td>
<td><p>65536</p></td>
<td><p>4294967296</p></td>
</tr>
<tr class="row-odd"><td><p>Per-inode timestamp</p></td>
<td><p>no</p></td>
<td><p>yes (64 + 32-bit timestamp)</p></td>
</tr>
<tr class="row-even"><td><p>Max hardlinks</p></td>
<td><p>65536</p></td>
<td><p>4294967296</p></td>
</tr>
<tr class="row-odd"><td><p>Metadata reserved</p></td>
<td><p>8 bytes</p></td>
<td><p>18 bytes</p></td>
</tr>
</tbody>
</table>
</li>
<li><p>Support extended attributes as an option;</p></li>
<li><p>Support a bloom filter that speeds up negative extended attribute lookups;</p></li>
<li><p>Support POSIX.1e ACLs by using extended attributes;</p></li>
<li><p>Support transparent data compression as an option:
LZ4, MicroLZMA and DEFLATE algorithms can be used on a per-file basis; In
addition, inplace decompression is also supported to avoid bounce compressed
buffers and unnecessary page cache thrashing.</p></li>
<li><p>Support chunk-based data deduplication and rolling-hash compressed data
deduplication;</p></li>
<li><p>Support tailpacking inline compared to byte-addressed unaligned metadata
or smaller block size alternatives;</p></li>
<li><p>Support merging tail-end data into a special inode as fragments.</p></li>
<li><p>Support large folios to make use of THPs (Transparent Hugepages);</p></li>
<li><p>Support direct I/O on uncompressed files to avoid double caching for loop
devices;</p></li>
<li><p>Support FSDAX on uncompressed images for secure containers and ramdisks in
order to get rid of unnecessary page cache.</p></li>
<li><p>Support file-based on-demand loading with the Fscache infrastructure.</p></li>
</ul>
</div></blockquote>
<p>The following git tree provides the file system user-space tools under
development, such as a formatting tool (mkfs.erofs), an on-disk consistency &
compatibility checking tool (fsck.erofs), and a debugging tool (dump.erofs):</p>
<ul class="simple">
<li><p>git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git</p></li>
</ul>
<p>For more information, please also refer to the documentation site:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://erofs.docs.kernel.org">https://erofs.docs.kernel.org</a></p></li>
</ul>
<p>Bugs and patches are welcome, please kindly help us and send to the following
linux-erofs mailing list:</p>
<ul class="simple">
<li><p>linux-erofs mailing list <<a class="reference external" href="mailto:linux-erofs%40lists.ozlabs.org">linux-erofs<span>@</span>lists<span>.</span>ozlabs<span>.</span>org</a>></p></li>
</ul>
</section>
<section id="mount-options">
<h2>Mount options<a class="headerlink" href="#mount-options" title="Link to this heading">¶</a></h2>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>(no)user_xattr</p></td>
<td><p>Setup Extended User Attributes. Note: xattr is enabled
by default if CONFIG_EROFS_FS_XATTR is selected.</p></td>
</tr>
<tr class="row-even"><td><p>(no)acl</p></td>
<td><p>Setup POSIX Access Control List. Note: acl is enabled
by default if CONFIG_EROFS_FS_POSIX_ACL is selected.</p></td>
</tr>
<tr class="row-odd"><td><p>cache_strategy=%s</p></td>
<td><p>Select a strategy for cached decompression from now on:</p>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>disabled</p></td>
<td><p>In-place I/O decompression only;</p></td>
</tr>
<tr class="row-even"><td><p>readahead</p></td>
<td><p>Cache the last incomplete compressed physical
cluster for further reading. It still does
in-place I/O decompression for the rest
compressed physical clusters;</p></td>
</tr>
<tr class="row-odd"><td><p>readaround</p></td>
<td><p>Cache both ends of incomplete compressed
physical clusters for further reading.
It still does in-place I/O decompression
for the rest compressed physical clusters.</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="row-even"><td><p>dax={always,never}</p></td>
<td><p>Use direct access (no page cache). See
<a class="reference internal" href="dax.html"><span class="doc">Direct Access for files</span></a>.</p></td>
</tr>
<tr class="row-odd"><td><p>dax</p></td>
<td><p>A legacy option which is an alias for <code class="docutils literal notranslate"><span class="pre">dax=always</span></code>.</p></td>
</tr>
<tr class="row-even"><td><p>device=%s</p></td>
<td><p>Specify a path to an extra device to be used together.</p></td>
</tr>
<tr class="row-odd"><td><p>fsid=%s</p></td>
<td><p>Specify a filesystem image ID for Fscache back-end.</p></td>
</tr>
<tr class="row-even"><td><p>domain_id=%s</p></td>
<td><p>Specify a domain ID in fscache mode so that different images
with the same blobs under a given domain ID can share storage.</p></td>
</tr>
<tr class="row-odd"><td><p>fsoffset=%llu</p></td>
<td><p>Specify block-aligned filesystem offset for the primary device.</p></td>
</tr>
</tbody>
</table>
</section>
<section id="sysfs-entries">
<h2>Sysfs Entries<a class="headerlink" href="#sysfs-entries" title="Link to this heading">¶</a></h2>
<p>Information about mounted erofs file systems can be found in /sys/fs/erofs.
Each mounted filesystem will have a directory in /sys/fs/erofs based on its
device name (i.e., /sys/fs/erofs/sda).
(see also <a class="reference internal" href="../admin-guide/abi-testing-files.html#abi-file-testing-sysfs-fs-erofs"><span class="std std-ref">ABI file testing/sysfs-fs-erofs</span></a>)</p>
</section>
<section id="on-disk-details">
<h2>On-disk details<a class="headerlink" href="#on-disk-details" title="Link to this heading">¶</a></h2>
<section id="summary">
<h3>Summary<a class="headerlink" href="#summary" title="Link to this heading">¶</a></h3>
<p>Different from other read-only file systems, an EROFS volume is designed
to be as simple as possible:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> |-> aligned with the block size
____________________________________________________________
| |SB| | ... | Metadata | ... | Data | Metadata | ... | Data |
|_|__|_|_____|__________|_____|______|__________|_____|______|
0 +1K
</pre></div>
</div>
<p>All data areas should be aligned with the block size, but metadata areas
may not. All metadatas can be now observed in two different spaces (views):</p>
<blockquote>
<div><ol class="arabic">
<li><p>Inode metadata space</p>
<p>Each valid inode should be aligned with an inode slot, which is a fixed
value (32 bytes) and designed to be kept in line with compact inode size.</p>
<dl class="simple">
<dt>Each inode can be directly found with the following formula:</dt><dd><p>inode offset = meta_blkaddr * block_size + 32 * nid</p>
</dd>
</dl>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> |-> aligned with 8B
|-> followed closely
+ meta_blkaddr blocks |-> another slot
_____________________________________________________________________
| ... | inode | xattrs | extents | data inline | ... | inode ...
|________|_______|(optional)|(optional)|__(optional)_|_____|__________
|-> aligned with the inode slot size
. .
. .
. .
. .
. .
. .
.____________________________________________________|-> aligned with 4B
| xattr_ibody_header | shared xattrs | inline xattrs |
|____________________|_______________|_______________|
|-> 12 bytes <-|->x * 4 bytes<-| .
. . .
. . .
. . .
._______________________________.______________________.
| id | id | id | id | ... | id | ent | ... | ent| ... |
|____|____|____|____|______|____|_____|_____|____|_____|
|-> aligned with 4B
|-> aligned with 4B
</pre></div>
</div>
<p>Inode could be 32 or 64 bytes, which can be distinguished from a common
field which all inode versions have -- i_format:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> __________________ __________________
| i_format | | i_format |
|__________________| |__________________|
| ... | | ... |
| | | |
|__________________| 32 bytes | |
| |
|__________________| 64 bytes
</pre></div>
</div>
<p>Xattrs, extents, data inline are placed after the corresponding inode with
proper alignment, and they could be optional for different data mappings.
_currently_ total 5 data layouts are supported:</p>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>0</p></td>
<td><p>flat file data without data inline (no extent);</p></td>
</tr>
<tr class="row-even"><td><p>1</p></td>
<td><p>fixed-sized output data compression (with non-compacted indexes);</p></td>
</tr>
<tr class="row-odd"><td><p>2</p></td>
<td><p>flat file data with tail packing data inline (no extent);</p></td>
</tr>
<tr class="row-even"><td><p>3</p></td>
<td><p>fixed-sized output data compression (with compacted indexes, v5.3+);</p></td>
</tr>
<tr class="row-odd"><td><p>4</p></td>
<td><p>chunk-based file (v5.15+).</p></td>
</tr>
</tbody>
</table>
<p>The size of the optional xattrs is indicated by i_xattr_count in inode
header. Large xattrs or xattrs shared by many different files can be
stored in shared xattrs metadata rather than inlined right after inode.</p>
</li>
<li><p>Shared xattrs metadata space</p>
<p>Shared xattrs space is similar to the above inode space, started with
a specific block indicated by xattr_blkaddr, organized one by one with
proper align.</p>
<dl class="simple">
<dt>Each share xattr can also be directly found by the following formula:</dt><dd><p>xattr offset = xattr_blkaddr * block_size + 4 * xattr_id</p>
</dd>
</dl>
</li>
</ol>
</div></blockquote>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> |-> aligned by 4 bytes
+ xattr_blkaddr blocks |-> aligned with 4 bytes
_________________________________________________________________________
| ... | xattr_entry | xattr data | ... | xattr_entry | xattr data ...
|________|_____________|_____________|_____|______________|_______________
</pre></div>
</div>
</section>
<section id="directories">
<h3>Directories<a class="headerlink" href="#directories" title="Link to this heading">¶</a></h3>
<p>All directories are now organized in a compact on-disk format. Note that
each directory block is divided into index and name areas in order to support
random file lookup, and all directory entries are _strictly_ recorded in
alphabetical order in order to support improved prefix binary search
algorithm (could refer to the related source code).</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> ___________________________
/ |
/ ______________|________________
/ / | nameoff1 | nameoffN-1
____________.______________._______________v________________v__________
| dirent | dirent | ... | dirent | filename | filename | ... | filename |
|___.0___|____1___|_____|___N-1__|____0_____|____1_____|_____|___N-1____|
\ ^
\ | * could have
\ | trailing '\0'
\________________________| nameoff0
Directory block
</pre></div>
</div>
<p>Note that apart from the offset of the first filename, nameoff0 also indicates
the total number of directory entries in this block since it is no need to
introduce another on-disk field at all.</p>
</section>
<section id="chunk-based-files">
<h3>Chunk-based files<a class="headerlink" href="#chunk-based-files" title="Link to this heading">¶</a></h3>
<p>In order to support chunk-based data deduplication, a new inode data layout has
been supported since Linux v5.15: Files are split in equal-sized data chunks
with <code class="docutils literal notranslate"><span class="pre">extents</span></code> area of the inode metadata indicating how to get the chunk
data: these can be simply as a 4-byte block address array or in the 8-byte
chunk index form (see <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">erofs_inode_chunk_index</span></code> in erofs_fs.h for more
details.)</p>
<p>By the way, chunk-based files are all uncompressed for now.</p>
</section>
<section id="long-extended-attribute-name-prefixes">
<h3>Long extended attribute name prefixes<a class="headerlink" href="#long-extended-attribute-name-prefixes" title="Link to this heading">¶</a></h3>
<p>There are use cases where extended attributes with different values can have
only a few common prefixes (such as overlayfs xattrs). The predefined prefixes
work inefficiently in both image size and runtime performance in such cases.</p>
<p>The long xattr name prefixes feature is introduced to address this issue. The
overall idea is that, apart from the existing predefined prefixes, the xattr
entry could also refer to user-specified long xattr name prefixes, e.g.
“trusted.overlay.”.</p>
<p>When referring to a long xattr name prefix, the highest bit (bit 7) of
erofs_xattr_entry.e_name_index is set, while the lower bits (bit 0-6) as a whole
represent the index of the referred long name prefix among all long name
prefixes. Therefore, only the trailing part of the name apart from the long
xattr name prefix is stored in erofs_xattr_entry.e_name, which could be empty if
the full xattr name matches exactly as its long xattr name prefix.</p>
<p>All long xattr prefixes are stored one by one in the packed inode as long as
the packed inode is valid, or in the meta inode otherwise. The
xattr_prefix_count (of the on-disk superblock) indicates the total number of
long xattr name prefixes, while (xattr_prefix_start * 4) indicates the start
offset of long name prefixes in the packed/meta inode. Note that, long extended
attribute name prefixes are disabled if xattr_prefix_count is 0.</p>
<p>Each long name prefix is stored in the format: ALIGN({__le16 len, data}, 4),
where len represents the total size of the data part. The data part is actually
represented by ‘<code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">erofs_xattr_long_prefix</span></code>’, where base_index represents the
index of the predefined xattr name prefix, e.g. EROFS_XATTR_INDEX_TRUSTED for
“trusted.overlay.” long name prefix, while the infix string keeps the string
after stripping the short prefix, e.g. “overlay.” for the example above.</p>
</section>
<section id="data-compression">
<h3>Data compression<a class="headerlink" href="#data-compression" title="Link to this heading">¶</a></h3>
<p>EROFS implements fixed-sized output compression which generates fixed-sized
compressed data blocks from variable-sized input in contrast to other existing
fixed-sized input solutions. Relatively higher compression ratios can be gotten
by using fixed-sized output compression since nowadays popular data compression
algorithms are mostly LZ77-based and such fixed-sized output approach can be
benefited from the historical dictionary (aka. sliding window).</p>
<p>In details, original (uncompressed) data is turned into several variable-sized
extents and in the meanwhile, compressed into physical clusters (pclusters).
In order to record each variable-sized extent, logical clusters (lclusters) are
introduced as the basic unit of compress indexes to indicate whether a new
extent is generated within the range (HEAD) or not (NONHEAD). Lclusters are now
fixed in block size, as illustrated below:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> |<- variable-sized extent ->|<- VLE ->|
clusterofs clusterofs clusterofs
| | |
_________v_________________________________v_______________________v________
... | . | | . | | . ...
____|____._________|______________|________.___ _|______________|__.________
|-> lcluster <-|-> lcluster <-|-> lcluster <-|-> lcluster <-|
(HEAD) (NONHEAD) (HEAD) (NONHEAD) .
. CBLKCNT . .
. . .
. . .
_______._____________________________.______________._________________
... | | | | ...
_______|______________|______________|______________|_________________
|-> big pcluster <-|-> pcluster <-|
</pre></div>
</div>
<p>A physical cluster can be seen as a container of physical compressed blocks
which contains compressed data. Previously, only lcluster-sized (4KB) pclusters
were supported. After big pcluster feature is introduced (available since
Linux v5.13), pcluster can be a multiple of lcluster size.</p>
<p>For each HEAD lcluster, clusterofs is recorded to indicate where a new extent
starts and blkaddr is used to seek the compressed data. For each NONHEAD
lcluster, delta0 and delta1 are available instead of blkaddr to indicate the
distance to its HEAD lcluster and the next HEAD lcluster. A PLAIN lcluster is
also a HEAD lcluster except that its data is uncompressed. See the comments
around “<code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">z_erofs_vle_decompressed_index</span></code>” in erofs_fs.h for more details.</p>
<p>If big pcluster is enabled, pcluster size in lclusters needs to be recorded as
well. Let the delta0 of the first NONHEAD lcluster store the compressed block
count with a special flag as a new called CBLKCNT NONHEAD lcluster. It’s easy
to understand its delta0 is constantly 1, as illustrated below:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> __________________________________________________________
| HEAD | NONHEAD | NONHEAD | ... | NONHEAD | HEAD | HEAD |
|__:___|_(CBLKCNT)_|_________|_____|_________|__:___|____:_|
|<----- a big pcluster (with CBLKCNT) ------>|<-- -->|
a lcluster-sized pcluster (without CBLKCNT) ^
</pre></div>
</div>
<p>If another HEAD follows a HEAD lcluster, there is no room to record CBLKCNT,
but it’s easy to know the size of such pcluster is 1 lcluster as well.</p>
<p>Since Linux v6.1, each pcluster can be used for multiple variable-sized extents,
therefore it can be used for compressed data deduplication.</p>
</section>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../_sources/filesystems/erofs.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| caching | Folder | 0755 |
|
|
| ext4 | Folder | 0755 |
|
|
| fuse | Folder | 0755 |
|
|
| iomap | Folder | 0755 |
|
|
| nfs | Folder | 0755 |
|
|
| smb | Folder | 0755 |
|
|
| spufs | Folder | 0755 |
|
|
| xfs | Folder | 0755 |
|
|
| 9p.html | File | 24.15 KB | 0644 |
|
| adfs.html | File | 13.15 KB | 0644 |
|
| affs.html | File | 18.5 KB | 0644 |
|
| afs.html | File | 19.14 KB | 0644 |
|
| api-summary.html | File | 831.83 KB | 0644 |
|
| autofs-mount-control.html | File | 32.3 KB | 0644 |
|
| autofs.html | File | 38.96 KB | 0644 |
|
| automount-support.html | File | 12.79 KB | 0644 |
|
| befs.html | File | 14.41 KB | 0644 |
|
| bfs.html | File | 10.72 KB | 0644 |
|
| btrfs.html | File | 9.7 KB | 0644 |
|
| buffer.html | File | 48.88 KB | 0644 |
|
| ceph.html | File | 18.87 KB | 0644 |
|
| coda.html | File | 65.97 KB | 0644 |
|
| configfs.html | File | 36.14 KB | 0644 |
|
| cramfs.html | File | 14.95 KB | 0644 |
|
| dax.html | File | 25.37 KB | 0644 |
|
| debugfs.html | File | 21.71 KB | 0644 |
|
| devpts.html | File | 10.61 KB | 0644 |
|
| directory-locking.html | File | 23.11 KB | 0644 |
|
| dlmfs.html | File | 14.28 KB | 0644 |
|
| dnotify.html | File | 12.09 KB | 0644 |
|
| ecryptfs.html | File | 11.96 KB | 0644 |
|
| efivarfs.html | File | 10 KB | 0644 |
|
| erofs.html | File | 29.42 KB | 0644 |
|
| ext2.html | File | 32.92 KB | 0644 |
|
| ext3.html | File | 8.29 KB | 0644 |
|
| f2fs.html | File | 67.87 KB | 0644 |
|
| fiemap.html | File | 23.32 KB | 0644 |
|
| files.html | File | 16.52 KB | 0644 |
|
| fscrypt.html | File | 107.9 KB | 0644 |
|
| fsverity.html | File | 64.53 KB | 0644 |
|
| gfs2-glocks.html | File | 21.71 KB | 0644 |
|
| gfs2-uevents.html | File | 12.88 KB | 0644 |
|
| gfs2.html | File | 10.38 KB | 0644 |
|
| hfs.html | File | 12.31 KB | 0644 |
|
| hfsplus.html | File | 10.28 KB | 0644 |
|
| hpfs.html | File | 26.83 KB | 0644 |
|
| idmappings.html | File | 74.42 KB | 0644 |
|
| index.html | File | 68.19 KB | 0644 |
|
| inotify.html | File | 12.35 KB | 0644 |
|
| isofs.html | File | 12.17 KB | 0644 |
|
| journalling.html | File | 115.17 KB | 0644 |
|
| locking.html | File | 52.92 KB | 0644 |
|
| locks.html | File | 11.91 KB | 0644 |
|
| mount_api.html | File | 49.94 KB | 0644 |
|
| multigrain-ts.html | File | 15 KB | 0644 |
|
| netfs_library.html | File | 86.81 KB | 0644 |
|
| nilfs2.html | File | 22.21 KB | 0644 |
|
| ntfs3.html | File | 13.64 KB | 0644 |
|
| ocfs2-online-filecheck.html | File | 13.13 KB | 0644 |
|
| ocfs2.html | File | 15.76 KB | 0644 |
|
| omfs.html | File | 13.12 KB | 0644 |
|
| orangefs.html | File | 35.89 KB | 0644 |
|
| overlayfs.html | File | 54.83 KB | 0644 |
|
| path-lookup.html | File | 123.09 KB | 0644 |
|
| porting.html | File | 94.09 KB | 0644 |
|
| proc.html | File | 140.32 KB | 0644 |
|
| qnx6.html | File | 16.36 KB | 0644 |
|
| quota.html | File | 12.12 KB | 0644 |
|
| ramfs-rootfs-initramfs.html | File | 27.94 KB | 0644 |
|
| relay.html | File | 40.38 KB | 0644 |
|
| resctrl.html | File | 93.99 KB | 0644 |
|
| romfs.html | File | 18.06 KB | 0644 |
|
| seq_file.html | File | 36.49 KB | 0644 |
|
| sharedsubtree.html | File | 46.25 KB | 0644 |
|
| splice.html | File | 79.36 KB | 0644 |
|
| squashfs.html | File | 24.34 KB | 0644 |
|
| sysfs.html | File | 29.32 KB | 0644 |
|
| tmpfs.html | File | 22.95 KB | 0644 |
|
| ubifs-authentication.html | File | 33.04 KB | 0644 |
|
| ubifs.html | File | 15.06 KB | 0644 |
|
| udf.html | File | 12.11 KB | 0644 |
|
| vfat.html | File | 26.07 KB | 0644 |
|
| vfs.html | File | 167.26 KB | 0644 |
|
| virtiofs.html | File | 12.16 KB | 0644 |
|
| zonefs.html | File | 35.71 KB | 0644 |
|