On Thu, Aug 29, 2024 at 8:29 PM Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx> wrote:
Hi Gao,
Since EROFS only needs to handle read requests in simple contexts,
Just directly use vfs_iocb_iter_read() for data I/Os.
Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>
---
v2:
- fix redundant refcount which cause hanging on chunked inodes.
fs/erofs/Makefile | 1 +
fs/erofs/data.c | 50 +++++++++++-
fs/erofs/fileio.c | 181 ++++++++++++++++++++++++++++++++++++++++++++
fs/erofs/inode.c | 17 +++--
fs/erofs/internal.h | 7 +-
fs/erofs/zdata.c | 46 ++---------
6 files changed, 251 insertions(+), 51 deletions(-)
create mode 100644 fs/erofs/fileio.c
diff --git a/fs/erofs/Makefile b/fs/erofs/Makefile
index 097d672e6b14..4331d53c7109 100644
--- a/fs/erofs/Makefile
+++ b/fs/erofs/Makefile
@@ -7,4 +7,5 @@ erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o zutil.o
erofs-$(CONFIG_EROFS_FS_ZIP_LZMA) += decompressor_lzma.o
erofs-$(CONFIG_EROFS_FS_ZIP_DEFLATE) += decompressor_deflate.o
erofs-$(CONFIG_EROFS_FS_ZIP_ZSTD) += decompressor_zstd.o
+erofs-$(CONFIG_EROFS_FS_BACKED_BY_FILE) += fileio.o
erofs-$(CONFIG_EROFS_FS_ONDEMAND) += fscache.o
diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index 0fb31c588ae0..b4c07ce7a294 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -132,7 +132,7 @@ int erofs_map_blocks(struct inode *inode, struct erofs_map_blocks *map)
if (map->m_la >= inode->i_size) {
/* leave out-of-bound access unmapped */
map->m_flags = 0;
- map->m_plen = 0;
+ map->m_plen = map->m_llen;
Is this change intentional? At out label, we set this again as err is 0.