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
This commit is contained in:
Linus Torvalds
2026-03-25 18:41:35 -07:00
4 changed files with 47 additions and 20 deletions

View File

@@ -16,22 +16,36 @@ config EROFS_FS
select ZLIB_INFLATE if EROFS_FS_ZIP_DEFLATE
select ZSTD_DECOMPRESS if EROFS_FS_ZIP_ZSTD
help
EROFS (Enhanced Read-Only File System) is a lightweight read-only
file system with modern designs (e.g. no buffer heads, inline
xattrs/data, chunk-based deduplication, multiple devices, etc.) for
scenarios which need high-performance read-only solutions, e.g.
smartphones with Android OS, LiveCDs and high-density hosts with
numerous containers;
EROFS (Enhanced Read-Only File System) is a modern, lightweight,
secure read-only filesystem for various use cases, such as immutable
system images, container images, application sandboxes, and datasets.
It also provides transparent compression and deduplication support to
improve storage density and maintain relatively high compression
ratios, and it implements in-place decompression to temporarily reuse
page cache for compressed data using proper strategies, which is
quite useful for ensuring guaranteed end-to-end runtime decompression
EROFS uses a flexible, hierarchical on-disk design so that features
can be enabled on demand: the core on-disk format is block-aligned in
order to perform optimally on all kinds of devices, including block
and memory-backed devices; the format is easy to parse and has zero
metadata redundancy, unlike generic filesystems, making it ideal for
filesystem auditing and remote access; inline data, random-access
friendly directory data, inline/shared extended attributes and
chunk-based deduplication ensure space efficiency while maintaining
high performance.
Optionally, it supports multiple devices to reference external data,
enabling data sharing for container images.
It also has advanced encoded on-disk layouts, particularly for data
compression and fine-grained deduplication. It utilizes fixed-size
output compression to improve storage density while keeping relatively
high compression ratios. Furthermore, it implements in-place
decompression to reuse file pages to keep compressed data temporarily
with proper strategies, which ensures guaranteed end-to-end runtime
performance under extreme memory pressure without extra cost.
See the documentation at <file:Documentation/filesystems/erofs.rst>
and the web pages at <https://erofs.docs.kernel.org> for more details.
For more details, see the web pages at <https://erofs.docs.kernel.org>
and the documentation at <file:Documentation/filesystems/erofs.rst>.
To compile EROFS filesystem support as a module, choose M here. The
module will be called erofs.
If unsure, say N.
@@ -105,7 +119,8 @@ config EROFS_FS_ZIP
depends on EROFS_FS
default y
help
Enable transparent compression support for EROFS file systems.
Enable EROFS compression layouts so that filesystems containing
compressed files can be parsed by the kernel.
If you don't want to enable compression feature, say N.

View File

@@ -25,10 +25,8 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret)
container_of(iocb, struct erofs_fileio_rq, iocb);
struct folio_iter fi;
if (ret >= 0 && ret != rq->bio.bi_iter.bi_size) {
bio_advance(&rq->bio, ret);
zero_fill_bio(&rq->bio);
}
if (ret >= 0 && ret != rq->bio.bi_iter.bi_size)
ret = -EIO;
if (!rq->bio.bi_end_io) {
bio_for_each_folio_all(fi, &rq->bio) {
DBG_BUGON(folio_test_uptodate(fi.folio));

View File

@@ -200,8 +200,19 @@ struct inode *erofs_real_inode(struct inode *inode, bool *need_iput)
int __init erofs_init_ishare(void)
{
erofs_ishare_mnt = kern_mount(&erofs_anon_fs_type);
return PTR_ERR_OR_ZERO(erofs_ishare_mnt);
struct vfsmount *mnt;
int ret;
mnt = kern_mount(&erofs_anon_fs_type);
if (IS_ERR(mnt))
return PTR_ERR(mnt);
/* generic_fadvise() doesn't work if s_bdi == &noop_backing_dev_info */
ret = super_setup_bdi(mnt->mnt_sb);
if (ret)
kern_unmount(mnt);
else
erofs_ishare_mnt = mnt;
return ret;
}
void erofs_exit_ishare(void)

View File

@@ -1445,6 +1445,7 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
int bios)
{
struct erofs_sb_info *const sbi = EROFS_SB(io->sb);
int gfp_flag;
/* wake up the caller thread for sync decompression */
if (io->sync) {
@@ -1477,7 +1478,9 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
sbi->sync_decompress = EROFS_SYNC_DECOMPRESS_FORCE_ON;
return;
}
gfp_flag = memalloc_noio_save();
z_erofs_decompressqueue_work(&io->u.work);
memalloc_noio_restore(gfp_flag);
}
static void z_erofs_fill_bio_vec(struct bio_vec *bvec,