Skip to content

Commit 0138af2

Browse files
committed
Merge tag 'erofs-for-7.0-rc6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs
Pull erofs fixes from Gao Xiang: - Mark I/Os as failed when encountering short reads on file-backed mounts - Label GFP_NOIO in the BIO completion when the completion is in the process context, and directly call into the decompression to avoid deadlocks - Improve Kconfig descriptions to better highlight the overall efforts - Fix .fadvise() for page cache sharing * tag 'erofs-for-7.0-rc6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs: erofs: fix .fadvise() for page cache sharing erofs: update the Kconfig description erofs: add GFP_NOIO in the bio completion if needed erofs: set fileio bio failed in short read case
2 parents aba9da0 + 2f0407e commit 0138af2

4 files changed

Lines changed: 48 additions & 21 deletions

File tree

fs/erofs/Kconfig

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,36 @@ config EROFS_FS
1616
select ZLIB_INFLATE if EROFS_FS_ZIP_DEFLATE
1717
select ZSTD_DECOMPRESS if EROFS_FS_ZIP_ZSTD
1818
help
19-
EROFS (Enhanced Read-Only File System) is a lightweight read-only
20-
file system with modern designs (e.g. no buffer heads, inline
21-
xattrs/data, chunk-based deduplication, multiple devices, etc.) for
22-
scenarios which need high-performance read-only solutions, e.g.
23-
smartphones with Android OS, LiveCDs and high-density hosts with
24-
numerous containers;
25-
26-
It also provides transparent compression and deduplication support to
27-
improve storage density and maintain relatively high compression
28-
ratios, and it implements in-place decompression to temporarily reuse
29-
page cache for compressed data using proper strategies, which is
30-
quite useful for ensuring guaranteed end-to-end runtime decompression
19+
EROFS (Enhanced Read-Only File System) is a modern, lightweight,
20+
secure read-only filesystem for various use cases, such as immutable
21+
system images, container images, application sandboxes, and datasets.
22+
23+
EROFS uses a flexible, hierarchical on-disk design so that features
24+
can be enabled on demand: the core on-disk format is block-aligned in
25+
order to perform optimally on all kinds of devices, including block
26+
and memory-backed devices; the format is easy to parse and has zero
27+
metadata redundancy, unlike generic filesystems, making it ideal for
28+
filesystem auditing and remote access; inline data, random-access
29+
friendly directory data, inline/shared extended attributes and
30+
chunk-based deduplication ensure space efficiency while maintaining
31+
high performance.
32+
33+
Optionally, it supports multiple devices to reference external data,
34+
enabling data sharing for container images.
35+
36+
It also has advanced encoded on-disk layouts, particularly for data
37+
compression and fine-grained deduplication. It utilizes fixed-size
38+
output compression to improve storage density while keeping relatively
39+
high compression ratios. Furthermore, it implements in-place
40+
decompression to reuse file pages to keep compressed data temporarily
41+
with proper strategies, which ensures guaranteed end-to-end runtime
3142
performance under extreme memory pressure without extra cost.
3243

33-
See the documentation at <file:Documentation/filesystems/erofs.rst>
34-
and the web pages at <https://erofs.docs.kernel.org> for more details.
44+
For more details, see the web pages at <https://erofs.docs.kernel.org>
45+
and the documentation at <file:Documentation/filesystems/erofs.rst>.
46+
47+
To compile EROFS filesystem support as a module, choose M here. The
48+
module will be called erofs.
3549

3650
If unsure, say N.
3751

@@ -105,7 +119,8 @@ config EROFS_FS_ZIP
105119
depends on EROFS_FS
106120
default y
107121
help
108-
Enable transparent compression support for EROFS file systems.
122+
Enable EROFS compression layouts so that filesystems containing
123+
compressed files can be parsed by the kernel.
109124

110125
If you don't want to enable compression feature, say N.
111126

fs/erofs/fileio.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret)
2525
container_of(iocb, struct erofs_fileio_rq, iocb);
2626
struct folio_iter fi;
2727

28-
if (ret >= 0 && ret != rq->bio.bi_iter.bi_size) {
29-
bio_advance(&rq->bio, ret);
30-
zero_fill_bio(&rq->bio);
31-
}
28+
if (ret >= 0 && ret != rq->bio.bi_iter.bi_size)
29+
ret = -EIO;
3230
if (!rq->bio.bi_end_io) {
3331
bio_for_each_folio_all(fi, &rq->bio) {
3432
DBG_BUGON(folio_test_uptodate(fi.folio));

fs/erofs/ishare.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,19 @@ struct inode *erofs_real_inode(struct inode *inode, bool *need_iput)
200200

201201
int __init erofs_init_ishare(void)
202202
{
203-
erofs_ishare_mnt = kern_mount(&erofs_anon_fs_type);
204-
return PTR_ERR_OR_ZERO(erofs_ishare_mnt);
203+
struct vfsmount *mnt;
204+
int ret;
205+
206+
mnt = kern_mount(&erofs_anon_fs_type);
207+
if (IS_ERR(mnt))
208+
return PTR_ERR(mnt);
209+
/* generic_fadvise() doesn't work if s_bdi == &noop_backing_dev_info */
210+
ret = super_setup_bdi(mnt->mnt_sb);
211+
if (ret)
212+
kern_unmount(mnt);
213+
else
214+
erofs_ishare_mnt = mnt;
215+
return ret;
205216
}
206217

207218
void erofs_exit_ishare(void)

fs/erofs/zdata.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,7 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
14451445
int bios)
14461446
{
14471447
struct erofs_sb_info *const sbi = EROFS_SB(io->sb);
1448+
int gfp_flag;
14481449

14491450
/* wake up the caller thread for sync decompression */
14501451
if (io->sync) {
@@ -1477,7 +1478,9 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
14771478
sbi->sync_decompress = EROFS_SYNC_DECOMPRESS_FORCE_ON;
14781479
return;
14791480
}
1481+
gfp_flag = memalloc_noio_save();
14801482
z_erofs_decompressqueue_work(&io->u.work);
1483+
memalloc_noio_restore(gfp_flag);
14811484
}
14821485

14831486
static void z_erofs_fill_bio_vec(struct bio_vec *bvec,

0 commit comments

Comments
 (0)