Commit b78b18fb authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'erofs-for-6.6-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs

Pull erofs fixes from Gao Xiang:

 - Fix a memory leak issue when using LZMA global compressed
   deduplication

 - Fix empty device tags in flatdev mode

 - Update documentation for recent new features

* tag 'erofs-for-6.6-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
  erofs: update documentation
  erofs: allow empty device tags in flatdev mode
  erofs: fix memory leak of LZMA global compressed deduplication
parents 19fbf677 3048102d
...@@ -58,12 +58,14 @@ Here are the main features of EROFS: ...@@ -58,12 +58,14 @@ Here are the main features of EROFS:
- Support extended attributes as an option; - Support extended attributes as an option;
- Support a bloom filter that speeds up negative extended attribute lookups;
- Support POSIX.1e ACLs by using extended attributes; - Support POSIX.1e ACLs by using extended attributes;
- Support transparent data compression as an option: - Support transparent data compression as an option:
LZ4 and MicroLZMA algorithms can be used on a per-file basis; In addition, LZ4, MicroLZMA and DEFLATE algorithms can be used on a per-file basis; In
inplace decompression is also supported to avoid bounce compressed buffers addition, inplace decompression is also supported to avoid bounce compressed
and page cache thrashing. buffers and unnecessary page cache thrashing.
- Support chunk-based data deduplication and rolling-hash compressed data - Support chunk-based data deduplication and rolling-hash compressed data
deduplication; deduplication;
...@@ -268,6 +270,38 @@ details.) ...@@ -268,6 +270,38 @@ details.)
By the way, chunk-based files are all uncompressed for now. By the way, chunk-based files are all uncompressed for now.
Long extended attribute name prefixes
-------------------------------------
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.
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.".
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.
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.
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 'struct erofs_xattr_long_prefix', 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.
Data compression Data compression
---------------- ----------------
EROFS implements fixed-sized output compression which generates fixed-sized EROFS implements fixed-sized output compression which generates fixed-sized
......
...@@ -217,9 +217,12 @@ int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq, ...@@ -217,9 +217,12 @@ int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq,
strm->buf.out_size = min_t(u32, outlen, strm->buf.out_size = min_t(u32, outlen,
PAGE_SIZE - pageofs); PAGE_SIZE - pageofs);
outlen -= strm->buf.out_size; outlen -= strm->buf.out_size;
if (!rq->out[no] && rq->fillgaps) /* deduped */ if (!rq->out[no] && rq->fillgaps) { /* deduped */
rq->out[no] = erofs_allocpage(pagepool, rq->out[no] = erofs_allocpage(pagepool,
GFP_KERNEL | __GFP_NOFAIL); GFP_KERNEL | __GFP_NOFAIL);
set_page_private(rq->out[no],
Z_EROFS_SHORTLIVED_PAGE);
}
if (rq->out[no]) if (rq->out[no])
strm->buf.out = kmap(rq->out[no]) + pageofs; strm->buf.out = kmap(rq->out[no]) + pageofs;
pageofs = 0; pageofs = 0;
......
...@@ -235,7 +235,7 @@ static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb, ...@@ -235,7 +235,7 @@ static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
return PTR_ERR(ptr); return PTR_ERR(ptr);
dis = ptr + erofs_blkoff(sb, *pos); dis = ptr + erofs_blkoff(sb, *pos);
if (!dif->path) { if (!sbi->devs->flatdev && !dif->path) {
if (!dis->tag[0]) { if (!dis->tag[0]) {
erofs_err(sb, "empty device tag @ pos %llu", *pos); erofs_err(sb, "empty device tag @ pos %llu", *pos);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment