diff options
author | Gao Xiang <hsiangkao@linux.alibaba.com> | 2022-01-02 12:00:17 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2022-01-04 23:47:36 +0800 |
commit | 09c543798c3cde19aae575a0f76d5fc7c130ff18 (patch) | |
tree | 644f73c442b0dfc42a6609c693e1ff6162669426 /fs/erofs/zdata.c | |
parent | bb88e8da00253bea0e7f0f4cdfd7910572d7799f (diff) |
erofs: use meta buffers for zmap operations
Get rid of old erofs_get_meta_page() within zmap operations by
using on-stack meta buffers in order to prepare subpage and folio
features.
Finally, erofs_get_meta_page() is useless. Get rid of it!
Link: https://lore.kernel.org/r/20220102040017.51352-6-hsiangkao@linux.alibaba.com
Reviewed-by: Yue Hu <huyue2@yulong.com>
Reviewed-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'fs/erofs/zdata.c')
-rw-r--r-- | fs/erofs/zdata.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 49da3931b2e3..498b7666efe8 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -698,20 +698,18 @@ restart_now: goto err_out; if (z_erofs_is_inline_pcluster(clt->pcl)) { - struct page *mpage; + void *mp; - mpage = erofs_get_meta_page(inode->i_sb, - erofs_blknr(map->m_pa)); - if (IS_ERR(mpage)) { - err = PTR_ERR(mpage); + mp = erofs_read_metabuf(&fe->map.buf, inode->i_sb, + erofs_blknr(map->m_pa), EROFS_NO_KMAP); + if (IS_ERR(mp)) { + err = PTR_ERR(mp); erofs_err(inode->i_sb, "failed to get inline page, err %d", err); goto err_out; } - /* TODO: new subpage feature will get rid of it */ - unlock_page(mpage); - - WRITE_ONCE(clt->pcl->compressed_pages[0], mpage); + get_page(fe->map.buf.page); + WRITE_ONCE(clt->pcl->compressed_pages[0], fe->map.buf.page); clt->mode = COLLECT_PRIMARY_FOLLOWED_NOINPLACE; } else { /* preload all compressed pages (can change mode if needed) */ @@ -1529,9 +1527,7 @@ static int z_erofs_readpage(struct file *file, struct page *page) if (err) erofs_err(inode->i_sb, "failed to read, err [%d]", err); - if (f.map.mpage) - put_page(f.map.mpage); - + erofs_put_metabuf(&f.map.buf); erofs_release_pages(&pagepool); return err; } @@ -1576,8 +1572,7 @@ static void z_erofs_readahead(struct readahead_control *rac) z_erofs_runqueue(inode->i_sb, &f, &pagepool, z_erofs_get_sync_decompress_policy(sbi, nr_pages)); - if (f.map.mpage) - put_page(f.map.mpage); + erofs_put_metabuf(&f.map.buf); erofs_release_pages(&pagepool); } |