Commit 2a00c97d authored by Hongbo Li's avatar Hongbo Li
Browse files

erofs: trio: Support TrIO feature in erofs

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/release-management/issues/IBK2MJ



--------------------------------

Add CONFIG_EROFS_TRIO to control the trio feature. For reading data, we
first check the data in trio. When the users want to use TrIO in erofs,
they should mount with @trio_meta and @trio_data options. The target
options is the valid path where the TrIO info stored. Erofs will parse
the TrIO info and build the runtime buffer for reading.

Signed-off-by: default avatarHongbo Li <lihongbo22@huawei.com>
parent 7d92b481
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7171,6 +7171,7 @@ CONFIG_EROFS_FS_POSIX_ACL=y
CONFIG_EROFS_FS_SECURITY=y
# CONFIG_EROFS_FS_ZIP is not set
CONFIG_EROFS_FS_ONDEMAND=y
# CONFIG_EROFS_TRIO is not set
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=m
CONFIG_NFS_V2=m
+1 −0
Original line number Diff line number Diff line
@@ -8349,6 +8349,7 @@ CONFIG_EROFS_FS_POSIX_ACL=y
CONFIG_EROFS_FS_SECURITY=y
# CONFIG_EROFS_FS_ZIP is not set
CONFIG_EROFS_FS_ONDEMAND=y
# CONFIG_EROFS_TRIO is not set
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=m
# CONFIG_NFS_V2 is not set
+11 −0
Original line number Diff line number Diff line
@@ -125,6 +125,17 @@ config EROFS_FS_ONDEMAND

	  If unsure, say N.

config EROFS_TRIO
	bool "EROFS TrIO support"
	depends on EROFS_FS_ONDEMAND
	default n
	help
	  If this config option is enabled then erofs trio will be enable.
	  This is used for container cases to boost on-demand loading for
	  container's images.

	  If unsure, say N.

config EROFS_FS_PCPU_KTHREAD
	bool "EROFS per-cpu decompression kthread workers"
	depends on EROFS_FS_ZIP
+1 −0
Original line number Diff line number Diff line
@@ -7,3 +7,4 @@ erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o pcpubuf.o
erofs-$(CONFIG_EROFS_FS_ZIP_LZMA) += decompressor_lzma.o
erofs-$(CONFIG_EROFS_FS_ZIP_DEFLATE) += decompressor_deflate.o
erofs-$(CONFIG_EROFS_FS_ONDEMAND) += fscache.o
erofs-$(CONFIG_EROFS_TRIO) += trio_manager.o
+21 −1
Original line number Diff line number Diff line
@@ -198,6 +198,21 @@ static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio)
	return ret;
}

static bool erofs_fscache_read_trio(struct erofs_fscache_request *primary)
{
	struct address_space *mapping = primary->mapping;
	loff_t pos = primary->start + primary->submitted;

	ssize_t ret = erofs_read_from_trio(mapping, pos,
					   primary->len - primary->submitted);
	if (ret > 0) {
		primary->submitted += ret;
		return true;
	}

	return false;
}

static int erofs_fscache_data_read_slice(struct erofs_fscache_request *primary)
{
	struct address_space *mapping = primary->mapping;
@@ -207,10 +222,15 @@ static int erofs_fscache_data_read_slice(struct erofs_fscache_request *primary)
	struct erofs_map_blocks map;
	struct erofs_map_dev mdev;
	struct iov_iter iter;
	loff_t pos = primary->start + primary->submitted;
	loff_t pos;
	size_t count;
	int ret;

	/* first try mapping in trio */
	if (erofs_fscache_read_trio(primary))
		return 0;

	pos = primary->start + primary->submitted;
	map.m_la = pos;
	ret = erofs_map_blocks(inode, &map);
	if (ret)
Loading