Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp71746pxh; Thu, 7 Apr 2022 14:19:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkgVxrRnHOmAiOwFo5EDSBfL8jhODoZlOzWAJNrm1EYqCSol0snQO+eoArDmwtTAIabeR4 X-Received: by 2002:a17:902:f612:b0:14c:e978:f99e with SMTP id n18-20020a170902f61200b0014ce978f99emr16005927plg.23.1649366365656; Thu, 07 Apr 2022 14:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649366365; cv=none; d=google.com; s=arc-20160816; b=h94ddZ/YN3sjUCM2bD9HXxmzeP0CDk7l/wRH5QsydPVRtGiEPQ/8VB55swG/b9qt0A T72OHvOGXB9BMRzyMWh8kWKtFo0WUa0sUufyiDBgBTS48lbGyLsUc41BXZvhudOarslB NBdMx2K220SVfcRqDssxbn5IOnw9/dx1a0S7OSm+umpJpq1gSeYQKcE3mBBxpJ69PAFw lwbMYexOR9B2vqbcybPdEXBM/X8aiSI+nbqVFq9Sl7pTd35PFL+PIGdToBFh1KtIycrz wTSpIhCvOPEO1XLdST8Zioczg/CgjqZBda8xMvazHDWv8Pk/RI8l/QDCPdyK/NCS49S1 LulA== 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 :dkim-signature; bh=7BggRxI9MJ49VOXSebe62Ja88T+W6ZvqwygTFAuwirA=; b=HMEIVGUF38n+Dzuz+sDDuHswp3B+D+jB5xE/5qFG5T6cCKFKZWP9A038l7xkHuivbm 90hLVaZoa1dh1wtP7czs9HrZ6qL78h/TuBL1RQAyTiHDhkV8ZCnk5v7UpLOvDb0bvjl4 gXKYuuueMVvyxU2k+8/YpCWQx/FMWeQ6c4OXfGJ/3d4bolom34d5444r1UmTSJqjrrAf dr2kRCT5kqbOj6LuA2mcMszmWp6h5Y3AEobV+kaF8LqqtpeaAf1hR/9tq2+yJ9v5+z/e hj3gVSVtkNIySQVhFBe+KfDdqlnf0nQ6vGG5m+Hgnn0pyDskZ50Igz99Pl/2lU1pV0V6 neHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=inxngaAv; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id lp11-20020a17090b4a8b00b001bd14e030a2si2971765pjb.122.2022.04.07.14.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 14:19:25 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=inxngaAv; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A6BCB478A65; Thu, 7 Apr 2022 13:11:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344008AbiDGOeP (ORCPT + 99 others); Thu, 7 Apr 2022 10:34:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343977AbiDGOeG (ORCPT ); Thu, 7 Apr 2022 10:34:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B68D31A4D55; Thu, 7 Apr 2022 07:32:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4985161CC0; Thu, 7 Apr 2022 14:32:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20DF6C385A0; Thu, 7 Apr 2022 14:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649341922; bh=1mo8AG4FIR1/02YpFR4zJU4OcpMYkIGir1YVgUBVtjM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=inxngaAvGk4ci4lL9D9ebkrGzcMpUuh0DxcHhPClkg9ctSXRjUR+WDfkTT1nVwwAt hTrjaa7ywrI4/z+Mzm+XFo7OKykHYTfaUGj9wY6tvuuVo5glndB2vBfM/6JZonyuAx us5csSm0foMRHB+fOnpT5tBy1jPaDO5maUHCK/jHcRUVWv2veIyZCSIvWSH3/Vly0Z WCZLy6y3URLTMcrRfaTGyhEWrYjAAMEMMcWdXEuMlADTwGpCHCb/gx9Ir3dgYHZiLg ouQpoqYiFYo4txOAeu9SJj2Jhc++HixksTam/lMcrGo9TaGLIFS002BA17+j2kcood 8fQvGjtOcWTCg== Date: Thu, 7 Apr 2022 22:31:54 +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 Subject: Re: [PATCH v8 18/20] 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 References: <20220406075612.60298-1-jefflexu@linux.alibaba.com> <20220406075612.60298-19-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220406075612.60298-19-jefflexu@linux.alibaba.com> X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Wed, Apr 06, 2022 at 03:56:10PM +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 > --- > fs/erofs/fscache.c | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > > diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c > index 65de1c754e80..d32cb5840c6d 100644 > --- a/fs/erofs/fscache.c > +++ b/fs/erofs/fscache.c > @@ -60,6 +60,40 @@ 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 inode *inode = folio_file_mapping(folio)->host; > + struct super_block *sb = inode->i_sb; > + struct erofs_buf buf = __EROFS_BUF_INITIALIZER; > + erofs_blk_t blknr; > + size_t offset, len; > + void *src, *dst; > + > + /* > + * For inline (tail packing) layout, the offset may be non-zero, which > + * can be calculated from corresponding physical address directly. > + */ > + 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); > + > + DBG_BUGON(folio_size(folio) != PAGE_SIZE); > + > + dst = kmap(folio_page(folio, 0)); kmap_local_folio? > + memcpy(dst, src + offset, len); > + memset(dst + len, 0, PAGE_SIZE - len); > + kunmap(folio_page(folio, 0)); > + > + erofs_put_metabuf(&buf); > + > + return 0; > +} > + > static int erofs_fscache_readpage(struct file *file, struct page *page) > { > struct folio *folio = page_folio(page); > @@ -85,6 +119,12 @@ static int erofs_fscache_readpage(struct file *file, struct page *page) > goto out_uptodate; > } > > + /* inline readpage */ I think the code below is self-explained. > + if (map.m_flags & EROFS_MAP_META) { > + ret = erofs_fscache_readpage_inline(folio, &map); > + goto out_uptodate; > + } > + > /* no-inline readpage */ Same here. Thanks, Gao Xiang > mdev = (struct erofs_map_dev) { > .m_deviceid = map.m_deviceid, > -- > 2.27.0 >