From: Yue Hu <zbestahu@gmail.com>
To: Chunhai Guo <guochunhai@vivo.com>
Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org,
huyue2@coolpad.com
Subject: Re: [PATCH] erofs: avoid unnecessary loops in z_erofs_pcluster_readmore() when read page beyond EOF
Date: Mon, 10 Jul 2023 15:48:03 +0800 [thread overview]
Message-ID: <20230710154803.00004047.zbestahu@gmail.com> (raw)
In-Reply-To: <20230710042531.28761-1-guochunhai@vivo.com>
On Mon, 10 Jul 2023 12:25:31 +0800
Chunhai Guo <guochunhai@vivo.com> wrote:
> z_erofs_pcluster_readmore() may take a long time to loop when the page
> offset is large enough, which is unnecessary should be prevented.
> For example, when the following case is encountered, it will loop 4691368
> times, taking about 27 seconds.
> - offset = 19217289215
> - inode_size = 1442672
>
> Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
> ---
> fs/erofs/zdata.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> index 5f1890e309c6..d9a0763f4595 100644
> --- a/fs/erofs/zdata.c
> +++ b/fs/erofs/zdata.c
> @@ -1841,7 +1841,7 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f,
> }
>
> cur = map->m_la + map->m_llen - 1;
> - while (cur >= end) {
> + while ((cur >= end) && (cur < i_size_read(inode))) {
> pgoff_t index = cur >> PAGE_SHIFT;
> struct page *page;
>
Reviewed-by: Yue Hu <huyue2@coolpad.com>
WARNING: multiple messages have this Message-ID (diff)
From: Yue Hu <zbestahu@gmail.com>
To: Chunhai Guo <guochunhai@vivo.com>
Cc: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org,
linux-kernel@vger.kernel.org, huyue2@coolpad.com
Subject: Re: [PATCH] erofs: avoid unnecessary loops in z_erofs_pcluster_readmore() when read page beyond EOF
Date: Mon, 10 Jul 2023 15:48:03 +0800 [thread overview]
Message-ID: <20230710154803.00004047.zbestahu@gmail.com> (raw)
In-Reply-To: <20230710042531.28761-1-guochunhai@vivo.com>
On Mon, 10 Jul 2023 12:25:31 +0800
Chunhai Guo <guochunhai@vivo.com> wrote:
> z_erofs_pcluster_readmore() may take a long time to loop when the page
> offset is large enough, which is unnecessary should be prevented.
> For example, when the following case is encountered, it will loop 4691368
> times, taking about 27 seconds.
> - offset = 19217289215
> - inode_size = 1442672
>
> Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
> ---
> fs/erofs/zdata.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> index 5f1890e309c6..d9a0763f4595 100644
> --- a/fs/erofs/zdata.c
> +++ b/fs/erofs/zdata.c
> @@ -1841,7 +1841,7 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f,
> }
>
> cur = map->m_la + map->m_llen - 1;
> - while (cur >= end) {
> + while ((cur >= end) && (cur < i_size_read(inode))) {
> pgoff_t index = cur >> PAGE_SHIFT;
> struct page *page;
>
Reviewed-by: Yue Hu <huyue2@coolpad.com>
next prev parent reply other threads:[~2023-07-10 7:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-10 4:25 [PATCH] erofs: avoid unnecessary loops in z_erofs_pcluster_readmore() when read page beyond EOF Chunhai Guo
2023-07-10 4:25 ` Chunhai Guo
2023-07-10 4:40 ` Gao Xiang
2023-07-10 4:40 ` Gao Xiang
2023-07-10 7:48 ` Yue Hu [this message]
2023-07-10 7:48 ` Yue Hu
2023-07-10 10:41 ` Gao Xiang
2023-07-10 10:41 ` Gao Xiang
2023-07-11 13:56 ` Chao Yu
2023-07-11 13:56 ` 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=20230710154803.00004047.zbestahu@gmail.com \
--to=zbestahu@gmail.com \
--cc=guochunhai@vivo.com \
--cc=huyue2@coolpad.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.