From: Yue Hu <zbestahu@gmail.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>
Cc: linux-erofs@lists.ozlabs.org, Chao Yu <chao@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
zhangwen@coolpad.com
Subject: Re: [PATCH 03/16] erofs: introduce `z_erofs_parse_out_bvecs()'
Date: Fri, 15 Jul 2022 14:22:53 +0800 [thread overview]
Message-ID: <20220715142253.00005239.zbestahu@gmail.com> (raw)
In-Reply-To: <20220714132051.46012-4-hsiangkao@linux.alibaba.com>
On Thu, 14 Jul 2022 21:20:38 +0800
Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
> `z_erofs_decompress_pcluster()' is too long therefore it'd be better
> to introduce another helper to parse decompressed pages (or laterly,
> decompressed bvecs.)
>
> BTW, since `decompressed_bvecs' is too long as a part of the function
> name, `out_bvecs' is used instead.
>
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
> fs/erofs/zdata.c | 81 +++++++++++++++++++++++++-----------------------
> 1 file changed, 43 insertions(+), 38 deletions(-)
>
> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> index c7be447ac64d..c183cd0bc42b 100644
> --- a/fs/erofs/zdata.c
> +++ b/fs/erofs/zdata.c
> @@ -778,18 +778,58 @@ static bool z_erofs_page_is_invalidated(struct page *page)
> return !page->mapping && !z_erofs_is_shortlived_page(page);
> }
>
> +static int z_erofs_parse_out_bvecs(struct z_erofs_pcluster *pcl,
> + struct page **pages, struct page **pagepool)
> +{
> + struct z_erofs_pagevec_ctor ctor;
> + enum z_erofs_page_type page_type;
> + int i, err = 0;
> +
> + z_erofs_pagevec_ctor_init(&ctor, Z_EROFS_NR_INLINE_PAGEVECS,
> + pcl->pagevec, 0);
> + for (i = 0; i < pcl->vcnt; ++i) {
> + struct page *page = z_erofs_pagevec_dequeue(&ctor, &page_type);
> + unsigned int pagenr;
> +
> + /* all pages in pagevec ought to be valid */
> + DBG_BUGON(!page);
> + DBG_BUGON(z_erofs_page_is_invalidated(page));
> +
> + if (z_erofs_put_shortlivedpage(pagepool, page))
> + continue;
> +
> + if (page_type == Z_EROFS_VLE_PAGE_TYPE_HEAD)
> + pagenr = 0;
> + else
> + pagenr = z_erofs_onlinepage_index(page);
> +
> + DBG_BUGON(pagenr >= pcl->nr_pages);
> + /*
> + * currently EROFS doesn't support multiref(dedup),
> + * so here erroring out one multiref page.
> + */
> + if (pages[pagenr]) {
> + DBG_BUGON(1);
> + SetPageError(pages[pagenr]);
> + z_erofs_onlinepage_endio(pages[pagenr]);
> + err = -EFSCORRUPTED;
> + }
> + pages[pagenr] = page;
> + }
> + z_erofs_pagevec_ctor_exit(&ctor, true);
> + return err;
> +}
> +
> static int z_erofs_decompress_pcluster(struct super_block *sb,
> struct z_erofs_pcluster *pcl,
> struct page **pagepool)
> {
> struct erofs_sb_info *const sbi = EROFS_SB(sb);
> unsigned int pclusterpages = z_erofs_pclusterpages(pcl);
> - struct z_erofs_pagevec_ctor ctor;
> unsigned int i, inputsize, outputsize, llen, nr_pages;
> struct page *pages_onstack[Z_EROFS_VMAP_ONSTACK_PAGES];
> struct page **pages, **compressed_pages, *page;
>
> - enum z_erofs_page_type page_type;
> bool overlapped, partial;
> int err;
>
> @@ -823,42 +863,7 @@ static int z_erofs_decompress_pcluster(struct super_block *sb,
> for (i = 0; i < nr_pages; ++i)
> pages[i] = NULL;
>
> - err = 0;
> - z_erofs_pagevec_ctor_init(&ctor, Z_EROFS_NR_INLINE_PAGEVECS,
> - pcl->pagevec, 0);
> -
> - for (i = 0; i < pcl->vcnt; ++i) {
> - unsigned int pagenr;
> -
> - page = z_erofs_pagevec_dequeue(&ctor, &page_type);
> -
> - /* all pages in pagevec ought to be valid */
> - DBG_BUGON(!page);
> - DBG_BUGON(z_erofs_page_is_invalidated(page));
> -
> - if (z_erofs_put_shortlivedpage(pagepool, page))
> - continue;
> -
> - if (page_type == Z_EROFS_VLE_PAGE_TYPE_HEAD)
> - pagenr = 0;
> - else
> - pagenr = z_erofs_onlinepage_index(page);
> -
> - DBG_BUGON(pagenr >= nr_pages);
> -
> - /*
> - * currently EROFS doesn't support multiref(dedup),
> - * so here erroring out one multiref page.
> - */
> - if (pages[pagenr]) {
> - DBG_BUGON(1);
> - SetPageError(pages[pagenr]);
> - z_erofs_onlinepage_endio(pages[pagenr]);
> - err = -EFSCORRUPTED;
> - }
> - pages[pagenr] = page;
> - }
> - z_erofs_pagevec_ctor_exit(&ctor, true);
> + err = z_erofs_parse_out_bvecs(pcl, pages, pagepool);
>
> overlapped = false;
> compressed_pages = pcl->compressed_pages;
Reviewed-by: Yue Hu <huyue2@coolpad.com>
next prev parent reply other threads:[~2022-07-15 6:21 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 13:20 [PATCH 00/16] erofs: prepare for folios, duplication and kill PG_error Gao Xiang
2022-07-14 13:20 ` [PATCH 01/16] erofs: get rid of unneeded `inode', `map' and `sb' Gao Xiang
2022-07-15 6:20 ` Yue Hu
2022-07-14 13:20 ` [PATCH 02/16] erofs: clean up z_erofs_collector_begin() Gao Xiang
2022-07-15 6:22 ` Yue Hu
2022-07-14 13:20 ` [PATCH 03/16] erofs: introduce `z_erofs_parse_out_bvecs()' Gao Xiang
2022-07-15 6:22 ` Yue Hu [this message]
2022-07-14 13:20 ` [PATCH 04/16] erofs: introduce bufvec to store decompressed buffers Gao Xiang
2022-07-15 6:29 ` Yue Hu
2022-07-15 6:36 ` Gao Xiang
2022-07-14 13:20 ` [PATCH 05/16] erofs: drop the old pagevec approach Gao Xiang
2022-07-15 7:07 ` Yue Hu
2022-07-15 7:19 ` Gao Xiang
2022-07-15 7:45 ` Yue Hu
2022-07-14 13:20 ` [PATCH 06/16] erofs: introduce `z_erofs_parse_in_bvecs' Gao Xiang
2022-07-14 13:20 ` [PATCH 07/16] erofs: switch compressed_pages[] to bufvec Gao Xiang
2022-07-15 7:53 ` Yue Hu
2022-07-15 7:59 ` Gao Xiang
2022-07-14 13:20 ` [PATCH 08/16] erofs: rework online page handling Gao Xiang
2022-07-14 13:20 ` [PATCH 09/16] erofs: get rid of `enum z_erofs_page_type' Gao Xiang
2022-07-14 13:20 ` [PATCH 10/16] erofs: clean up `enum z_erofs_collectmode' Gao Xiang
2022-07-14 13:20 ` [PATCH 11/16] erofs: get rid of `z_pagemap_global' Gao Xiang
2022-07-14 13:20 ` [PATCH 12/16] erofs: introduce struct z_erofs_decompress_backend Gao Xiang
2022-07-14 13:20 ` [PATCH 13/16] erofs: try to leave (de)compressed_pages on stack if possible Gao Xiang
2022-07-14 13:20 ` [PATCH 14/16] erofs: introduce z_erofs_do_decompressed_bvec() Gao Xiang
2022-07-14 13:20 ` [PATCH 15/16] erofs: record the longest decompressed size in this round Gao Xiang
2022-07-14 13:20 ` [PATCH 16/16] erofs: introduce multi-reference pclusters (fully-referenced) Gao Xiang
2022-07-14 13:38 ` [PATCH 00/16] erofs: prepare for folios, duplication and kill PG_error Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220715142253.00005239.zbestahu@gmail.com \
--to=zbestahu@gmail.com \
--cc=chao@kernel.org \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zhangwen@coolpad.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox