erofs: make iov_iter describe target buffers over fscache
authorJingbo Xu <jefflexu@linux.alibaba.com>
Fri, 8 Mar 2024 09:41:58 +0000 (17:41 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Sun, 10 Mar 2024 10:41:32 +0000 (18:41 +0800)
commitf2151df5743536e0b98a2094bd58b52d4e060016
tree8049d839331d1fcab16dad71ae00bf88f07e3b51
parent0f28be64d132aaf95d06375c8002ad9ecea69d71
erofs: make iov_iter describe target buffers over fscache

So far the fscache mode supports uncompressed data only, and the data
read from fscache is put directly into the target page cache.  As the
support for compressed data in fscache mode is going to be introduced,
rework the fscache internals so that the following compressed part
could make the raw data read from fscache be directed to the target
buffer it wants, decompress the raw data, and finally fill the page
cache with the decompressed data.

As the first step, a new structure, i.e. erofs_fscache_io (io), is
introduced to describe a generic read request from the fscache, while
the caller can specify the target buffer it wants in the iov_iter
structure (io->iter).  Besides, the caller can also specify its
completion callback and private data through erofs_fscache_io, which
will be called to make further handling, e.g. unlocking the page cache
for uncompressed data or decompressing the read raw data, when the read
request from the fscache completes.  Now erofs_fscache_read_io_async()
serves as a generic interface for reading raw data from fscache for both
compressed and uncompressed data.

The erofs_fscache_rq structure is kept to describe a request to fill the
page cache in the specified range.

Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240308094159.40547-1-jefflexu@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/erofs/fscache.c