Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 848F9C678D5 for ; Tue, 7 Mar 2023 08:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229685AbjCGIs5 (ORCPT ); Tue, 7 Mar 2023 03:48:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjCGIs4 (ORCPT ); Tue, 7 Mar 2023 03:48:56 -0500 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AB47199E3 for ; Tue, 7 Mar 2023 00:48:52 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VdKkhxZ_1678178928; Received: from 30.97.49.8(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VdKkhxZ_1678178928) by smtp.aliyun-inc.com; Tue, 07 Mar 2023 16:48:49 +0800 Message-ID: Date: Tue, 7 Mar 2023 16:48:47 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [LSF/MM/BFP TOPIC] Composefs vs erofs+overlay From: Gao Xiang To: Alexander Larsson Cc: Jingbo Xu , lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, Amir Goldstein , Christian Brauner , Giuseppe Scrivano , Dave Chinner , Vivek Goyal , Miklos Szeredi References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On 2023/3/7 16:33, Gao Xiang wrote: > > > On 2023/3/7 16:21, Alexander Larsson wrote: >> On Mon, Mar 6, 2023 at 5:17 PM Gao Xiang wrote: >> >>>>> I tested the performance of "ls -lR" on the whole tree of >>>>> cs9-developer-rootfs.  It seems that the performance of erofs (generated >>>>> from mkfs.erofs) is slightly better than that of composefs.  While the >>>>> performance of erofs generated from mkfs.composefs is slightly worse >>>>> that that of composefs. >>>> >>>> I suspect that the reason for the lower performance of mkfs.composefs >>>> is the added overlay.fs-verity xattr to all the files. It makes the >>>> image larger, and that means more i/o. >>> >>> Actually you could move overlay.fs-verity to EROFS shared xattr area (or >>> even overlay.redirect but it depends) if needed, which could save some >>> I/Os for your workloads. >>> >>> shared xattrs can be used in this way as well if you care such minor >>> difference, actually I think inlined xattrs for your workload are just >>> meaningful for selinux labels and capabilities. >> >> Really? Could you expand on this, because I would think it will be >> sort of the opposite. In my usecase, the erofs fs will be read by >> overlayfs, which will probably access overlay.* pretty often.  At the >> very least it will load overlay.metacopy and overlay.redirect for >> every lookup. > > Really.  In that way, it will behave much similiar to composefs on-disk > arrangement now (in composefs vdata area). > > Because in that way, although an extra I/O is needed for verification, > and it can only happen when actually opening the file (so "ls -lR" is > not impacted.) But on-disk inodes are more compact. > > All EROFS xattrs will be cached in memory so that accessing ^ all accessed xattrs in EROFS Sorry about that if there could be some misunderstanding. > overlay.* pretty often is not greatly impacted due to no real I/Os > (IOWs, only some CPU time is consumed). > >> >> I guess it depends on how the verity support in overlayfs would work. >> If it delays access to overlay.verity until open time, then it would >> make sense to move it to the shared area. > > I think it could be just like what composefs does, it's not hard to > add just new dozen lines to overlayfs like: > > static int cfs_open_file(struct inode *inode, struct file *file) > { > ... >     /* If metadata records a digest for the file, ensure it is there >      * and correct before using the contents. >      */ >     if (cino->inode_data.has_digest && >         fsi->verity_check >= CFS_VERITY_CHECK_IF_SPECIFIED) { >         ... > >         res = fsverity_get_digest(d_inode(backing_dentry), >                       verity_digest, &verity_algo); >         if (res < 0) { >             pr_warn("WARNING: composefs backing file '%pd' has no fs-verity digest\n", >                 backing_dentry); >             return -EIO; >         } >         if (verity_algo != HASH_ALGO_SHA256 || >             memcmp(cino->inode_data.digest, verity_digest, >                SHA256_DIGEST_SIZE) != 0) { >             pr_warn("WARNING: composefs backing file '%pd' has the wrong fs-verity digest\n", >                 backing_dentry); >             return -EIO; >         } >         ... >     } > ... > } > > Is this stacked fsverity feature really hard? > > Thanks, > Gao Xiang > >>