From: Chao Yu <chao@kernel.org>
To: Gao Xiang <gaoxiang25@huawei.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Chao Yu <yuchao0@huawei.com>,
devel@driverdev.osuosl.org
Cc: Miao Xie <miaoxie@huawei.com>,
linux-erofs@lists.ozlabs.org, LKML <linux-kernel@vger.kernel.org>,
Du Wei <weidu.du@huawei.com>
Subject: Re: [PATCH 4/6] staging: erofs: cleanup `z_erofs_vle_normalaccess_readpages'
Date: Wed, 19 Sep 2018 23:26:14 +0800 [thread overview]
Message-ID: <1b38cbfe-70e0-1e6d-fa50-89b1fddeeb43@kernel.org> (raw)
In-Reply-To: <1537336150-90604-4-git-send-email-gaoxiang25@huawei.com>
Hi Xiang,
On 2018/9/19 13:49, Gao Xiang wrote:
> This patch introduces `__should_decompress_synchronously' to
> cleanup `z_erofs_vle_normalaccess_readpages'.
>
> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
> ---
> drivers/staging/erofs/internal.h | 11 +++++++++++
> drivers/staging/erofs/super.c | 5 +++++
> drivers/staging/erofs/unzip_vle.c | 20 ++++++--------------
> 3 files changed, 22 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h
> index cfcc6db..c84eb97 100644
> --- a/drivers/staging/erofs/internal.h
> +++ b/drivers/staging/erofs/internal.h
> @@ -95,6 +95,9 @@ struct erofs_sb_info {
> /* the dedicated workstation for compression */
> struct radix_tree_root workstn_tree;
>
> + /* threshold for decompression synchronously */
> + unsigned int max_sync_decompress_pages;
> +
> #ifdef EROFS_FS_HAS_MANAGED_CACHE
> struct inode *managed_cache;
> #endif
> @@ -273,6 +276,14 @@ extern int erofs_try_to_free_cached_page(struct address_space *mapping,
> struct page *page);
> #endif
>
> +#define DEFAULT_MAX_SYNC_DECOMPRESS_PAGES 4
> +
> +static inline bool __should_decompress_synchronously(struct erofs_sb_info *sbi,
> + unsigned int nr)
> +{
> + return nr <= sbi->max_sync_decompress_pages;
- nr_pages < 4 /* sync */);
There is a little bit changed except cleanup, IIUC, would it be any difference
of performance around boundary of four pages?
Thanks,
> +}
> +
> #endif
>
> /* we strictly follow PAGE_SIZE and no buffer head yet */
> diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
> index 802202c..5b87f59 100644
> --- a/drivers/staging/erofs/super.c
> +++ b/drivers/staging/erofs/super.c
> @@ -162,6 +162,11 @@ static void erofs_build_fault_attr(struct erofs_sb_info *sbi,
>
> static void default_options(struct erofs_sb_info *sbi)
> {
> + /* set up some FS parameters */
> +#ifdef CONFIG_EROFS_FS_ZIP
> + sbi->max_sync_decompress_pages = DEFAULT_MAX_SYNC_DECOMPRESS_PAGES;
> +#endif
> +
> #ifdef CONFIG_EROFS_FS_XATTR
> set_opt(sbi, XATTR_USER);
> #endif
> diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
> index 9fe18cd3..337a82d 100644
> --- a/drivers/staging/erofs/unzip_vle.c
> +++ b/drivers/staging/erofs/unzip_vle.c
> @@ -1308,12 +1308,14 @@ static int z_erofs_vle_normalaccess_readpage(struct file *file,
> return 0;
> }
>
> -static inline int __z_erofs_vle_normalaccess_readpages(
> - struct file *filp,
> - struct address_space *mapping,
> - struct list_head *pages, unsigned int nr_pages, bool sync)
> +static int z_erofs_vle_normalaccess_readpages(struct file *filp,
> + struct address_space *mapping,
> + struct list_head *pages,
> + unsigned int nr_pages)
> {
> struct inode *const inode = mapping->host;
> + struct erofs_sb_info *const sbi = EROFS_I_SB(inode);
> + const bool sync = __should_decompress_synchronously(sbi, nr_pages);
>
> struct z_erofs_vle_frontend f = VLE_FRONTEND_INIT(inode);
> gfp_t gfp = mapping_gfp_constraint(mapping, GFP_KERNEL);
> @@ -1372,16 +1374,6 @@ static inline int __z_erofs_vle_normalaccess_readpages(
> return 0;
> }
>
> -static int z_erofs_vle_normalaccess_readpages(
> - struct file *filp,
> - struct address_space *mapping,
> - struct list_head *pages, unsigned int nr_pages)
> -{
> - return __z_erofs_vle_normalaccess_readpages(filp,
> - mapping, pages, nr_pages,
> - nr_pages < 4 /* sync */);
> -}
> -
> const struct address_space_operations z_erofs_vle_normalaccess_aops = {
> .readpage = z_erofs_vle_normalaccess_readpage,
> .readpages = z_erofs_vle_normalaccess_readpages,
>
next prev parent reply other threads:[~2018-09-19 15:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-19 5:49 [PATCH 1/6] staging: erofs: remove redundant CONFIG_EROFS_FS_XATTRs Gao Xiang
2018-09-19 5:49 ` [PATCH 2/6] staging: erofs: fold in `__update_workgrp_llen' Gao Xiang
2018-09-19 15:14 ` Chao Yu
2018-09-19 5:49 ` [PATCH 3/6] staging: erofs: drop multiref support temporarily Gao Xiang
2018-09-19 15:20 ` Chao Yu
2018-09-19 5:49 ` [PATCH 4/6] staging: erofs: cleanup `z_erofs_vle_normalaccess_readpages' Gao Xiang
2018-09-19 15:26 ` Chao Yu [this message]
2018-09-19 15:32 ` Gao Xiang
2018-09-19 15:40 ` Gao Xiang
2018-09-19 15:45 ` Chao Yu
2018-09-19 15:51 ` Gao Xiang
2018-09-19 16:06 ` [PATCH v2 " Gao Xiang
2018-09-20 1:29 ` Chao Yu
2018-09-19 5:49 ` [PATCH 5/6] staging: erofs: add some comments for xattr subsystem Gao Xiang
2018-09-19 15:27 ` Chao Yu
2018-09-19 5:49 ` [PATCH 6/6] staging: erofs: simplify return value of `xattr_foreach' Gao Xiang
2018-09-19 15:28 ` Chao Yu
2018-09-19 15:07 ` [PATCH 1/6] staging: erofs: remove redundant CONFIG_EROFS_FS_XATTRs Chao Yu
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=1b38cbfe-70e0-1e6d-fa50-89b1fddeeb43@kernel.org \
--to=chao@kernel.org \
--cc=devel@driverdev.osuosl.org \
--cc=gaoxiang25@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miaoxie@huawei.com \
--cc=weidu.du@huawei.com \
--cc=yuchao0@huawei.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;
as well as URLs for NNTP newsgroup(s).