Hi, Gao Xiang,
________________________________

发件人: Gao Xiang<mailto:[email protected]>
发送时间: 2020-10-17 13:16
收件人: linux-erofs<mailto:[email protected]>
抄送: Huang Jianan<mailto:[email protected]>; Li 
Guifu<mailto:[email protected]>; Li Guifu<mailto:[email protected]>; 
Chao Yu<mailto:[email protected]>; Guo Weichao<mailto:[email protected]>; Zhang 
Shiming<mailto:[email protected]>; Gao Xiang<mailto:[email protected]>
主题: [WIP] [PATCH 04/12] erofs-utils: fuse: adjust larger extent handling
so more easy to understand.

[ let's fold in to the original patch. ]
Cc: Huang Jianan <[email protected]>
Signed-off-by: Gao Xiang <[email protected]>
---
fuse/read.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/fuse/read.c b/fuse/read.c
index 0d0e3b0fa468..dd44adaa1c40 100644
--- a/fuse/read.c
+++ b/fuse/read.c
@@ -112,12 +112,17 @@ size_t erofs_read_data_compression(struct erofs_vnode 
*vnode, char *buffer,
Z_EROFS_COMPRESSION_LZ4 :
Z_EROFS_COMPRESSION_SHIFTED;
- if (end >= map.m_la + map.m_llen) {
- count = map.m_llen;
- partial = !(map.m_flags & EROFS_MAP_FULL_MAPPED);
- } else {
+ /*
+ * trim to the needed size if the returned extent is quite
+ * larger than requested, and set up partial flag as well.
+ */
+ if (end < map.m_la + map.m_llen) {
count = end - map.m_la;
partial = true;
+ } else {
+ ASSERT(end == map.m_la + map_m_llen);

I think you mean map.m_llen intesad of map_m_llen.
Besides, I don't understand why add ASSERT here.
I think this condition will be true if offset+size is exactly the end of a 
compressed block?

+ count = map.m_llen;
+ partial = !(map.m_flags & EROFS_MAP_FULL_MAPPED);
}
if ((off_t)map.m_la < offset) {
--
2.24.0

Thanks,
Jianan


________________________________
OPPO

本电子邮件及其附件含有OPPO公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人在未经授权的情况下以任何形式使用。如果您错收了本邮件,请立即以电子邮件通知发件人并删除本邮件及其附件。

This e-mail and its attachments contain confidential information from OPPO, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!

Reply via email to