2019-07-31 23:57:31 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2018-07-26 20:21:46 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017-2018 HUAWEI, Inc.
|
2020-07-13 21:09:44 +08:00
|
|
|
* https://www.huawei.com/
|
2022-01-02 16:13:17 +08:00
|
|
|
* Copyright (C) 2021, Alibaba Cloud
|
2018-07-26 20:21:46 +08:00
|
|
|
*/
|
|
|
|
#include <linux/statfs.h>
|
2018-07-26 20:21:52 +08:00
|
|
|
#include <linux/seq_file.h>
|
2019-11-04 10:49:37 +08:00
|
|
|
#include <linux/crc32c.h>
|
2020-05-29 18:48:36 +08:00
|
|
|
#include <linux/fs_context.h>
|
|
|
|
#include <linux/fs_parser.h>
|
2022-04-25 12:07:12 +08:00
|
|
|
#include <linux/exportfs.h>
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
#include <linux/backing-dev.h>
|
2019-01-14 19:40:25 +08:00
|
|
|
#include "xattr.h"
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2018-07-26 20:21:55 +08:00
|
|
|
#define CREATE_TRACE_POINTS
|
|
|
|
#include <trace/events/erofs.h>
|
|
|
|
|
2018-07-26 20:21:46 +08:00
|
|
|
static struct kmem_cache *erofs_inode_cachep __read_mostly;
|
|
|
|
|
2023-08-15 17:48:47 +08:00
|
|
|
void _erofs_err(struct super_block *sb, const char *func, const char *fmt, ...)
|
2019-09-04 10:09:09 +08:00
|
|
|
{
|
|
|
|
struct va_format vaf;
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
|
|
|
|
|
|
|
vaf.fmt = fmt;
|
|
|
|
vaf.va = &args;
|
|
|
|
|
2024-01-03 20:32:02 +08:00
|
|
|
if (sb)
|
|
|
|
pr_err("(device %s): %s: %pV", sb->s_id, func, &vaf);
|
|
|
|
else
|
|
|
|
pr_err("%s: %pV", func, &vaf);
|
2019-09-04 10:09:09 +08:00
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
|
2023-08-15 17:48:47 +08:00
|
|
|
void _erofs_info(struct super_block *sb, const char *func, const char *fmt, ...)
|
2019-09-04 10:09:09 +08:00
|
|
|
{
|
|
|
|
struct va_format vaf;
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
|
|
|
|
|
|
|
vaf.fmt = fmt;
|
|
|
|
vaf.va = &args;
|
|
|
|
|
2024-01-03 20:32:02 +08:00
|
|
|
if (sb)
|
|
|
|
pr_info("(device %s): %pV", sb->s_id, &vaf);
|
|
|
|
else
|
|
|
|
pr_info("%pV", &vaf);
|
2019-09-04 10:09:09 +08:00
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
|
2019-11-04 10:49:37 +08:00
|
|
|
static int erofs_superblock_csum_verify(struct super_block *sb, void *sbdata)
|
|
|
|
{
|
2023-03-13 21:53:08 +08:00
|
|
|
size_t len = 1 << EROFS_SB(sb)->blkszbits;
|
2019-11-04 10:49:37 +08:00
|
|
|
struct erofs_super_block *dsb;
|
|
|
|
u32 expected_crc, crc;
|
|
|
|
|
2023-03-13 21:53:08 +08:00
|
|
|
if (len > EROFS_SUPER_OFFSET)
|
|
|
|
len -= EROFS_SUPER_OFFSET;
|
|
|
|
|
|
|
|
dsb = kmemdup(sbdata + EROFS_SUPER_OFFSET, len, GFP_KERNEL);
|
2019-11-04 10:49:37 +08:00
|
|
|
if (!dsb)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
expected_crc = le32_to_cpu(dsb->checksum);
|
|
|
|
dsb->checksum = 0;
|
|
|
|
/* to allow for x86 boot sectors and other oddities. */
|
2023-03-13 21:53:08 +08:00
|
|
|
crc = crc32c(~0, dsb, len);
|
2019-11-04 10:49:37 +08:00
|
|
|
kfree(dsb);
|
|
|
|
|
|
|
|
if (crc != expected_crc) {
|
|
|
|
erofs_err(sb, "invalid checksum 0x%08x, 0x%08x expected",
|
|
|
|
crc, expected_crc);
|
|
|
|
return -EBADMSG;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-09-04 10:09:05 +08:00
|
|
|
static void erofs_inode_init_once(void *ptr)
|
2018-07-26 20:21:46 +08:00
|
|
|
{
|
2019-09-04 10:08:56 +08:00
|
|
|
struct erofs_inode *vi = ptr;
|
2018-07-26 20:21:46 +08:00
|
|
|
|
|
|
|
inode_init_once(&vi->vfs_inode);
|
|
|
|
}
|
|
|
|
|
2019-09-04 10:09:05 +08:00
|
|
|
static struct inode *erofs_alloc_inode(struct super_block *sb)
|
2018-07-26 20:21:46 +08:00
|
|
|
{
|
2019-09-04 10:08:56 +08:00
|
|
|
struct erofs_inode *vi =
|
2022-03-23 05:41:03 +08:00
|
|
|
alloc_inode_sb(sb, erofs_inode_cachep, GFP_KERNEL);
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2019-03-21 08:06:13 +08:00
|
|
|
if (!vi)
|
2018-07-26 20:21:46 +08:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* zero out everything except vfs_inode */
|
2019-09-04 10:08:56 +08:00
|
|
|
memset(vi, 0, offsetof(struct erofs_inode, vfs_inode));
|
2018-07-26 20:21:46 +08:00
|
|
|
return &vi->vfs_inode;
|
|
|
|
}
|
|
|
|
|
2019-09-04 10:09:05 +08:00
|
|
|
static void erofs_free_inode(struct inode *inode)
|
2018-07-26 20:21:46 +08:00
|
|
|
{
|
2019-09-04 10:08:56 +08:00
|
|
|
struct erofs_inode *vi = EROFS_I(inode);
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2019-09-04 10:08:59 +08:00
|
|
|
if (inode->i_op == &erofs_fast_symlink_iops)
|
2018-07-26 20:21:46 +08:00
|
|
|
kfree(inode->i_link);
|
|
|
|
kfree(vi->xattr_shared_xattrs);
|
|
|
|
kmem_cache_free(erofs_inode_cachep, vi);
|
|
|
|
}
|
|
|
|
|
2021-03-29 18:00:12 +08:00
|
|
|
/* read variable-sized metadata, offset will be aligned by 4-byte */
|
2023-04-07 22:17:08 +08:00
|
|
|
void *erofs_read_metadata(struct super_block *sb, struct erofs_buf *buf,
|
|
|
|
erofs_off_t *offset, int *lengthp)
|
2021-03-29 18:00:12 +08:00
|
|
|
{
|
|
|
|
u8 *buffer, *ptr;
|
|
|
|
int len, i, cnt;
|
|
|
|
|
|
|
|
*offset = round_up(*offset, 4);
|
2024-04-07 15:04:50 +08:00
|
|
|
ptr = erofs_bread(buf, *offset, EROFS_KMAP);
|
2022-01-02 16:13:17 +08:00
|
|
|
if (IS_ERR(ptr))
|
|
|
|
return ptr;
|
2021-03-29 18:00:12 +08:00
|
|
|
|
2024-04-07 15:04:50 +08:00
|
|
|
len = le16_to_cpu(*(__le16 *)ptr);
|
2021-03-29 18:00:12 +08:00
|
|
|
if (!len)
|
|
|
|
len = U16_MAX + 1;
|
|
|
|
buffer = kmalloc(len, GFP_KERNEL);
|
2022-01-02 16:13:17 +08:00
|
|
|
if (!buffer)
|
|
|
|
return ERR_PTR(-ENOMEM);
|
2021-03-29 18:00:12 +08:00
|
|
|
*offset += sizeof(__le16);
|
|
|
|
*lengthp = len;
|
|
|
|
|
|
|
|
for (i = 0; i < len; i += cnt) {
|
2023-03-13 21:53:08 +08:00
|
|
|
cnt = min_t(int, sb->s_blocksize - erofs_blkoff(sb, *offset),
|
|
|
|
len - i);
|
2024-04-07 15:04:50 +08:00
|
|
|
ptr = erofs_bread(buf, *offset, EROFS_KMAP);
|
2022-01-02 16:13:17 +08:00
|
|
|
if (IS_ERR(ptr)) {
|
|
|
|
kfree(buffer);
|
|
|
|
return ptr;
|
2021-03-29 18:00:12 +08:00
|
|
|
}
|
2024-04-07 15:04:50 +08:00
|
|
|
memcpy(buffer + i, ptr, cnt);
|
2021-03-29 18:00:12 +08:00
|
|
|
*offset += cnt;
|
|
|
|
}
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2023-10-22 21:09:57 +08:00
|
|
|
#ifndef CONFIG_EROFS_FS_ZIP
|
|
|
|
static int z_erofs_parse_cfgs(struct super_block *sb,
|
|
|
|
struct erofs_super_block *dsb)
|
2021-03-29 18:00:12 +08:00
|
|
|
{
|
2023-10-22 21:09:57 +08:00
|
|
|
if (!dsb->u1.available_compr_algs)
|
|
|
|
return 0;
|
2021-03-29 18:00:12 +08:00
|
|
|
|
2023-10-22 21:09:57 +08:00
|
|
|
erofs_err(sb, "compression disabled, unable to mount compressed EROFS");
|
|
|
|
return -EOPNOTSUPP;
|
2021-03-29 18:00:12 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-05-12 13:56:01 +08:00
|
|
|
static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
|
|
|
|
struct erofs_device_info *dif, erofs_off_t *pos)
|
|
|
|
{
|
|
|
|
struct erofs_sb_info *sbi = EROFS_SB(sb);
|
2022-09-18 12:34:52 +08:00
|
|
|
struct erofs_fscache *fscache;
|
2022-05-12 13:56:01 +08:00
|
|
|
struct erofs_deviceslot *dis;
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
struct file *file;
|
2022-05-12 13:56:01 +08:00
|
|
|
|
erofs: don't align offset for erofs_read_metabuf() (simple cases)
Most of the callers of erofs_read_metabuf() have the following form:
block = erofs_blknr(sb, offset);
off = erofs_blkoff(sb, offset);
p = erofs_read_metabuf(...., erofs_pos(sb, block), ...);
if (IS_ERR(p))
return PTR_ERR(p);
q = p + off;
// no further uses of p, block or off.
The value passed to erofs_read_metabuf() is offset rounded down to block
size, i.e. offset - off. Passing offset as-is would increase the return
value by off in case of success and keep the return value unchanged in
in case of error. In other words, the same could be achieved by
q = erofs_read_metabuf(...., offset, ...);
if (IS_ERR(q))
return PTR_ERR(q);
This commit convert these simple cases.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lore.kernel.org/r/20240425195915.GD1031757@ZenIV
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2024-04-26 03:59:15 +08:00
|
|
|
dis = erofs_read_metabuf(buf, sb, *pos, EROFS_KMAP);
|
|
|
|
if (IS_ERR(dis))
|
|
|
|
return PTR_ERR(dis);
|
2022-05-12 13:56:01 +08:00
|
|
|
|
2023-09-15 16:27:28 +08:00
|
|
|
if (!sbi->devs->flatdev && !dif->path) {
|
2022-05-12 13:56:01 +08:00
|
|
|
if (!dis->tag[0]) {
|
|
|
|
erofs_err(sb, "empty device tag @ pos %llu", *pos);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
dif->path = kmemdup_nul(dis->tag, sizeof(dis->tag), GFP_KERNEL);
|
|
|
|
if (!dif->path)
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (erofs_is_fscache_mode(sb)) {
|
2022-11-25 19:08:22 +08:00
|
|
|
fscache = erofs_fscache_register_cookie(sb, dif->path, 0);
|
2022-09-18 12:34:52 +08:00
|
|
|
if (IS_ERR(fscache))
|
|
|
|
return PTR_ERR(fscache);
|
|
|
|
dif->fscache = fscache;
|
2023-03-02 15:17:51 +08:00
|
|
|
} else if (!sbi->devs->flatdev) {
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
file = erofs_is_fileio_mode(sbi) ?
|
|
|
|
filp_open(dif->path, O_RDONLY | O_LARGEFILE, 0) :
|
|
|
|
bdev_file_open_by_path(dif->path,
|
|
|
|
BLK_OPEN_READ, sb->s_type, NULL);
|
|
|
|
if (IS_ERR(file))
|
|
|
|
return PTR_ERR(file);
|
|
|
|
|
2024-09-17 21:08:03 +08:00
|
|
|
if (!erofs_is_fileio_mode(sbi)) {
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
dif->dax_dev = fs_dax_get_by_bdev(file_bdev(file),
|
|
|
|
&dif->dax_part_off, NULL, NULL);
|
2024-09-17 21:08:03 +08:00
|
|
|
} else if (!S_ISREG(file_inode(file)->i_mode)) {
|
|
|
|
fput(file);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
dif->file = file;
|
2022-05-12 13:56:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
dif->blocks = le32_to_cpu(dis->blocks);
|
|
|
|
dif->mapped_blkaddr = le32_to_cpu(dis->mapped_blkaddr);
|
|
|
|
sbi->total_blocks += dif->blocks;
|
|
|
|
*pos += EROFS_DEVT_SLOT_SIZE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int erofs_scan_devices(struct super_block *sb,
|
2021-10-14 16:10:10 +08:00
|
|
|
struct erofs_super_block *dsb)
|
|
|
|
{
|
|
|
|
struct erofs_sb_info *sbi = EROFS_SB(sb);
|
|
|
|
unsigned int ondisk_extradevs;
|
|
|
|
erofs_off_t pos;
|
2022-01-02 16:13:17 +08:00
|
|
|
struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
|
2021-10-14 16:10:10 +08:00
|
|
|
struct erofs_device_info *dif;
|
|
|
|
int id, err = 0;
|
|
|
|
|
|
|
|
sbi->total_blocks = sbi->primarydevice_blocks;
|
|
|
|
if (!erofs_sb_has_device_table(sbi))
|
|
|
|
ondisk_extradevs = 0;
|
|
|
|
else
|
|
|
|
ondisk_extradevs = le16_to_cpu(dsb->extra_devices);
|
|
|
|
|
2022-05-12 13:56:01 +08:00
|
|
|
if (sbi->devs->extra_devices &&
|
|
|
|
ondisk_extradevs != sbi->devs->extra_devices) {
|
2021-10-14 16:10:10 +08:00
|
|
|
erofs_err(sb, "extra devices don't match (ondisk %u, given %u)",
|
|
|
|
ondisk_extradevs, sbi->devs->extra_devices);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if (!ondisk_extradevs)
|
|
|
|
return 0;
|
|
|
|
|
2023-03-02 15:17:51 +08:00
|
|
|
if (!sbi->devs->extra_devices && !erofs_is_fscache_mode(sb))
|
|
|
|
sbi->devs->flatdev = true;
|
|
|
|
|
2021-10-14 16:10:10 +08:00
|
|
|
sbi->device_id_mask = roundup_pow_of_two(ondisk_extradevs + 1) - 1;
|
|
|
|
pos = le16_to_cpu(dsb->devt_slotoff) * EROFS_DEVT_SLOT_SIZE;
|
|
|
|
down_read(&sbi->devs->rwsem);
|
2022-05-12 13:56:01 +08:00
|
|
|
if (sbi->devs->extra_devices) {
|
|
|
|
idr_for_each_entry(&sbi->devs->tree, dif, id) {
|
|
|
|
err = erofs_init_device(&buf, sb, dif, &pos);
|
2022-04-25 20:21:38 +08:00
|
|
|
if (err)
|
|
|
|
break;
|
2022-05-12 13:56:01 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (id = 0; id < ondisk_extradevs; id++) {
|
|
|
|
dif = kzalloc(sizeof(*dif), GFP_KERNEL);
|
|
|
|
if (!dif) {
|
|
|
|
err = -ENOMEM;
|
2022-04-25 20:21:32 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-05-12 13:56:01 +08:00
|
|
|
err = idr_alloc(&sbi->devs->tree, dif, 0, 0, GFP_KERNEL);
|
|
|
|
if (err < 0) {
|
|
|
|
kfree(dif);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++sbi->devs->extra_devices;
|
|
|
|
|
|
|
|
err = erofs_init_device(&buf, sb, dif, &pos);
|
|
|
|
if (err)
|
|
|
|
break;
|
|
|
|
}
|
2021-10-14 16:10:10 +08:00
|
|
|
}
|
|
|
|
up_read(&sbi->devs->rwsem);
|
2022-01-02 16:13:17 +08:00
|
|
|
erofs_put_metabuf(&buf);
|
2021-10-14 16:10:10 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2019-09-04 10:09:05 +08:00
|
|
|
static int erofs_read_superblock(struct super_block *sb)
|
2018-07-26 20:21:46 +08:00
|
|
|
{
|
2024-08-06 19:22:08 +08:00
|
|
|
struct erofs_sb_info *sbi = EROFS_SB(sb);
|
2022-02-09 14:00:52 +08:00
|
|
|
struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
|
2019-09-04 10:09:00 +08:00
|
|
|
struct erofs_super_block *dsb;
|
2019-09-04 10:09:10 +08:00
|
|
|
void *data;
|
2018-07-26 20:21:46 +08:00
|
|
|
int ret;
|
|
|
|
|
2022-02-09 14:00:52 +08:00
|
|
|
data = erofs_read_metabuf(&buf, sb, 0, EROFS_KMAP);
|
|
|
|
if (IS_ERR(data)) {
|
2019-09-04 10:09:09 +08:00
|
|
|
erofs_err(sb, "cannot read erofs superblock");
|
2022-02-09 14:00:52 +08:00
|
|
|
return PTR_ERR(data);
|
2018-07-26 20:21:46 +08:00
|
|
|
}
|
|
|
|
|
2019-09-04 10:09:10 +08:00
|
|
|
dsb = (struct erofs_super_block *)(data + EROFS_SUPER_OFFSET);
|
2018-07-26 20:21:46 +08:00
|
|
|
ret = -EINVAL;
|
2019-09-04 10:09:00 +08:00
|
|
|
if (le32_to_cpu(dsb->magic) != EROFS_SUPER_MAGIC_V1) {
|
2019-09-04 10:09:09 +08:00
|
|
|
erofs_err(sb, "cannot find valid erofs superblock");
|
2018-07-26 20:21:46 +08:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2023-03-13 21:53:09 +08:00
|
|
|
sbi->blkszbits = dsb->blkszbits;
|
|
|
|
if (sbi->blkszbits < 9 || sbi->blkszbits > PAGE_SHIFT) {
|
|
|
|
erofs_err(sb, "blkszbits %u isn't supported", sbi->blkszbits);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
if (dsb->dirblkbits) {
|
|
|
|
erofs_err(sb, "dirblkbits %u isn't supported", dsb->dirblkbits);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2019-11-04 10:49:37 +08:00
|
|
|
sbi->feature_compat = le32_to_cpu(dsb->feature_compat);
|
2021-03-29 09:23:05 +08:00
|
|
|
if (erofs_sb_has_sb_chksum(sbi)) {
|
2019-11-04 10:49:37 +08:00
|
|
|
ret = erofs_superblock_csum_verify(sb, data);
|
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2021-05-19 22:16:57 +08:00
|
|
|
ret = -EINVAL;
|
2024-08-06 19:22:08 +08:00
|
|
|
sbi->feature_incompat = le32_to_cpu(dsb->feature_incompat);
|
|
|
|
if (sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT) {
|
|
|
|
erofs_err(sb, "unidentified incompatible feature %x, please upgrade kernel",
|
|
|
|
sbi->feature_incompat & ~EROFS_ALL_FEATURE_INCOMPAT);
|
2019-06-13 16:35:41 +08:00
|
|
|
goto out;
|
2024-08-06 19:22:08 +08:00
|
|
|
}
|
2019-06-13 16:35:41 +08:00
|
|
|
|
2021-03-29 18:00:12 +08:00
|
|
|
sbi->sb_size = 128 + dsb->sb_extslots * EROFS_SB_EXTSLOT_SIZE;
|
2023-03-13 21:53:09 +08:00
|
|
|
if (sbi->sb_size > PAGE_SIZE - EROFS_SUPER_OFFSET) {
|
2021-03-29 18:00:12 +08:00
|
|
|
erofs_err(sb, "invalid sb_extslots %u (more than a fs block)",
|
|
|
|
sbi->sb_size);
|
|
|
|
goto out;
|
|
|
|
}
|
2021-10-14 16:10:10 +08:00
|
|
|
sbi->primarydevice_blocks = le32_to_cpu(dsb->blocks);
|
2019-09-04 10:09:00 +08:00
|
|
|
sbi->meta_blkaddr = le32_to_cpu(dsb->meta_blkaddr);
|
2018-07-26 20:21:52 +08:00
|
|
|
#ifdef CONFIG_EROFS_FS_XATTR
|
2019-09-04 10:09:00 +08:00
|
|
|
sbi->xattr_blkaddr = le32_to_cpu(dsb->xattr_blkaddr);
|
2023-04-08 06:28:08 +08:00
|
|
|
sbi->xattr_prefix_start = le32_to_cpu(dsb->xattr_prefix_start);
|
|
|
|
sbi->xattr_prefix_count = dsb->xattr_prefix_count;
|
2023-07-22 17:45:38 +08:00
|
|
|
sbi->xattr_filter_reserved = dsb->xattr_filter_reserved;
|
2018-07-26 20:21:52 +08:00
|
|
|
#endif
|
2019-09-04 10:08:54 +08:00
|
|
|
sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact));
|
2019-09-04 10:09:00 +08:00
|
|
|
sbi->root_nid = le16_to_cpu(dsb->root_nid);
|
2023-04-07 22:17:05 +08:00
|
|
|
sbi->packed_nid = le64_to_cpu(dsb->packed_nid);
|
2019-09-04 10:09:00 +08:00
|
|
|
sbi->inos = le64_to_cpu(dsb->inos);
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2019-09-04 10:09:00 +08:00
|
|
|
sbi->build_time = le64_to_cpu(dsb->build_time);
|
|
|
|
sbi->build_time_nsec = le32_to_cpu(dsb->build_time_nsec);
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2024-06-24 14:37:04 +08:00
|
|
|
super_set_uuid(sb, (void *)dsb->uuid, sizeof(dsb->uuid));
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2019-09-04 10:09:00 +08:00
|
|
|
ret = strscpy(sbi->volume_name, dsb->volume_name,
|
|
|
|
sizeof(dsb->volume_name));
|
2019-08-18 18:28:24 +08:00
|
|
|
if (ret < 0) { /* -E2BIG */
|
2019-09-04 10:09:09 +08:00
|
|
|
erofs_err(sb, "bad volume name without NIL terminator");
|
2019-08-18 18:28:24 +08:00
|
|
|
ret = -EFSCORRUPTED;
|
|
|
|
goto out;
|
|
|
|
}
|
2021-03-29 09:23:06 +08:00
|
|
|
|
|
|
|
/* parse on-disk compression configurations */
|
2023-10-22 21:09:57 +08:00
|
|
|
ret = z_erofs_parse_cfgs(sb, dsb);
|
2021-10-14 16:10:10 +08:00
|
|
|
if (ret < 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
/* handle multiple devices */
|
2022-05-12 13:56:01 +08:00
|
|
|
ret = erofs_scan_devices(sb, dsb);
|
2021-12-28 13:46:04 +08:00
|
|
|
|
2022-04-25 20:21:43 +08:00
|
|
|
if (erofs_is_fscache_mode(sb))
|
2024-08-30 11:28:40 +08:00
|
|
|
erofs_info(sb, "[deprecated] fscache-based on-demand read feature in use. Use at your own risk!");
|
2018-07-26 20:21:46 +08:00
|
|
|
out:
|
2022-02-09 14:00:52 +08:00
|
|
|
erofs_put_metabuf(&buf);
|
2018-07-26 20:21:46 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2024-04-19 20:36:10 +08:00
|
|
|
static void erofs_default_options(struct erofs_sb_info *sbi)
|
2018-07-26 20:21:46 +08:00
|
|
|
{
|
2018-09-20 00:06:56 +08:00
|
|
|
#ifdef CONFIG_EROFS_FS_ZIP
|
2024-04-19 20:36:10 +08:00
|
|
|
sbi->opt.cache_strategy = EROFS_ZIP_CACHE_READAROUND;
|
|
|
|
sbi->opt.max_sync_decompress_pages = 3;
|
|
|
|
sbi->opt.sync_decompress = EROFS_SYNC_DECOMPRESS_AUTO;
|
2018-09-20 00:06:56 +08:00
|
|
|
#endif
|
2018-07-26 20:21:52 +08:00
|
|
|
#ifdef CONFIG_EROFS_FS_XATTR
|
2024-04-19 20:36:10 +08:00
|
|
|
set_opt(&sbi->opt, XATTR_USER);
|
2018-07-26 20:21:52 +08:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_EROFS_FS_POSIX_ACL
|
2024-04-19 20:36:10 +08:00
|
|
|
set_opt(&sbi->opt, POSIX_ACL);
|
2018-07-26 20:21:52 +08:00
|
|
|
#endif
|
2018-07-26 20:21:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
enum {
|
2018-07-26 20:21:52 +08:00
|
|
|
Opt_user_xattr,
|
|
|
|
Opt_acl,
|
2019-07-31 23:57:49 +08:00
|
|
|
Opt_cache_strategy,
|
2021-08-05 08:36:00 +08:00
|
|
|
Opt_dax,
|
|
|
|
Opt_dax_enum,
|
2021-10-14 16:10:10 +08:00
|
|
|
Opt_device,
|
2022-04-25 20:21:43 +08:00
|
|
|
Opt_fsid,
|
2022-09-18 12:34:56 +08:00
|
|
|
Opt_domain_id,
|
2018-07-26 20:21:46 +08:00
|
|
|
Opt_err
|
|
|
|
};
|
|
|
|
|
2020-05-29 18:48:36 +08:00
|
|
|
static const struct constant_table erofs_param_cache_strategy[] = {
|
|
|
|
{"disabled", EROFS_ZIP_CACHE_DISABLED},
|
|
|
|
{"readahead", EROFS_ZIP_CACHE_READAHEAD},
|
|
|
|
{"readaround", EROFS_ZIP_CACHE_READAROUND},
|
|
|
|
{}
|
2018-07-26 20:21:46 +08:00
|
|
|
};
|
|
|
|
|
2021-08-05 08:36:00 +08:00
|
|
|
static const struct constant_table erofs_dax_param_enums[] = {
|
|
|
|
{"always", EROFS_MOUNT_DAX_ALWAYS},
|
|
|
|
{"never", EROFS_MOUNT_DAX_NEVER},
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2020-05-29 18:48:36 +08:00
|
|
|
static const struct fs_parameter_spec erofs_fs_parameters[] = {
|
|
|
|
fsparam_flag_no("user_xattr", Opt_user_xattr),
|
|
|
|
fsparam_flag_no("acl", Opt_acl),
|
|
|
|
fsparam_enum("cache_strategy", Opt_cache_strategy,
|
|
|
|
erofs_param_cache_strategy),
|
2021-08-05 08:36:00 +08:00
|
|
|
fsparam_flag("dax", Opt_dax),
|
|
|
|
fsparam_enum("dax", Opt_dax_enum, erofs_dax_param_enums),
|
2021-10-14 16:10:10 +08:00
|
|
|
fsparam_string("device", Opt_device),
|
2022-04-25 20:21:43 +08:00
|
|
|
fsparam_string("fsid", Opt_fsid),
|
2022-09-18 12:34:56 +08:00
|
|
|
fsparam_string("domain_id", Opt_domain_id),
|
2020-05-29 18:48:36 +08:00
|
|
|
{}
|
|
|
|
};
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2021-08-05 08:36:00 +08:00
|
|
|
static bool erofs_fc_set_dax_mode(struct fs_context *fc, unsigned int mode)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_FS_DAX
|
2024-04-19 20:36:10 +08:00
|
|
|
struct erofs_sb_info *sbi = fc->s_fs_info;
|
2021-08-05 08:36:00 +08:00
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case EROFS_MOUNT_DAX_ALWAYS:
|
2024-04-19 20:36:10 +08:00
|
|
|
set_opt(&sbi->opt, DAX_ALWAYS);
|
|
|
|
clear_opt(&sbi->opt, DAX_NEVER);
|
2021-08-05 08:36:00 +08:00
|
|
|
return true;
|
|
|
|
case EROFS_MOUNT_DAX_NEVER:
|
2024-04-19 20:36:10 +08:00
|
|
|
set_opt(&sbi->opt, DAX_NEVER);
|
|
|
|
clear_opt(&sbi->opt, DAX_ALWAYS);
|
2021-08-05 08:36:00 +08:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
DBG_BUGON(1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
errorfc(fc, "dax options not supported");
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-05-29 18:48:36 +08:00
|
|
|
static int erofs_fc_parse_param(struct fs_context *fc,
|
|
|
|
struct fs_parameter *param)
|
|
|
|
{
|
2024-04-19 20:36:10 +08:00
|
|
|
struct erofs_sb_info *sbi = fc->s_fs_info;
|
2020-05-29 18:48:36 +08:00
|
|
|
struct fs_parse_result result;
|
2021-10-14 16:10:10 +08:00
|
|
|
struct erofs_device_info *dif;
|
|
|
|
int opt, ret;
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2020-05-29 18:48:36 +08:00
|
|
|
opt = fs_parse(fc, erofs_fs_parameters, param, &result);
|
|
|
|
if (opt < 0)
|
|
|
|
return opt;
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2020-05-29 18:48:36 +08:00
|
|
|
switch (opt) {
|
|
|
|
case Opt_user_xattr:
|
2018-07-26 20:21:52 +08:00
|
|
|
#ifdef CONFIG_EROFS_FS_XATTR
|
2020-05-29 18:48:36 +08:00
|
|
|
if (result.boolean)
|
2024-04-19 20:36:10 +08:00
|
|
|
set_opt(&sbi->opt, XATTR_USER);
|
2020-05-29 18:48:36 +08:00
|
|
|
else
|
2024-04-19 20:36:10 +08:00
|
|
|
clear_opt(&sbi->opt, XATTR_USER);
|
2018-07-26 20:21:52 +08:00
|
|
|
#else
|
2020-05-29 18:48:36 +08:00
|
|
|
errorfc(fc, "{,no}user_xattr options not supported");
|
2018-07-26 20:21:52 +08:00
|
|
|
#endif
|
2020-05-29 18:48:36 +08:00
|
|
|
break;
|
|
|
|
case Opt_acl:
|
2018-07-26 20:21:52 +08:00
|
|
|
#ifdef CONFIG_EROFS_FS_POSIX_ACL
|
2020-05-29 18:48:36 +08:00
|
|
|
if (result.boolean)
|
2024-04-19 20:36:10 +08:00
|
|
|
set_opt(&sbi->opt, POSIX_ACL);
|
2020-05-29 18:48:36 +08:00
|
|
|
else
|
2024-04-19 20:36:10 +08:00
|
|
|
clear_opt(&sbi->opt, POSIX_ACL);
|
2018-07-26 20:21:52 +08:00
|
|
|
#else
|
2020-05-29 18:48:36 +08:00
|
|
|
errorfc(fc, "{,no}acl options not supported");
|
2018-07-26 20:21:52 +08:00
|
|
|
#endif
|
2020-05-29 18:48:36 +08:00
|
|
|
break;
|
|
|
|
case Opt_cache_strategy:
|
|
|
|
#ifdef CONFIG_EROFS_FS_ZIP
|
2024-04-19 20:36:10 +08:00
|
|
|
sbi->opt.cache_strategy = result.uint_32;
|
2020-05-29 18:48:36 +08:00
|
|
|
#else
|
|
|
|
errorfc(fc, "compression not supported, cache_strategy ignored");
|
|
|
|
#endif
|
|
|
|
break;
|
2021-08-05 08:36:00 +08:00
|
|
|
case Opt_dax:
|
|
|
|
if (!erofs_fc_set_dax_mode(fc, EROFS_MOUNT_DAX_ALWAYS))
|
|
|
|
return -EINVAL;
|
|
|
|
break;
|
|
|
|
case Opt_dax_enum:
|
|
|
|
if (!erofs_fc_set_dax_mode(fc, result.uint_32))
|
|
|
|
return -EINVAL;
|
|
|
|
break;
|
2021-10-14 16:10:10 +08:00
|
|
|
case Opt_device:
|
|
|
|
dif = kzalloc(sizeof(*dif), GFP_KERNEL);
|
|
|
|
if (!dif)
|
|
|
|
return -ENOMEM;
|
|
|
|
dif->path = kstrdup(param->string, GFP_KERNEL);
|
|
|
|
if (!dif->path) {
|
|
|
|
kfree(dif);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2024-04-19 20:36:10 +08:00
|
|
|
down_write(&sbi->devs->rwsem);
|
|
|
|
ret = idr_alloc(&sbi->devs->tree, dif, 0, 0, GFP_KERNEL);
|
|
|
|
up_write(&sbi->devs->rwsem);
|
2021-10-14 16:10:10 +08:00
|
|
|
if (ret < 0) {
|
|
|
|
kfree(dif->path);
|
|
|
|
kfree(dif);
|
|
|
|
return ret;
|
|
|
|
}
|
2024-04-19 20:36:10 +08:00
|
|
|
++sbi->devs->extra_devices;
|
2021-10-14 16:10:10 +08:00
|
|
|
break;
|
2022-04-25 20:21:43 +08:00
|
|
|
#ifdef CONFIG_EROFS_FS_ONDEMAND
|
2023-01-12 14:54:31 +08:00
|
|
|
case Opt_fsid:
|
2024-04-19 20:36:10 +08:00
|
|
|
kfree(sbi->fsid);
|
|
|
|
sbi->fsid = kstrdup(param->string, GFP_KERNEL);
|
|
|
|
if (!sbi->fsid)
|
2022-04-25 20:21:43 +08:00
|
|
|
return -ENOMEM;
|
2022-09-18 12:34:56 +08:00
|
|
|
break;
|
|
|
|
case Opt_domain_id:
|
2024-04-19 20:36:10 +08:00
|
|
|
kfree(sbi->domain_id);
|
|
|
|
sbi->domain_id = kstrdup(param->string, GFP_KERNEL);
|
|
|
|
if (!sbi->domain_id)
|
2022-09-18 12:34:56 +08:00
|
|
|
return -ENOMEM;
|
2023-01-12 14:54:31 +08:00
|
|
|
break;
|
2022-09-18 12:34:56 +08:00
|
|
|
#else
|
2023-01-12 14:54:31 +08:00
|
|
|
case Opt_fsid:
|
|
|
|
case Opt_domain_id:
|
|
|
|
errorfc(fc, "%s option not supported", erofs_fs_parameters[opt].name);
|
2022-04-25 20:21:43 +08:00
|
|
|
break;
|
2023-01-12 14:54:31 +08:00
|
|
|
#endif
|
2020-05-29 18:48:36 +08:00
|
|
|
default:
|
|
|
|
return -ENOPARAM;
|
2018-07-26 20:21:46 +08:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-04-25 12:07:12 +08:00
|
|
|
static struct inode *erofs_nfs_get_inode(struct super_block *sb,
|
|
|
|
u64 ino, u32 generation)
|
|
|
|
{
|
2022-09-27 14:36:07 +08:00
|
|
|
return erofs_iget(sb, ino);
|
2022-04-25 12:07:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct dentry *erofs_fh_to_dentry(struct super_block *sb,
|
|
|
|
struct fid *fid, int fh_len, int fh_type)
|
|
|
|
{
|
|
|
|
return generic_fh_to_dentry(sb, fid, fh_len, fh_type,
|
|
|
|
erofs_nfs_get_inode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct dentry *erofs_fh_to_parent(struct super_block *sb,
|
|
|
|
struct fid *fid, int fh_len, int fh_type)
|
|
|
|
{
|
|
|
|
return generic_fh_to_parent(sb, fid, fh_len, fh_type,
|
|
|
|
erofs_nfs_get_inode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct dentry *erofs_get_parent(struct dentry *child)
|
|
|
|
{
|
|
|
|
erofs_nid_t nid;
|
|
|
|
unsigned int d_type;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
err = erofs_namei(d_inode(child), &dotdot_name, &nid, &d_type);
|
|
|
|
if (err)
|
|
|
|
return ERR_PTR(err);
|
2022-09-27 14:36:07 +08:00
|
|
|
return d_obtain_alias(erofs_iget(child->d_sb, nid));
|
2022-04-25 12:07:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct export_operations erofs_export_ops = {
|
2023-10-24 02:07:59 +08:00
|
|
|
.encode_fh = generic_encode_ino32_fh,
|
2022-04-25 12:07:12 +08:00
|
|
|
.fh_to_dentry = erofs_fh_to_dentry,
|
|
|
|
.fh_to_parent = erofs_fh_to_parent,
|
|
|
|
.get_parent = erofs_get_parent,
|
|
|
|
};
|
|
|
|
|
2024-07-20 16:23:35 +08:00
|
|
|
static void erofs_set_sysfs_name(struct super_block *sb)
|
|
|
|
{
|
|
|
|
struct erofs_sb_info *sbi = EROFS_SB(sb);
|
|
|
|
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
if (sbi->domain_id)
|
|
|
|
super_set_sysfs_name_generic(sb, "%s,%s", sbi->domain_id,
|
|
|
|
sbi->fsid);
|
|
|
|
else if (sbi->fsid)
|
|
|
|
super_set_sysfs_name_generic(sb, "%s", sbi->fsid);
|
|
|
|
else if (erofs_is_fileio_mode(sbi))
|
|
|
|
super_set_sysfs_name_generic(sb, "%s",
|
|
|
|
bdi_dev_name(sb->s_bdi));
|
|
|
|
else
|
|
|
|
super_set_sysfs_name_id(sb);
|
2024-07-20 16:23:35 +08:00
|
|
|
}
|
|
|
|
|
2020-05-29 18:48:36 +08:00
|
|
|
static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
|
2018-07-26 20:21:46 +08:00
|
|
|
{
|
|
|
|
struct inode *inode;
|
2024-04-19 20:36:10 +08:00
|
|
|
struct erofs_sb_info *sbi = EROFS_SB(sb);
|
2019-07-31 23:57:41 +08:00
|
|
|
int err;
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2019-07-31 23:57:41 +08:00
|
|
|
sb->s_magic = EROFS_SUPER_MAGIC;
|
2022-04-25 20:21:37 +08:00
|
|
|
sb->s_flags |= SB_RDONLY | SB_NOATIME;
|
|
|
|
sb->s_maxbytes = MAX_LFS_FILESIZE;
|
|
|
|
sb->s_op = &erofs_sops;
|
2019-07-31 23:57:41 +08:00
|
|
|
|
2023-03-13 21:53:08 +08:00
|
|
|
sbi->blkszbits = PAGE_SHIFT;
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
if (!sb->s_bdev) {
|
2023-03-13 21:53:09 +08:00
|
|
|
sb->s_blocksize = PAGE_SIZE;
|
|
|
|
sb->s_blocksize_bits = PAGE_SHIFT;
|
2022-04-25 20:21:33 +08:00
|
|
|
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
if (erofs_is_fscache_mode(sb)) {
|
|
|
|
err = erofs_fscache_register_fs(sb);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
}
|
2022-04-25 20:21:42 +08:00
|
|
|
err = super_setup_bdi(sb);
|
|
|
|
if (err)
|
|
|
|
return err;
|
2022-04-25 20:21:32 +08:00
|
|
|
} else {
|
2023-03-13 21:53:09 +08:00
|
|
|
if (!sb_set_blocksize(sb, PAGE_SIZE)) {
|
|
|
|
errorfc(fc, "failed to set initial blksize");
|
2022-04-25 20:21:32 +08:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
sbi->dax_dev = fs_dax_get_by_bdev(sb->s_bdev,
|
dax: introduce holder for dax_device
Patch series "v14 fsdax-rmap + v11 fsdax-reflink", v2.
The patchset fsdax-rmap is aimed to support shared pages tracking for
fsdax.
It moves owner tracking from dax_assocaite_entry() to pmem device driver,
by introducing an interface ->memory_failure() for struct pagemap. This
interface is called by memory_failure() in mm, and implemented by pmem
device.
Then call holder operations to find the filesystem which the corrupted
data located in, and call filesystem handler to track files or metadata
associated with this page.
Finally we are able to try to fix the corrupted data in filesystem and do
other necessary processing, such as killing processes who are using the
files affected.
The call trace is like this:
memory_failure()
|* fsdax case
|------------
|pgmap->ops->memory_failure() => pmem_pgmap_memory_failure()
| dax_holder_notify_failure() =>
| dax_device->holder_ops->notify_failure() =>
| - xfs_dax_notify_failure()
| |* xfs_dax_notify_failure()
| |--------------------------
| | xfs_rmap_query_range()
| | xfs_dax_failure_fn()
| | * corrupted on metadata
| | try to recover data, call xfs_force_shutdown()
| | * corrupted on file data
| | try to recover data, call mf_dax_kill_procs()
|* normal case
|-------------
|mf_generic_kill_procs()
The patchset fsdax-reflink attempts to add CoW support for fsdax, and
takes XFS, which has both reflink and fsdax features, as an example.
One of the key mechanisms needed to be implemented in fsdax is CoW. Copy
the data from srcmap before we actually write data to the destination
iomap. And we just copy range in which data won't be changed.
Another mechanism is range comparison. In page cache case, readpage() is
used to load data on disk to page cache in order to be able to compare
data. In fsdax case, readpage() does not work. So, we need another
compare data with direct access support.
With the two mechanisms implemented in fsdax, we are able to make reflink
and fsdax work together in XFS.
This patch (of 14):
To easily track filesystem from a pmem device, we introduce a holder for
dax_device structure, and also its operation. This holder is used to
remember who is using this dax_device:
- When it is the backend of a filesystem, the holder will be the
instance of this filesystem.
- When this pmem device is one of the targets in a mapped device, the
holder will be this mapped device. In this case, the mapped device
has its own dax_device and it will follow the first rule. So that we
can finally track to the filesystem we needed.
The holder and holder_ops will be set when filesystem is being mounted,
or an target device is being activated.
Link: https://lkml.kernel.org/r/20220603053738.1218681-1-ruansy.fnst@fujitsu.com
Link: https://lkml.kernel.org/r/20220603053738.1218681-2-ruansy.fnst@fujitsu.com
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dan Williams <dan.j.wiliams@intel.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jane Chu <jane.chu@oracle.com>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
Cc: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-06-03 13:37:25 +08:00
|
|
|
&sbi->dax_part_off,
|
|
|
|
NULL, NULL);
|
2022-04-25 20:21:32 +08:00
|
|
|
}
|
|
|
|
|
2019-09-04 10:09:05 +08:00
|
|
|
err = erofs_read_superblock(sb);
|
2018-07-26 20:21:46 +08:00
|
|
|
if (err)
|
2019-07-31 23:57:41 +08:00
|
|
|
return err;
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2023-03-13 21:53:09 +08:00
|
|
|
if (sb->s_blocksize_bits != sbi->blkszbits) {
|
|
|
|
if (erofs_is_fscache_mode(sb)) {
|
|
|
|
errorfc(fc, "unsupported blksize for fscache mode");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) {
|
|
|
|
errorfc(fc, "failed to set erofs blksize");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
2021-11-29 18:21:42 +08:00
|
|
|
|
2023-03-13 21:53:09 +08:00
|
|
|
if (test_opt(&sbi->opt, DAX_ALWAYS)) {
|
2021-11-29 18:21:42 +08:00
|
|
|
if (!sbi->dax_dev) {
|
|
|
|
errorfc(fc, "DAX unsupported by block device. Turning off DAX.");
|
|
|
|
clear_opt(&sbi->opt, DAX_ALWAYS);
|
2023-03-13 21:53:09 +08:00
|
|
|
} else if (sbi->blkszbits != PAGE_SHIFT) {
|
|
|
|
errorfc(fc, "unsupported blocksize for DAX");
|
|
|
|
clear_opt(&sbi->opt, DAX_ALWAYS);
|
2021-11-29 18:21:42 +08:00
|
|
|
}
|
2021-08-05 08:36:00 +08:00
|
|
|
}
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2022-04-25 20:21:37 +08:00
|
|
|
sb->s_time_gran = 1;
|
2018-07-26 20:21:52 +08:00
|
|
|
sb->s_xattr = erofs_xattr_handlers;
|
2022-04-25 12:07:12 +08:00
|
|
|
sb->s_export_op = &erofs_export_ops;
|
2020-05-26 17:03:43 +08:00
|
|
|
|
2021-10-07 15:02:23 +08:00
|
|
|
if (test_opt(&sbi->opt, POSIX_ACL))
|
2019-01-29 16:35:20 +08:00
|
|
|
sb->s_flags |= SB_POSIXACL;
|
|
|
|
else
|
|
|
|
sb->s_flags &= ~SB_POSIXACL;
|
|
|
|
|
2018-07-26 20:22:05 +08:00
|
|
|
#ifdef CONFIG_EROFS_FS_ZIP
|
2020-02-20 10:46:42 +08:00
|
|
|
xa_init(&sbi->managed_pslots);
|
2018-07-26 20:22:05 +08:00
|
|
|
#endif
|
|
|
|
|
2023-10-26 10:16:26 +08:00
|
|
|
inode = erofs_iget(sb, sbi->root_nid);
|
2019-07-31 23:57:41 +08:00
|
|
|
if (IS_ERR(inode))
|
|
|
|
return PTR_ERR(inode);
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2019-08-30 00:38:27 +08:00
|
|
|
if (!S_ISDIR(inode->i_mode)) {
|
2019-09-04 10:09:09 +08:00
|
|
|
erofs_err(sb, "rootino(nid %llu) is not a directory(i_mode %o)",
|
2023-10-26 10:16:26 +08:00
|
|
|
sbi->root_nid, inode->i_mode);
|
2019-01-23 14:12:25 +08:00
|
|
|
iput(inode);
|
2019-07-31 23:57:41 +08:00
|
|
|
return -EINVAL;
|
2018-07-26 20:21:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
sb->s_root = d_make_root(inode);
|
2019-08-30 00:38:27 +08:00
|
|
|
if (!sb->s_root)
|
2019-07-31 23:57:41 +08:00
|
|
|
return -ENOMEM;
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2019-07-31 23:57:39 +08:00
|
|
|
erofs_shrinker_register(sb);
|
2023-04-07 22:17:05 +08:00
|
|
|
if (erofs_sb_has_fragments(sbi) && sbi->packed_nid) {
|
|
|
|
sbi->packed_inode = erofs_iget(sb, sbi->packed_nid);
|
|
|
|
if (IS_ERR(sbi->packed_inode)) {
|
|
|
|
err = PTR_ERR(sbi->packed_inode);
|
|
|
|
sbi->packed_inode = NULL;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
2019-07-31 23:57:41 +08:00
|
|
|
err = erofs_init_managed_cache(sb);
|
2019-08-30 00:38:27 +08:00
|
|
|
if (err)
|
2019-07-31 23:57:41 +08:00
|
|
|
return err;
|
2018-07-26 20:22:03 +08:00
|
|
|
|
2023-04-08 06:28:08 +08:00
|
|
|
err = erofs_xattr_prefixes_init(sb);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
2024-08-28 17:52:32 +08:00
|
|
|
erofs_set_sysfs_name(sb);
|
2021-12-01 22:54:36 +08:00
|
|
|
err = erofs_register_sysfs(sb);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
2023-10-26 10:16:26 +08:00
|
|
|
erofs_info(sb, "mounted with root inode @ nid %llu.", sbi->root_nid);
|
2020-05-29 18:48:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int erofs_fc_get_tree(struct fs_context *fc)
|
|
|
|
{
|
2024-04-19 20:36:10 +08:00
|
|
|
struct erofs_sb_info *sbi = fc->s_fs_info;
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
int ret;
|
2022-04-25 20:21:43 +08:00
|
|
|
|
2024-04-19 20:36:10 +08:00
|
|
|
if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid)
|
2022-04-25 20:21:43 +08:00
|
|
|
return get_tree_nodev(fc, erofs_fc_fill_super);
|
|
|
|
|
2024-10-09 11:31:51 +08:00
|
|
|
ret = get_tree_bdev_flags(fc, erofs_fc_fill_super,
|
|
|
|
IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) ?
|
|
|
|
GET_TREE_BDEV_QUIET_LOOKUP : 0);
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
#ifdef CONFIG_EROFS_FS_BACKED_BY_FILE
|
|
|
|
if (ret == -ENOTBLK) {
|
|
|
|
if (!fc->source)
|
|
|
|
return invalf(fc, "No source specified");
|
|
|
|
sbi->fdev = filp_open(fc->source, O_RDONLY | O_LARGEFILE, 0);
|
|
|
|
if (IS_ERR(sbi->fdev))
|
|
|
|
return PTR_ERR(sbi->fdev);
|
|
|
|
|
2024-09-17 21:08:03 +08:00
|
|
|
if (S_ISREG(file_inode(sbi->fdev)->i_mode) &&
|
|
|
|
sbi->fdev->f_mapping->a_ops->read_folio)
|
|
|
|
return get_tree_nodev(fc, erofs_fc_fill_super);
|
|
|
|
fput(sbi->fdev);
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return ret;
|
2020-05-29 18:48:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int erofs_fc_reconfigure(struct fs_context *fc)
|
|
|
|
{
|
|
|
|
struct super_block *sb = fc->root->d_sb;
|
|
|
|
struct erofs_sb_info *sbi = EROFS_SB(sb);
|
2024-04-19 20:36:10 +08:00
|
|
|
struct erofs_sb_info *new_sbi = fc->s_fs_info;
|
2020-05-29 18:48:36 +08:00
|
|
|
|
|
|
|
DBG_BUGON(!sb_rdonly(sb));
|
|
|
|
|
2024-04-19 20:36:10 +08:00
|
|
|
if (new_sbi->fsid || new_sbi->domain_id)
|
2022-10-21 10:31:53 +08:00
|
|
|
erofs_info(sb, "ignoring reconfiguration for fsid|domain_id.");
|
|
|
|
|
2024-04-19 20:36:10 +08:00
|
|
|
if (test_opt(&new_sbi->opt, POSIX_ACL))
|
2020-05-29 18:48:36 +08:00
|
|
|
fc->sb_flags |= SB_POSIXACL;
|
|
|
|
else
|
|
|
|
fc->sb_flags &= ~SB_POSIXACL;
|
|
|
|
|
2024-04-19 20:36:10 +08:00
|
|
|
sbi->opt = new_sbi->opt;
|
2020-05-29 18:48:36 +08:00
|
|
|
|
|
|
|
fc->sb_flags |= SB_RDONLY;
|
2018-07-26 20:21:46 +08:00
|
|
|
return 0;
|
2019-07-31 23:57:41 +08:00
|
|
|
}
|
|
|
|
|
2021-10-14 16:10:10 +08:00
|
|
|
static int erofs_release_device_info(int id, void *ptr, void *data)
|
|
|
|
{
|
|
|
|
struct erofs_device_info *dif = ptr;
|
|
|
|
|
dax: introduce holder for dax_device
Patch series "v14 fsdax-rmap + v11 fsdax-reflink", v2.
The patchset fsdax-rmap is aimed to support shared pages tracking for
fsdax.
It moves owner tracking from dax_assocaite_entry() to pmem device driver,
by introducing an interface ->memory_failure() for struct pagemap. This
interface is called by memory_failure() in mm, and implemented by pmem
device.
Then call holder operations to find the filesystem which the corrupted
data located in, and call filesystem handler to track files or metadata
associated with this page.
Finally we are able to try to fix the corrupted data in filesystem and do
other necessary processing, such as killing processes who are using the
files affected.
The call trace is like this:
memory_failure()
|* fsdax case
|------------
|pgmap->ops->memory_failure() => pmem_pgmap_memory_failure()
| dax_holder_notify_failure() =>
| dax_device->holder_ops->notify_failure() =>
| - xfs_dax_notify_failure()
| |* xfs_dax_notify_failure()
| |--------------------------
| | xfs_rmap_query_range()
| | xfs_dax_failure_fn()
| | * corrupted on metadata
| | try to recover data, call xfs_force_shutdown()
| | * corrupted on file data
| | try to recover data, call mf_dax_kill_procs()
|* normal case
|-------------
|mf_generic_kill_procs()
The patchset fsdax-reflink attempts to add CoW support for fsdax, and
takes XFS, which has both reflink and fsdax features, as an example.
One of the key mechanisms needed to be implemented in fsdax is CoW. Copy
the data from srcmap before we actually write data to the destination
iomap. And we just copy range in which data won't be changed.
Another mechanism is range comparison. In page cache case, readpage() is
used to load data on disk to page cache in order to be able to compare
data. In fsdax case, readpage() does not work. So, we need another
compare data with direct access support.
With the two mechanisms implemented in fsdax, we are able to make reflink
and fsdax work together in XFS.
This patch (of 14):
To easily track filesystem from a pmem device, we introduce a holder for
dax_device structure, and also its operation. This holder is used to
remember who is using this dax_device:
- When it is the backend of a filesystem, the holder will be the
instance of this filesystem.
- When this pmem device is one of the targets in a mapped device, the
holder will be this mapped device. In this case, the mapped device
has its own dax_device and it will follow the first rule. So that we
can finally track to the filesystem we needed.
The holder and holder_ops will be set when filesystem is being mounted,
or an target device is being activated.
Link: https://lkml.kernel.org/r/20220603053738.1218681-1-ruansy.fnst@fujitsu.com
Link: https://lkml.kernel.org/r/20220603053738.1218681-2-ruansy.fnst@fujitsu.com
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dan Williams <dan.j.wiliams@intel.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jane Chu <jane.chu@oracle.com>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
Cc: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-06-03 13:37:25 +08:00
|
|
|
fs_put_dax(dif->dax_dev, NULL);
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
if (dif->file)
|
|
|
|
fput(dif->file);
|
2022-09-18 12:34:52 +08:00
|
|
|
erofs_fscache_unregister_cookie(dif->fscache);
|
|
|
|
dif->fscache = NULL;
|
2021-10-14 16:10:10 +08:00
|
|
|
kfree(dif->path);
|
|
|
|
kfree(dif);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void erofs_free_dev_context(struct erofs_dev_context *devs)
|
|
|
|
{
|
|
|
|
if (!devs)
|
|
|
|
return;
|
|
|
|
idr_for_each(&devs->tree, &erofs_release_device_info, NULL);
|
|
|
|
idr_destroy(&devs->tree);
|
|
|
|
kfree(devs);
|
|
|
|
}
|
|
|
|
|
2020-05-29 18:48:36 +08:00
|
|
|
static void erofs_fc_free(struct fs_context *fc)
|
|
|
|
{
|
2024-04-19 20:36:10 +08:00
|
|
|
struct erofs_sb_info *sbi = fc->s_fs_info;
|
|
|
|
|
|
|
|
if (!sbi)
|
|
|
|
return;
|
2021-10-14 16:10:10 +08:00
|
|
|
|
2024-04-19 20:36:10 +08:00
|
|
|
erofs_free_dev_context(sbi->devs);
|
|
|
|
kfree(sbi->fsid);
|
|
|
|
kfree(sbi->domain_id);
|
|
|
|
kfree(sbi);
|
2020-05-29 18:48:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct fs_context_operations erofs_context_ops = {
|
|
|
|
.parse_param = erofs_fc_parse_param,
|
|
|
|
.get_tree = erofs_fc_get_tree,
|
|
|
|
.reconfigure = erofs_fc_reconfigure,
|
|
|
|
.free = erofs_fc_free,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int erofs_init_fs_context(struct fs_context *fc)
|
2019-07-31 23:57:41 +08:00
|
|
|
{
|
2024-04-19 20:36:10 +08:00
|
|
|
struct erofs_sb_info *sbi;
|
2022-09-18 12:34:54 +08:00
|
|
|
|
2024-04-19 20:36:10 +08:00
|
|
|
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
|
|
|
|
if (!sbi)
|
2021-10-14 16:10:10 +08:00
|
|
|
return -ENOMEM;
|
2024-04-19 20:36:10 +08:00
|
|
|
|
|
|
|
sbi->devs = kzalloc(sizeof(struct erofs_dev_context), GFP_KERNEL);
|
|
|
|
if (!sbi->devs) {
|
|
|
|
kfree(sbi);
|
2021-10-14 16:10:10 +08:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2024-04-19 20:36:10 +08:00
|
|
|
fc->s_fs_info = sbi;
|
2020-05-29 18:48:36 +08:00
|
|
|
|
2024-04-19 20:36:10 +08:00
|
|
|
idr_init(&sbi->devs->tree);
|
|
|
|
init_rwsem(&sbi->devs->rwsem);
|
|
|
|
erofs_default_options(sbi);
|
2020-05-29 18:48:36 +08:00
|
|
|
fc->ops = &erofs_context_ops;
|
|
|
|
return 0;
|
2018-07-26 20:21:46 +08:00
|
|
|
}
|
|
|
|
|
2019-07-31 23:57:41 +08:00
|
|
|
static void erofs_kill_sb(struct super_block *sb)
|
2018-07-26 20:21:46 +08:00
|
|
|
{
|
2024-04-19 20:36:11 +08:00
|
|
|
struct erofs_sb_info *sbi = EROFS_SB(sb);
|
2019-07-31 23:57:41 +08:00
|
|
|
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
if ((IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) || sbi->fdev)
|
2022-09-18 12:34:51 +08:00
|
|
|
kill_anon_super(sb);
|
2022-04-25 20:21:43 +08:00
|
|
|
else
|
|
|
|
kill_block_super(sb);
|
2019-07-31 23:57:41 +08:00
|
|
|
|
2021-10-14 16:10:10 +08:00
|
|
|
erofs_free_dev_context(sbi->devs);
|
dax: introduce holder for dax_device
Patch series "v14 fsdax-rmap + v11 fsdax-reflink", v2.
The patchset fsdax-rmap is aimed to support shared pages tracking for
fsdax.
It moves owner tracking from dax_assocaite_entry() to pmem device driver,
by introducing an interface ->memory_failure() for struct pagemap. This
interface is called by memory_failure() in mm, and implemented by pmem
device.
Then call holder operations to find the filesystem which the corrupted
data located in, and call filesystem handler to track files or metadata
associated with this page.
Finally we are able to try to fix the corrupted data in filesystem and do
other necessary processing, such as killing processes who are using the
files affected.
The call trace is like this:
memory_failure()
|* fsdax case
|------------
|pgmap->ops->memory_failure() => pmem_pgmap_memory_failure()
| dax_holder_notify_failure() =>
| dax_device->holder_ops->notify_failure() =>
| - xfs_dax_notify_failure()
| |* xfs_dax_notify_failure()
| |--------------------------
| | xfs_rmap_query_range()
| | xfs_dax_failure_fn()
| | * corrupted on metadata
| | try to recover data, call xfs_force_shutdown()
| | * corrupted on file data
| | try to recover data, call mf_dax_kill_procs()
|* normal case
|-------------
|mf_generic_kill_procs()
The patchset fsdax-reflink attempts to add CoW support for fsdax, and
takes XFS, which has both reflink and fsdax features, as an example.
One of the key mechanisms needed to be implemented in fsdax is CoW. Copy
the data from srcmap before we actually write data to the destination
iomap. And we just copy range in which data won't be changed.
Another mechanism is range comparison. In page cache case, readpage() is
used to load data on disk to page cache in order to be able to compare
data. In fsdax case, readpage() does not work. So, we need another
compare data with direct access support.
With the two mechanisms implemented in fsdax, we are able to make reflink
and fsdax work together in XFS.
This patch (of 14):
To easily track filesystem from a pmem device, we introduce a holder for
dax_device structure, and also its operation. This holder is used to
remember who is using this dax_device:
- When it is the backend of a filesystem, the holder will be the
instance of this filesystem.
- When this pmem device is one of the targets in a mapped device, the
holder will be this mapped device. In this case, the mapped device
has its own dax_device and it will follow the first rule. So that we
can finally track to the filesystem we needed.
The holder and holder_ops will be set when filesystem is being mounted,
or an target device is being activated.
Link: https://lkml.kernel.org/r/20220603053738.1218681-1-ruansy.fnst@fujitsu.com
Link: https://lkml.kernel.org/r/20220603053738.1218681-2-ruansy.fnst@fujitsu.com
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dan Williams <dan.j.wiliams@intel.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jane Chu <jane.chu@oracle.com>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
Cc: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-06-03 13:37:25 +08:00
|
|
|
fs_put_dax(sbi->dax_dev, NULL);
|
2022-04-25 20:21:33 +08:00
|
|
|
erofs_fscache_unregister_fs(sb);
|
2022-10-21 10:31:53 +08:00
|
|
|
kfree(sbi->fsid);
|
|
|
|
kfree(sbi->domain_id);
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
if (sbi->fdev)
|
|
|
|
fput(sbi->fdev);
|
2019-07-31 23:57:41 +08:00
|
|
|
kfree(sbi);
|
|
|
|
sb->s_fs_info = NULL;
|
|
|
|
}
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2019-07-31 23:57:41 +08:00
|
|
|
static void erofs_put_super(struct super_block *sb)
|
|
|
|
{
|
|
|
|
struct erofs_sb_info *const sbi = EROFS_SB(sb);
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2019-07-31 23:57:41 +08:00
|
|
|
DBG_BUGON(!sbi);
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2021-12-01 22:54:36 +08:00
|
|
|
erofs_unregister_sysfs(sb);
|
2019-07-31 23:57:39 +08:00
|
|
|
erofs_shrinker_unregister(sb);
|
2023-04-08 06:28:08 +08:00
|
|
|
erofs_xattr_prefixes_cleanup(sb);
|
2019-07-31 23:57:49 +08:00
|
|
|
#ifdef CONFIG_EROFS_FS_ZIP
|
2018-07-26 20:22:07 +08:00
|
|
|
iput(sbi->managed_cache);
|
2019-07-31 23:57:41 +08:00
|
|
|
sbi->managed_cache = NULL;
|
2023-04-07 22:17:06 +08:00
|
|
|
#endif
|
2022-09-23 10:11:22 +08:00
|
|
|
iput(sbi->packed_inode);
|
|
|
|
sbi->packed_inode = NULL;
|
2023-02-09 14:39:13 +08:00
|
|
|
erofs_free_dev_context(sbi->devs);
|
|
|
|
sbi->devs = NULL;
|
2022-09-18 12:34:52 +08:00
|
|
|
erofs_fscache_unregister_fs(sb);
|
2018-07-26 20:21:46 +08:00
|
|
|
}
|
|
|
|
|
erofs: fix lockdep false positives on initializing erofs_pseudo_mnt
Lockdep reported the following issue when mounting erofs with a domain_id:
============================================
WARNING: possible recursive locking detected
6.8.0-rc7-xfstests #521 Not tainted
--------------------------------------------
mount/396 is trying to acquire lock:
ffff907a8aaaa0e0 (&type->s_umount_key#50/1){+.+.}-{3:3},
at: alloc_super+0xe3/0x3d0
but task is already holding lock:
ffff907a8aaa90e0 (&type->s_umount_key#50/1){+.+.}-{3:3},
at: alloc_super+0xe3/0x3d0
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&type->s_umount_key#50/1);
lock(&type->s_umount_key#50/1);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by mount/396:
#0: ffff907a8aaa90e0 (&type->s_umount_key#50/1){+.+.}-{3:3},
at: alloc_super+0xe3/0x3d0
#1: ffffffffc00e6f28 (erofs_domain_list_lock){+.+.}-{3:3},
at: erofs_fscache_register_fs+0x3d/0x270 [erofs]
stack backtrace:
CPU: 1 PID: 396 Comm: mount Not tainted 6.8.0-rc7-xfstests #521
Call Trace:
<TASK>
dump_stack_lvl+0x64/0xb0
validate_chain+0x5c4/0xa00
__lock_acquire+0x6a9/0xd50
lock_acquire+0xcd/0x2b0
down_write_nested+0x45/0xd0
alloc_super+0xe3/0x3d0
sget_fc+0x62/0x2f0
vfs_get_super+0x21/0x90
vfs_get_tree+0x2c/0xf0
fc_mount+0x12/0x40
vfs_kern_mount.part.0+0x75/0x90
kern_mount+0x24/0x40
erofs_fscache_register_fs+0x1ef/0x270 [erofs]
erofs_fc_fill_super+0x213/0x380 [erofs]
This is because the file_system_type of both erofs and the pseudo-mount
point of domain_id is erofs_fs_type, so two successive calls to
alloc_super() are considered to be using the same lock and trigger the
warning above.
Therefore add a nodev file_system_type called erofs_anon_fs_type in
fscache.c to silence this complaint. Because kern_mount() takes a
pointer to struct file_system_type, not its (string) name. So we don't
need to call register_filesystem(). In addition, call init_pseudo() in
erofs_anon_init_fs_context() as suggested by Al Viro, so that we can
remove erofs_fc_fill_pseudo_super(), erofs_fc_anon_get_tree(), and
erofs_anon_context_ops.
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Fixes: a9849560c55e ("erofs: introduce a pseudo mnt to manage shared cookies")
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-and-tested-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Yang Erkun <yangerkun@huawei.com>
Link: https://lore.kernel.org/r/20240307101018.2021925-1-libaokun1@huawei.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2024-03-07 18:10:18 +08:00
|
|
|
static struct file_system_type erofs_fs_type = {
|
2018-07-26 20:21:46 +08:00
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.name = "erofs",
|
2020-05-29 18:48:36 +08:00
|
|
|
.init_fs_context = erofs_init_fs_context,
|
2019-07-31 23:57:41 +08:00
|
|
|
.kill_sb = erofs_kill_sb,
|
2022-05-17 18:41:03 +08:00
|
|
|
.fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
|
2018-07-26 20:21:46 +08:00
|
|
|
};
|
|
|
|
MODULE_ALIAS_FS("erofs");
|
|
|
|
|
|
|
|
static int __init erofs_module_init(void)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
erofs_check_ondisk_layout_definitions();
|
|
|
|
|
2019-09-04 10:08:55 +08:00
|
|
|
erofs_inode_cachep = kmem_cache_create("erofs_inode",
|
2023-08-15 17:48:48 +08:00
|
|
|
sizeof(struct erofs_inode), 0,
|
2024-03-13 11:32:19 +08:00
|
|
|
SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT,
|
2023-08-15 17:48:48 +08:00
|
|
|
erofs_inode_init_once);
|
2023-06-15 11:45:38 +08:00
|
|
|
if (!erofs_inode_cachep)
|
|
|
|
return -ENOMEM;
|
2018-07-26 20:21:46 +08:00
|
|
|
|
2019-07-31 23:57:39 +08:00
|
|
|
err = erofs_init_shrinker();
|
2018-07-26 20:22:04 +08:00
|
|
|
if (err)
|
|
|
|
goto shrinker_err;
|
|
|
|
|
2024-07-09 17:41:05 +08:00
|
|
|
err = z_erofs_init_subsystem();
|
staging: erofs: introduce VLE decompression support
This patch introduces the basic in-place VLE decompression
implementation for the erofs file system.
Compared with fixed-sized input compression, it implements
what we call 'the variable-length extent compression' which
specifies the same output size for each compression block
to make the full use of IO bandwidth (which means almost
all data from block device can be directly used for decomp-
ression), improve the real (rather than just via data caching,
which costs more memory) random read and keep the relatively
lower compression ratios (it saves more storage space than
fixed-sized input compression which is also configured with
the same input block size), as illustrated below:
|--- variable-length extent ---|------ VLE ------|--- VLE ---|
/> clusterofs /> clusterofs /> clusterofs /> clusterofs
++---|-------++-----------++---------|-++-----------++-|---------++-|
...|| | || || | || || | || | ... original data
++---|-------++-----------++---------|-++-----------++-|---------++-|
++->cluster<-++->cluster<-++->cluster<-++->cluster<-++->cluster<-++
size size size size size
\ / / /
\ / / /
\ / / /
++-----------++-----------++-----------++
... || || || || ... compressed clusters
++-----------++-----------++-----------++
++->cluster<-++->cluster<-++->cluster<-++
size size size
The main point of 'in-place' refers to the decompression mode:
Instead of allocating independent compressed pages and data
structures, it reuses the allocated file cache pages at most
to store its compressed data and the corresponding pagevec in
a time-sharing approach by default, which will be useful for
low memory scenario.
In the end, unlike the other filesystems with (de)compression
support using a relatively large compression block size, which
reads and decompresses >= 128KB at once, and gains a more
good-looking random read (In fact it collects small random reads
into large sequential reads and caches all decompressed data
in memory, but it is unacceptable especially for embedded devices
with limited memory, and it is not the real random read), we
select a universal small-sized 4KB compressed cluster, which is
the smallest page size for most architectures, and all compressed
clusters can be read and decompressed independently, which ensures
random read number for all use cases.
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-26 20:22:06 +08:00
|
|
|
if (err)
|
|
|
|
goto zip_err;
|
|
|
|
|
2021-12-01 22:54:36 +08:00
|
|
|
err = erofs_init_sysfs();
|
|
|
|
if (err)
|
|
|
|
goto sysfs_err;
|
|
|
|
|
2018-07-26 20:21:46 +08:00
|
|
|
err = register_filesystem(&erofs_fs_type);
|
|
|
|
if (err)
|
|
|
|
goto fs_err;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
fs_err:
|
2021-12-01 22:54:36 +08:00
|
|
|
erofs_exit_sysfs();
|
|
|
|
sysfs_err:
|
2024-07-09 17:41:05 +08:00
|
|
|
z_erofs_exit_subsystem();
|
staging: erofs: introduce VLE decompression support
This patch introduces the basic in-place VLE decompression
implementation for the erofs file system.
Compared with fixed-sized input compression, it implements
what we call 'the variable-length extent compression' which
specifies the same output size for each compression block
to make the full use of IO bandwidth (which means almost
all data from block device can be directly used for decomp-
ression), improve the real (rather than just via data caching,
which costs more memory) random read and keep the relatively
lower compression ratios (it saves more storage space than
fixed-sized input compression which is also configured with
the same input block size), as illustrated below:
|--- variable-length extent ---|------ VLE ------|--- VLE ---|
/> clusterofs /> clusterofs /> clusterofs /> clusterofs
++---|-------++-----------++---------|-++-----------++-|---------++-|
...|| | || || | || || | || | ... original data
++---|-------++-----------++---------|-++-----------++-|---------++-|
++->cluster<-++->cluster<-++->cluster<-++->cluster<-++->cluster<-++
size size size size size
\ / / /
\ / / /
\ / / /
++-----------++-----------++-----------++
... || || || || ... compressed clusters
++-----------++-----------++-----------++
++->cluster<-++->cluster<-++->cluster<-++
size size size
The main point of 'in-place' refers to the decompression mode:
Instead of allocating independent compressed pages and data
structures, it reuses the allocated file cache pages at most
to store its compressed data and the corresponding pagevec in
a time-sharing approach by default, which will be useful for
low memory scenario.
In the end, unlike the other filesystems with (de)compression
support using a relatively large compression block size, which
reads and decompresses >= 128KB at once, and gains a more
good-looking random read (In fact it collects small random reads
into large sequential reads and caches all decompressed data
in memory, but it is unacceptable especially for embedded devices
with limited memory, and it is not the real random read), we
select a universal small-sized 4KB compressed cluster, which is
the smallest page size for most architectures, and all compressed
clusters can be read and decompressed independently, which ensures
random read number for all use cases.
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-26 20:22:06 +08:00
|
|
|
zip_err:
|
2019-07-31 23:57:39 +08:00
|
|
|
erofs_exit_shrinker();
|
2018-07-26 20:22:04 +08:00
|
|
|
shrinker_err:
|
2019-09-04 10:08:55 +08:00
|
|
|
kmem_cache_destroy(erofs_inode_cachep);
|
2018-07-26 20:21:46 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit erofs_module_exit(void)
|
|
|
|
{
|
|
|
|
unregister_filesystem(&erofs_fs_type);
|
2019-09-04 10:08:55 +08:00
|
|
|
|
2021-10-11 05:31:45 +08:00
|
|
|
/* Ensure all RCU free inodes / pclusters are safe to be destroyed. */
|
2019-09-04 10:08:55 +08:00
|
|
|
rcu_barrier();
|
2021-10-11 05:31:45 +08:00
|
|
|
|
2021-12-01 22:54:36 +08:00
|
|
|
erofs_exit_sysfs();
|
2024-07-09 17:41:05 +08:00
|
|
|
z_erofs_exit_subsystem();
|
2021-10-11 05:31:45 +08:00
|
|
|
erofs_exit_shrinker();
|
2019-09-04 10:08:55 +08:00
|
|
|
kmem_cache_destroy(erofs_inode_cachep);
|
2018-07-26 20:21:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int erofs_statfs(struct dentry *dentry, struct kstatfs *buf)
|
|
|
|
{
|
|
|
|
struct super_block *sb = dentry->d_sb;
|
|
|
|
struct erofs_sb_info *sbi = EROFS_SB(sb);
|
|
|
|
|
|
|
|
buf->f_type = sb->s_magic;
|
2023-03-13 21:53:08 +08:00
|
|
|
buf->f_bsize = sb->s_blocksize;
|
2021-10-14 16:10:10 +08:00
|
|
|
buf->f_blocks = sbi->total_blocks;
|
2018-07-26 20:21:46 +08:00
|
|
|
buf->f_bfree = buf->f_bavail = 0;
|
|
|
|
buf->f_files = ULLONG_MAX;
|
|
|
|
buf->f_ffree = ULLONG_MAX - sbi->inos;
|
|
|
|
buf->f_namelen = EROFS_NAME_LEN;
|
|
|
|
|
2024-04-09 19:30:22 +08:00
|
|
|
if (uuid_is_null(&sb->s_uuid))
|
erofs: add file-backed mount support
It actually has been around for years: For containers and other sandbox
use cases, there will be thousands (and even more) of authenticated
(sub)images running on the same host, unlike OS images.
Of course, all scenarios can use the same EROFS on-disk format, but
bdev-backed mounts just work well for OS images since golden data is
dumped into real block devices. However, it's somewhat hard for
container runtimes to manage and isolate so many unnecessary virtual
block devices safely and efficiently [1]: they just look like a burden
to orchestrators and file-backed mounts are preferred indeed. There
were already enough attempts such as Incremental FS, the original
ComposeFS and PuzzleFS acting in the same way for immutable fses. As
for current EROFS users, ComposeFS, containerd and Android APEXs will
be directly benefited from it.
On the other hand, previous experimental feature "erofs over fscache"
was once also intended to provide a similar solution (inspired by
Incremental FS discussion [2]), but the following facts show file-backed
mounts will be a better approach:
- Fscache infrastructure has recently been moved into new Netfslib
which is an unexpected dependency to EROFS really, although it
originally claims "it could be used for caching other things such as
ISO9660 filesystems too." [3]
- It takes an unexpectedly long time to upstream Fscache/Cachefiles
enhancements. For example, the failover feature took more than
one year, and the deamonless feature is still far behind now;
- Ongoing HSM "fanotify pre-content hooks" [4] together with this will
perfectly supersede "erofs over fscache" in a simpler way since
developers (mainly containerd folks) could leverage their existing
caching mechanism entirely in userspace instead of strictly following
the predefined in-kernel caching tree hierarchy.
After "fanotify pre-content hooks" lands upstream to provide the same
functionality, "erofs over fscache" will be removed then (as an EROFS
internal improvement and EROFS will not have to bother with on-demand
fetching and/or caching improvements anymore.)
[1] https://github.com/containers/storage/pull/2039
[2] https://lore.kernel.org/r/CAOQ4uxjbVxnubaPjVaGYiSwoGDTdpWbB=w_AeM6YM=zVixsUfQ@mail.gmail.com
[3] https://docs.kernel.org/filesystems/caching/fscache.html
[4] https://lore.kernel.org/r/cover.1723670362.git.josef@toxicpanda.com
Closes: https://github.com/containers/composefs/issues/144
Reviewed-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240830032840.3783206-1-hsiangkao@linux.alibaba.com
2024-08-30 11:28:37 +08:00
|
|
|
buf->f_fsid = u64_to_fsid(!sb->s_bdev ? 0 :
|
2024-04-09 19:30:22 +08:00
|
|
|
huge_encode_dev(sb->s_bdev->bd_dev));
|
|
|
|
else
|
|
|
|
buf->f_fsid = uuid_to_fsid(sb->s_uuid.b);
|
2018-07-26 20:21:46 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int erofs_show_options(struct seq_file *seq, struct dentry *root)
|
|
|
|
{
|
2021-08-05 08:36:00 +08:00
|
|
|
struct erofs_sb_info *sbi = EROFS_SB(root->d_sb);
|
2021-10-07 15:02:23 +08:00
|
|
|
struct erofs_mount_opts *opt = &sbi->opt;
|
2018-07-26 20:21:52 +08:00
|
|
|
|
2024-05-17 17:56:52 +08:00
|
|
|
if (IS_ENABLED(CONFIG_EROFS_FS_XATTR))
|
|
|
|
seq_puts(seq, test_opt(opt, XATTR_USER) ?
|
|
|
|
",user_xattr" : ",nouser_xattr");
|
|
|
|
if (IS_ENABLED(CONFIG_EROFS_FS_POSIX_ACL))
|
|
|
|
seq_puts(seq, test_opt(opt, POSIX_ACL) ? ",acl" : ",noacl");
|
|
|
|
if (IS_ENABLED(CONFIG_EROFS_FS_ZIP))
|
|
|
|
seq_printf(seq, ",cache_strategy=%s",
|
|
|
|
erofs_param_cache_strategy[opt->cache_strategy].name);
|
2021-10-07 15:02:23 +08:00
|
|
|
if (test_opt(opt, DAX_ALWAYS))
|
2021-08-05 08:36:00 +08:00
|
|
|
seq_puts(seq, ",dax=always");
|
2021-10-07 15:02:23 +08:00
|
|
|
if (test_opt(opt, DAX_NEVER))
|
2021-08-05 08:36:00 +08:00
|
|
|
seq_puts(seq, ",dax=never");
|
2022-04-25 20:21:43 +08:00
|
|
|
#ifdef CONFIG_EROFS_FS_ONDEMAND
|
2022-10-21 10:31:53 +08:00
|
|
|
if (sbi->fsid)
|
|
|
|
seq_printf(seq, ",fsid=%s", sbi->fsid);
|
|
|
|
if (sbi->domain_id)
|
|
|
|
seq_printf(seq, ",domain_id=%s", sbi->domain_id);
|
2022-04-25 20:21:43 +08:00
|
|
|
#endif
|
2018-07-26 20:21:46 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct super_operations erofs_sops = {
|
|
|
|
.put_super = erofs_put_super,
|
2019-09-04 10:09:05 +08:00
|
|
|
.alloc_inode = erofs_alloc_inode,
|
|
|
|
.free_inode = erofs_free_inode,
|
2018-07-26 20:21:46 +08:00
|
|
|
.statfs = erofs_statfs,
|
|
|
|
.show_options = erofs_show_options,
|
|
|
|
};
|
|
|
|
|
|
|
|
module_init(erofs_module_init);
|
|
|
|
module_exit(erofs_module_exit);
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("Enhanced ROM File System");
|
2019-07-31 23:57:51 +08:00
|
|
|
MODULE_AUTHOR("Gao Xiang, Chao Yu, Miao Xie, CONSUMER BG, HUAWEI Inc.");
|
2018-07-26 20:21:46 +08:00
|
|
|
MODULE_LICENSE("GPL");
|