回复: [WIP] [PATCH 04/12] erofs-utils: fuse: adjust larger extent handling
Gao Xiang
hsiangkao at aol.com
Mon Oct 19 14:32:59 AEDT 2020
Hi Jianan,
On Mon, Oct 19, 2020 at 11:13:42AM +0800, huangjianan at oppo.com wrote:
> Hi, Gao Xiang锟斤拷
> ________________________________
>
> 锟斤拷锟斤拷锟剿o拷 Gao Xiang<mailto:hsiangkao at aol.com>
> 锟斤拷锟斤拷时锟戒: 2020-10-17 13:16
> 锟秸硷拷锟剿o拷 linux-erofs<mailto:linux-erofs at lists.ozlabs.org>
> 锟斤拷锟酵o拷 Huang Jianan<mailto:huangjianan at oppo.com>; Li Guifu<mailto:bluce.liguifu at huawei.com>; Li Guifu<mailto:bluce.lee at aliyun.com>; Chao Yu<mailto:chao at kernel.org>; Guo Weichao<mailto:guoweichao at oppo.com>; Zhang Shiming<mailto:zhangshiming at oppo.com>; Gao Xiang<mailto:hsiangkao at aol.com>
> 锟斤拷锟解: [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 <huangjianan at oppo.com>
> Signed-off-by: Gao Xiang <hsiangkao at aol.com>
> ---
> 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?
Thanks for your question.
The idea is that we requested the extent with
map.m_la = end - 1;
ret = z_erofs_map_blocks_iter(vnode, &map);
if (ret)
return ret;
so the extent must include "end - 1", so
it's impossible that "end > map.m_la + map.m_llen"
(invalid return).
or the entire extent would be holed extent, anyway,
that is another extent rather than a data extent.
(BTW, the up-to-date commits is at
https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/log/?h=wip/experimental_fuse
kindly check out them as well :) )
Thanks,
Gao Xiang
>
> + count = map.m_llen;
> + partial = !(map.m_flags & EROFS_MAP_FULL_MAPPED);
> }
> if ((off_t)map.m_la < offset) {
> --
> 2.24.0
>
> Thanks,
> Jianan
More information about the Linux-erofs
mailing list