Skip to content

Commit b78b18f

Browse files
committed
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
2 parents 19fbf67 + 3048102 commit b78b18f

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

Documentation/filesystems/erofs.rst

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ Here are the main features of EROFS:
5858

5959
- Support extended attributes as an option;
6060

61+
- Support a bloom filter that speeds up negative extended attribute lookups;
62+
6163
- Support POSIX.1e ACLs by using extended attributes;
6264

6365
- Support transparent data compression as an option:
64-
LZ4 and MicroLZMA algorithms can be used on a per-file basis; In addition,
65-
inplace decompression is also supported to avoid bounce compressed buffers
66-
and page cache thrashing.
66+
LZ4, MicroLZMA and DEFLATE algorithms can be used on a per-file basis; In
67+
addition, inplace decompression is also supported to avoid bounce compressed
68+
buffers and unnecessary page cache thrashing.
6769

6870
- Support chunk-based data deduplication and rolling-hash compressed data
6971
deduplication;
@@ -268,6 +270,38 @@ details.)
268270

269271
By the way, chunk-based files are all uncompressed for now.
270272

273+
Long extended attribute name prefixes
274+
-------------------------------------
275+
There are use cases where extended attributes with different values can have
276+
only a few common prefixes (such as overlayfs xattrs). The predefined prefixes
277+
work inefficiently in both image size and runtime performance in such cases.
278+
279+
The long xattr name prefixes feature is introduced to address this issue. The
280+
overall idea is that, apart from the existing predefined prefixes, the xattr
281+
entry could also refer to user-specified long xattr name prefixes, e.g.
282+
"trusted.overlay.".
283+
284+
When referring to a long xattr name prefix, the highest bit (bit 7) of
285+
erofs_xattr_entry.e_name_index is set, while the lower bits (bit 0-6) as a whole
286+
represent the index of the referred long name prefix among all long name
287+
prefixes. Therefore, only the trailing part of the name apart from the long
288+
xattr name prefix is stored in erofs_xattr_entry.e_name, which could be empty if
289+
the full xattr name matches exactly as its long xattr name prefix.
290+
291+
All long xattr prefixes are stored one by one in the packed inode as long as
292+
the packed inode is valid, or in the meta inode otherwise. The
293+
xattr_prefix_count (of the on-disk superblock) indicates the total number of
294+
long xattr name prefixes, while (xattr_prefix_start * 4) indicates the start
295+
offset of long name prefixes in the packed/meta inode. Note that, long extended
296+
attribute name prefixes are disabled if xattr_prefix_count is 0.
297+
298+
Each long name prefix is stored in the format: ALIGN({__le16 len, data}, 4),
299+
where len represents the total size of the data part. The data part is actually
300+
represented by 'struct erofs_xattr_long_prefix', where base_index represents the
301+
index of the predefined xattr name prefix, e.g. EROFS_XATTR_INDEX_TRUSTED for
302+
"trusted.overlay." long name prefix, while the infix string keeps the string
303+
after stripping the short prefix, e.g. "overlay." for the example above.
304+
271305
Data compression
272306
----------------
273307
EROFS implements fixed-sized output compression which generates fixed-sized

fs/erofs/decompressor_lzma.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,12 @@ int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq,
217217
strm->buf.out_size = min_t(u32, outlen,
218218
PAGE_SIZE - pageofs);
219219
outlen -= strm->buf.out_size;
220-
if (!rq->out[no] && rq->fillgaps) /* deduped */
220+
if (!rq->out[no] && rq->fillgaps) { /* deduped */
221221
rq->out[no] = erofs_allocpage(pagepool,
222222
GFP_KERNEL | __GFP_NOFAIL);
223+
set_page_private(rq->out[no],
224+
Z_EROFS_SHORTLIVED_PAGE);
225+
}
223226
if (rq->out[no])
224227
strm->buf.out = kmap(rq->out[no]) + pageofs;
225228
pageofs = 0;

fs/erofs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
235235
return PTR_ERR(ptr);
236236
dis = ptr + erofs_blkoff(sb, *pos);
237237

238-
if (!dif->path) {
238+
if (!sbi->devs->flatdev && !dif->path) {
239239
if (!dis->tag[0]) {
240240
erofs_err(sb, "empty device tag @ pos %llu", *pos);
241241
return -EINVAL;

0 commit comments

Comments
 (0)