diff options
author | Jeffle Xu <jefflexu@linux.alibaba.com> | 2022-04-25 20:21:39 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2022-05-18 00:11:20 +0800 |
commit | 5375e7c8b0fef11645657384fe1f2cfed1e0baa7 (patch) | |
tree | 3a58710dd714fb821205a22adfcbcaea2ded5f38 /fs/erofs/fscache.c | |
parent | 955b478e1b4ad5530cd10395d56d45119d3a3ff4 (diff) | |
download | lwn-5375e7c8b0fef11645657384fe1f2cfed1e0baa7.tar.gz lwn-5375e7c8b0fef11645657384fe1f2cfed1e0baa7.zip |
erofs: implement fscache-based metadata read
Implement the data plane of reading metadata from primary data blob
over fscache.
Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220425122143.56815-18-jefflexu@linux.alibaba.com
Acked-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'fs/erofs/fscache.c')
-rw-r--r-- | fs/erofs/fscache.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index ac02af8cce3e..23d7e862eed8 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -59,7 +59,32 @@ out: return ret; } +static int erofs_fscache_meta_readpage(struct file *data, struct page *page) +{ + int ret; + struct folio *folio = page_folio(page); + struct super_block *sb = folio_mapping(folio)->host->i_sb; + struct erofs_map_dev mdev = { + .m_deviceid = 0, + .m_pa = folio_pos(folio), + }; + + ret = erofs_map_dev(sb, &mdev); + if (ret) + goto out; + + ret = erofs_fscache_read_folios(mdev.m_fscache->cookie, + folio_mapping(folio), folio_pos(folio), + folio_size(folio), mdev.m_pa); + if (!ret) + folio_mark_uptodate(folio); +out: + folio_unlock(folio); + return ret; +} + static const struct address_space_operations erofs_fscache_meta_aops = { + .readpage = erofs_fscache_meta_readpage, }; int erofs_fscache_register_cookie(struct super_block *sb, |