Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp277274pxb; Fri, 22 Apr 2022 00:01:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLZcxWsfbuUTTg4GucGDxvU+sY/rrC+2X+kXuF9EZEhUsXQxlLuMMXlXaXqO8brIces1rv X-Received: by 2002:a65:6e88:0:b0:39d:2647:f75d with SMTP id bm8-20020a656e88000000b0039d2647f75dmr2762716pgb.523.1650610913615; Fri, 22 Apr 2022 00:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650610913; cv=none; d=google.com; s=arc-20160816; b=srBx17Wydo5JARslVEyQdKhyY1jNsAU0hrDV5TZaTwxgd89MATYNevLwDTipHvQA+s mISVoKLKkQZORuMBIg9WgiNw984UG79n2ct5WzH6TGiUxcVexr/if3iig2EHosvIqgBR OSJ0HyDNC7q5meyEgghwmTmtwUYkzP5pwPwHcyKWhOrOe+xcCMvjeelYdbKSmkuX0Kto TZ/6LS0k0DnwgzmvwBGRn3Q+PMEWKPJWL6KunkgeHRzM+JR8w4xwGh3pQHQPGxFi86fv TVK5hjIsd9GOmyIRWo2wxZEYNA7EPiQBUYygSljJ68MF7dFWHLwnfytWQ/SjMJukIKQW 4XAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date; bh=vByImROgTLraNXDTooaCfhgAssvz+MTCVUPcKdqbrJM=; b=bDGPyx16/FiRq/VqfuKfK7zD1Ydo7dFUmqwR3ar9UcVSYV1hcp8k2C2hafgzi9yZuJ NnTehmOx/oQS6TEAAPLFpxy5g6Knj8qjEe4949eXNXztOB4WOscyvitrFdy5WKb3v71t mxojBnqV7CVij+pN+o/n/FD23noSGozv5b43pavNto57rEpwKOVn6jFqBYNexreCTnH7 cwN361tagZAgTgJONPGxinxc/H9bU6r8nDIwgKxSChhrgQ8+P3jWwYrAWiA5grLLFoCe wsIGccdamEhx9wezwEnVV8B1rqgC37m2Hsk87glthdOnlHhDCpMrdrKEKf1AgrGwNPfS SYBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x15-20020a63b20f000000b003a8374eaad2si8003280pge.764.2022.04.22.00.01.35; Fri, 22 Apr 2022 00:01:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344830AbiDULR4 (ORCPT + 99 others); Thu, 21 Apr 2022 07:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388767AbiDULRh (ORCPT ); Thu, 21 Apr 2022 07:17:37 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC33D25E82; Thu, 21 Apr 2022 04:14:47 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0VAeULot_1650539681; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VAeULot_1650539681) by smtp.aliyun-inc.com(127.0.0.1); Thu, 21 Apr 2022 19:14:43 +0800 Date: Thu, 21 Apr 2022 19:14:40 +0800 From: Gao Xiang To: Jeffle Xu Cc: dhowells@redhat.com, linux-cachefs@redhat.com, xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, torvalds@linux-foundation.org, gregkh@linuxfoundation.org, willy@infradead.org, linux-fsdevel@vger.kernel.org, joseph.qi@linux.alibaba.com, bo.liu@linux.alibaba.com, tao.peng@linux.alibaba.com, gerry@linux.alibaba.com, eguan@linux.alibaba.com, linux-kernel@vger.kernel.org, luodaowen.backend@bytedance.com, tianzichen@kuaishou.com, fannaihao@baidu.com, zhangjiachen.jaycee@bytedance.com Subject: Re: [PATCH v9 19/21] erofs: implement fscache-based data read for inline layout Message-ID: Mail-Followup-To: Jeffle Xu , dhowells@redhat.com, linux-cachefs@redhat.com, xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, torvalds@linux-foundation.org, gregkh@linuxfoundation.org, willy@infradead.org, linux-fsdevel@vger.kernel.org, joseph.qi@linux.alibaba.com, bo.liu@linux.alibaba.com, tao.peng@linux.alibaba.com, gerry@linux.alibaba.com, eguan@linux.alibaba.com, linux-kernel@vger.kernel.org, luodaowen.backend@bytedance.com, tianzichen@kuaishou.com, fannaihao@baidu.com, zhangjiachen.jaycee@bytedance.com References: <20220415123614.54024-1-jefflexu@linux.alibaba.com> <20220415123614.54024-20-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220415123614.54024-20-jefflexu@linux.alibaba.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 15, 2022 at 08:36:12PM +0800, Jeffle Xu wrote: > Implement the data plane of reading data from data blobs over fscache > for inline layout. > > For the heading non-inline part, the data plane for non-inline layout is > reused, while only the tail packing part needs special handling. > > Signed-off-by: Jeffle Xu Reviewed-by: Gao Xiang Thanks, Gao Xiang > --- > fs/erofs/fscache.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c > index b799b0fe1b67..08849c15500f 100644 > --- a/fs/erofs/fscache.c > +++ b/fs/erofs/fscache.c > @@ -84,6 +84,33 @@ static int erofs_fscache_meta_readpage(struct file *data, struct page *page) > return ret; > } > > +static int erofs_fscache_readpage_inline(struct folio *folio, > + struct erofs_map_blocks *map) > +{ > + struct super_block *sb = folio_mapping(folio)->host->i_sb; > + struct erofs_buf buf = __EROFS_BUF_INITIALIZER; > + erofs_blk_t blknr; > + size_t offset, len; > + void *src, *dst; > + > + /* For tail packing layout, the offset may be non-zero. */ > + offset = erofs_blkoff(map->m_pa); > + blknr = erofs_blknr(map->m_pa); > + len = map->m_llen; > + > + src = erofs_read_metabuf(&buf, sb, blknr, EROFS_KMAP); > + if (IS_ERR(src)) > + return PTR_ERR(src); > + > + dst = kmap_local_folio(folio, 0); > + memcpy(dst, src + offset, len); > + memset(dst + len, 0, PAGE_SIZE - len); > + kunmap_local(dst); > + > + erofs_put_metabuf(&buf); > + return 0; > +} > + > static int erofs_fscache_readpage(struct file *file, struct page *page) > { > struct folio *folio = page_folio(page); > @@ -109,6 +136,11 @@ static int erofs_fscache_readpage(struct file *file, struct page *page) > goto out_uptodate; > } > > + if (map.m_flags & EROFS_MAP_META) { > + ret = erofs_fscache_readpage_inline(folio, &map); > + goto out_uptodate; > + } > + > mdev = (struct erofs_map_dev) { > .m_deviceid = map.m_deviceid, > .m_pa = map.m_pa, > -- > 2.27.0