From: Yue Hu <zbestahu@gmail.com> To: xiang@kernel.org, chao@kernel.org Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, huyue2@yulong.com, zhangwen@yulong.com, zbestahu@163.com Subject: [PATCH] erofs: fix compacted_{4b_initial, 2b} when compacted_4b_initial > totalidx Date: Mon, 13 Sep 2021 15:24:05 +0800 [thread overview] Message-ID: <20210913072405.1128-1-zbestahu@gmail.com> (raw) From: Yue Hu <huyue2@yulong.com> mkfs.erofs will treat compacted_4b_initial & compacted_2b as 0 if compacted_4b_initial > totalidx, kernel should be aligned with it accordingly. Signed-off-by: Yue Hu <huyue2@yulong.com> --- fs/erofs/zmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index 9fb98d8..4f941b6 100644 --- a/fs/erofs/zmap.c +++ b/fs/erofs/zmap.c @@ -369,7 +369,10 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, if (compacted_4b_initial == 32 / 4) compacted_4b_initial = 0; - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) + if (compacted_4b_initial > totalidx) { + compacted_4b_initial = 0; + compacted_2b = 0; + } else if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); else compacted_2b = 0; -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Yue Hu <zbestahu@gmail.com> To: xiang@kernel.org, chao@kernel.org Cc: huyue2@yulong.com, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, zhangwen@yulong.com, zbestahu@163.com Subject: [PATCH] erofs: fix compacted_{4b_initial, 2b} when compacted_4b_initial > totalidx Date: Mon, 13 Sep 2021 15:24:05 +0800 [thread overview] Message-ID: <20210913072405.1128-1-zbestahu@gmail.com> (raw) From: Yue Hu <huyue2@yulong.com> mkfs.erofs will treat compacted_4b_initial & compacted_2b as 0 if compacted_4b_initial > totalidx, kernel should be aligned with it accordingly. Signed-off-by: Yue Hu <huyue2@yulong.com> --- fs/erofs/zmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index 9fb98d8..4f941b6 100644 --- a/fs/erofs/zmap.c +++ b/fs/erofs/zmap.c @@ -369,7 +369,10 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, if (compacted_4b_initial == 32 / 4) compacted_4b_initial = 0; - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) + if (compacted_4b_initial > totalidx) { + compacted_4b_initial = 0; + compacted_2b = 0; + } else if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); else compacted_2b = 0; -- 1.9.1
next reply other threads:[~2021-09-13 7:24 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-13 7:24 Yue Hu [this message] 2021-09-13 7:24 ` [PATCH] erofs: fix compacted_{4b_initial, 2b} when compacted_4b_initial > totalidx Yue Hu 2021-09-13 8:48 ` Gao Xiang 2021-09-13 8:48 ` Gao Xiang 2021-09-13 9:00 ` Yue Hu 2021-09-13 9:00 ` Yue Hu 2021-09-13 9:11 ` Gao Xiang 2021-09-13 9:11 ` Gao Xiang 2021-09-13 10:58 ` Yue Hu 2021-09-13 10:58 ` Yue Hu 2021-09-13 11:19 ` Gao Xiang 2021-09-13 11:19 ` Gao Xiang 2021-09-13 12:22 ` Yue Hu 2021-09-13 12:22 ` Yue Hu
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=20210913072405.1128-1-zbestahu@gmail.com \ --to=zbestahu@gmail.com \ --cc=chao@kernel.org \ --cc=huyue2@yulong.com \ --cc=linux-erofs@lists.ozlabs.org \ --cc=linux-kernel@vger.kernel.org \ --cc=xiang@kernel.org \ --cc=zbestahu@163.com \ --cc=zhangwen@yulong.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: linkBe 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.