<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }body { font-size: 14px; font-family: 'Microsoft YaHei UI'; color: rgb(0, 0, 0); line-height: 1.5; }</style>
</head>
<body>
<div><span></span>Hi, Gao Xiang,</div>
<hr style="width: 210px; height: 1px; display: none;" color="#b5c4df" size="1" align="left">
<div><span></span></div>
<blockquote style="margin-Top: 0px; margin-Bottom: 0px; margin-Left: 0.5em; margin-Right: inherit">
<div> </div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<div style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px">
<div><b>发件人:</b> <a href="mailto:hsiangkao@aol.com">Gao Xiang</a></div>
<div><b>发送时间:</b> 2020-10-17 13:16</div>
<div><b>收件人:</b> <a href="mailto:linux-erofs@lists.ozlabs.org">linux-erofs</a></div>
<div><b>抄送:</b> <a href="mailto:huangjianan@oppo.com">Huang Jianan</a>; <a href="mailto:bluce.liguifu@huawei.com">
Li Guifu</a>; <a href="mailto:bluce.lee@aliyun.com">Li Guifu</a>; <a href="mailto:chao@kernel.org">
Chao Yu</a>; <a href="mailto:guoweichao@oppo.com">Guo Weichao</a>; <a href="mailto:zhangshiming@oppo.com">
Zhang Shiming</a>; <a href="mailto:hsiangkao@aol.com">Gao Xiang</a></div>
<div><b>主题:</b> [WIP] [PATCH 04/12] erofs-utils: fuse: adjust larger extent handling</div>
</div>
</div>
<div>
<div>so more easy to understand.</div>
<div> </div>
<div>[ let's fold in to the original patch. ]</div>
<div>Cc: Huang Jianan <huangjianan@oppo.com></div>
<div>Signed-off-by: Gao Xiang <hsiangkao@aol.com></div>
<div>---</div>
<div>fuse/read.c | 13 +++++++++----</div>
<div>1 file changed, 9 insertions(+), 4 deletions(-)</div>
<div> </div>
<div>diff --git a/fuse/read.c b/fuse/read.c</div>
<div>index 0d0e3b0fa468..dd44adaa1c40 100644</div>
<div>--- a/fuse/read.c</div>
<div>+++ b/fuse/read.c</div>
<div>@@ -112,12 +112,17 @@ size_t erofs_read_data_compression(struct erofs_vnode *vnode, char *buffer,</div>
<div>Z_EROFS_COMPRESSION_LZ4 :</div>
<div>Z_EROFS_COMPRESSION_SHIFTED;</div>
<div></div>
<div>- if (end >= map.m_la + map.m_llen) {</div>
<div>- count = map.m_llen;</div>
<div>- partial = !(map.m_flags & EROFS_MAP_FULL_MAPPED);</div>
<div>- } else {</div>
<div>+ /*</div>
<div>+ * trim to the needed size if the returned extent is quite</div>
<div>+ * larger than requested, and set up partial flag as well.</div>
<div>+ */</div>
<div>+ if (end < map.m_la + map.m_llen) {</div>
<div>count = end - map.m_la;</div>
<div>partial = true;</div>
<div>+ } else {</div>
<div>+ ASSERT(end == map.m_la + map_m_llen);</div>
<div><br>
</div>
<div>I think you mean map.m_llen intesad of map_m_llen.</div>
<div><span style="font-family: Roboto, arial, sans-serif; font-size: 16px; font-variant-ligatures: normal; orphans: 2; white-space: nowrap; widows: 2;">Besides, I don't understand why add ASSERT here. </span></div>
<div><span style="font-family: Roboto, arial, sans-serif; font-size: 16px; orphans: 2; white-space: nowrap; widows: 2; line-height: 1.5; background-color: transparent;">I think this condition will be true if offset+size is exactly the end of a compressed block?</span></div>
<div><br>
</div>
<div>+ count = map.m_llen;</div>
<div>+ partial = !(map.m_flags & EROFS_MAP_FULL_MAPPED);</div>
<div>}</div>
<div></div>
<div>if ((off_t)map.m_la < offset) {</div>
<div>-- </div>
<div>2.24.0</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Jianan</div>
<div><br>
</div>
<div> </div>
</div>
</blockquote>
<hr>
<div style="font-size: 12px;"><strong style="color: rgb(0, 107, 55); font-family: ArialMT;">OPPO</strong></div>
<div style="font-size: 12px;"><strong style="color: rgb(0, 107, 55); font-family: ArialMT; font-size: 14px;"><span style="font-size: 12px;"><br>
</span></strong></div>
<div></div>
<div style="color: rgb(49, 53, 59); font-family: Helvetica; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 22.4px; widows: 1;">
<span style="color: rgb(202, 202, 200); font-family: ArialMT; font-size: 12px;">本电子邮件及其附件含有<span style="font-stretch: normal; line-height: normal;">OPPO</span>公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人在未经授权的情况下以任何形式使用。如果您错收了本邮件,</span><span style="font-family: ArialMT; color: rgb(202, 202, 200); font-size: 12px;">请立即以电子邮件通知发件人并删除本邮件及其附件。</span></div>
<div style="color: rgb(49, 53, 59); font-family: Helvetica; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 22.4px; widows: 1;">
<p style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 15px;">
<span style="color: rgb(202, 202, 200);"><span style="font-size: 12px; font-family: ArialMT;">This e-mail and its attachments contain confidential information from OPPO</span><span style="font-size: 12px; font-family: ArialMT; font-stretch: normal; line-height: normal;">,</span><span style="font-size: 12px; font-family: ArialMT;"> which
 is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way </span><span style="font-size: 12px; font-family: ArialMT; font-stretch: normal; line-height: normal;">(</span><span style="font-size: 12px; font-family: ArialMT;">including</span><span style="font-size: 12px; font-family: ArialMT; font-stretch: normal; line-height: normal;">,</span><span style="font-size: 12px; font-family: ArialMT;"> but
 not limited to</span><span style="font-size: 12px; font-family: ArialMT; font-stretch: normal; line-height: normal;">,</span><span style="font-size: 12px; font-family: ArialMT;"> total or partial disclosure</span><span style="font-size: 12px; font-family: ArialMT; font-stretch: normal; line-height: normal;">,</span><span style="font-size: 12px; font-family: ArialMT;"> reproduction</span><span style="font-size: 12px; font-family: ArialMT; font-stretch: normal; line-height: normal;">,</span><span style="font-size: 12px; font-family: ArialMT;"> or
 dissemination</span><span style="font-size: 12px; font-family: ArialMT; font-stretch: normal; line-height: normal;">)</span><span style="font-size: 12px; font-family: ArialMT;"> by persons other than the intended recipient</span><span style="font-size: 12px; font-family: ArialMT; font-stretch: normal; line-height: normal;">(</span><span style="font-size: 12px; font-family: ArialMT;">s</span><span style="font-size: 12px; font-family: ArialMT; font-stretch: normal; line-height: normal;">)</span><span style="font-size: 12px; font-family: ArialMT;"> is
 prohibited. If you receive this e-mail in error</span><span style="font-size: 12px; font-family: ArialMT; font-stretch: normal; line-height: normal;">,</span><span style="font-size: 12px; font-family: ArialMT;"> please notify the sender by phone or email immediately
 and delete it!</span></span></p>
</div>
<div></div>
</body>
</html>