[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YdQNCJzQULVxC2QC@B-P7TQMD6M-0146.local>
Date: Tue, 4 Jan 2022 17:02:00 +0800
From: Gao Xiang <hsiangkao@...ux.alibaba.com>
To: Chao Yu <chao@...nel.org>
Cc: linux-erofs@...ts.ozlabs.org, Liu Bo <bo.liu@...ux.alibaba.com>,
LKML <linux-kernel@...r.kernel.org>, Yue Hu <huyue2@...ong.com>
Subject: Re: [PATCH v2 5/5] erofs: use meta buffers for zmap operations
Hi Chao,
On Tue, Jan 04, 2022 at 04:15:05PM +0800, Chao Yu wrote:
> On 2022/1/2 12:00, Gao Xiang wrote:
...
> > --- a/fs/erofs/zdata.c
> > +++ b/fs/erofs/zdata.c
> > @@ -698,20 +698,18 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
> > 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);
>
> Comparing to previous implementation, it adds an extra reference on the page, why?
Thanks for the question. Previously, erofs_get_meta_page was called
independently without reusing zmap mpage, so the page refcount had no
relationship with zmap mpage.
However, now we reuse zmap metabuf instead(fe->map.buf), so an extra
page refcount is needed since zmap metabuf will be released at the end
of readpage or readahead...
Thanks,
Gao Xiang
Powered by blists - more mailing lists