Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp842483pxb; Fri, 22 Apr 2022 12:21:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNVa+6FKjF+DzekzsFAGGL21axZoFp2h4rkjGYpUqwjYm5pH6L6Q9rfP1302iQv9SBJchR X-Received: by 2002:a17:902:a503:b0:15a:1050:d605 with SMTP id s3-20020a170902a50300b0015a1050d605mr6046240plq.87.1650655293239; Fri, 22 Apr 2022 12:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650655293; cv=none; d=google.com; s=arc-20160816; b=gDs97hbEm0nRECVLeqjwDDwTiOHnneO6CfzAdyJYAFa1IoJxvVe2N8pjvTWHHZcydG 3WT9sMZa4CiqWK+j/tIG5npnj1EtRvv4poeUG6x+23gUV04EsefI+XWGKrb57snEP5+f HrM3dqTfc1UEGgx4invqdQKimaIo002D0CciH0z5JsKSW5RHt9+7DY4kfcmOdo5abO91 K3N4umDzLN87LQBHKK0yFxHFWbgMbf7DU/OMGBKI7+GefWMDqju1sjgi7rqPI/tcTHs0 Rd67YLldAbDVQoB41SJWsSw+22mPSA1OihiWJcRNGh+7p1q3EPKdk4BkHThffm/hX4my 3LOw== 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=D1bM9NX200TXSjIHuCdh6Y1iegPT8SH80Wf0RLcJsnI=; b=HuIHG+2cWQmhCZ7ozgiuXOjsIwWFufaURINA3+WvR9NdyV+3bTNIWjduZt4StKhFg0 lLgLbpdrKSgc2lu0li4+116wGp17RmjdDlV4IPk+wq6V6aA5N8p/XybROWkF/r0Xj70o tJFiZLnNzs+8FE5QRhsbF1brrzGsXoLW0To+LXQAfC0ZEqBesQIqUZAaRQm1R/9h1IZb k4DDiC+GxNYfSgpHKiq47TU5BWB+pFrsmQtxgmVMidbkOM0ie4HXvgI/w8TbeuD32Qpq i9eDPo5NWm3VheFZRd9MYSp+VTEJ3Qo1cTe/QOaRD9FJDugm8aOdy4H0o//Hizea5NB+ +15Q== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 1-20020a631741000000b003816043f110si8917764pgx.773.2022.04.22.12.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:21:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 601CE47AD7; Fri, 22 Apr 2022 11:35:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388625AbiDULBj (ORCPT + 99 others); Thu, 21 Apr 2022 07:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388611AbiDULBi (ORCPT ); Thu, 21 Apr 2022 07:01:38 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 348F32CC95; Thu, 21 Apr 2022 03:58:48 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R341e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0VAejRZ._1650538721; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VAejRZ._1650538721) by smtp.aliyun-inc.com(127.0.0.1); Thu, 21 Apr 2022 18:58:43 +0800 Date: Thu, 21 Apr 2022 18:58:41 +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 16/21] erofs: register fscache context for extra data blobs 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-17-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220415123614.54024-17-jefflexu@linux.alibaba.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,UNPARSEABLE_RELAY autolearn=no 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:09PM +0800, Jeffle Xu wrote: > Similar to the multi device mode, erofs could be mounted from one > primary data blob (mandatory) and multiple extra data blobs (optional). > > Register fscache context for each extra data blob. > > Signed-off-by: Jeffle Xu Reviewed-by: Gao Xiang Thanks, Gao Xiang > --- > fs/erofs/data.c | 3 +++ > fs/erofs/internal.h | 2 ++ > fs/erofs/super.c | 8 +++++++- > 3 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/fs/erofs/data.c b/fs/erofs/data.c > index bc22642358ec..14b64d960541 100644 > --- a/fs/erofs/data.c > +++ b/fs/erofs/data.c > @@ -199,6 +199,7 @@ int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *map) > map->m_bdev = sb->s_bdev; > map->m_daxdev = EROFS_SB(sb)->dax_dev; > map->m_dax_part_off = EROFS_SB(sb)->dax_part_off; > + map->m_fscache = EROFS_SB(sb)->s_fscache; > > if (map->m_deviceid) { > down_read(&devs->rwsem); > @@ -210,6 +211,7 @@ int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *map) > map->m_bdev = dif->bdev; > map->m_daxdev = dif->dax_dev; > map->m_dax_part_off = dif->dax_part_off; > + map->m_fscache = dif->fscache; > up_read(&devs->rwsem); > } else if (devs->extra_devices) { > down_read(&devs->rwsem); > @@ -227,6 +229,7 @@ int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *map) > map->m_bdev = dif->bdev; > map->m_daxdev = dif->dax_dev; > map->m_dax_part_off = dif->dax_part_off; > + map->m_fscache = dif->fscache; > break; > } > } > diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h > index 386658416159..fa488af8dfcf 100644 > --- a/fs/erofs/internal.h > +++ b/fs/erofs/internal.h > @@ -49,6 +49,7 @@ typedef u32 erofs_blk_t; > > struct erofs_device_info { > char *path; > + struct erofs_fscache *fscache; > struct block_device *bdev; > struct dax_device *dax_dev; > u64 dax_part_off; > @@ -482,6 +483,7 @@ static inline int z_erofs_map_blocks_iter(struct inode *inode, > #endif /* !CONFIG_EROFS_FS_ZIP */ > > struct erofs_map_dev { > + struct erofs_fscache *m_fscache; > struct block_device *m_bdev; > struct dax_device *m_daxdev; > u64 m_dax_part_off; > diff --git a/fs/erofs/super.c b/fs/erofs/super.c > index 61dc900295f9..c6755bcae4a6 100644 > --- a/fs/erofs/super.c > +++ b/fs/erofs/super.c > @@ -259,7 +259,12 @@ static int erofs_init_devices(struct super_block *sb, > } > dis = ptr + erofs_blkoff(pos); > > - if (!erofs_is_fscache_mode(sb)) { > + if (erofs_is_fscache_mode(sb)) { > + err = erofs_fscache_register_cookie(sb, &dif->fscache, > + dif->path, false); > + if (err) > + break; > + } else { > bdev = blkdev_get_by_path(dif->path, > FMODE_READ | FMODE_EXCL, > sb->s_type); > @@ -710,6 +715,7 @@ static int erofs_release_device_info(int id, void *ptr, void *data) > fs_put_dax(dif->dax_dev); > if (dif->bdev) > blkdev_put(dif->bdev, FMODE_READ | FMODE_EXCL); > + erofs_fscache_unregister_cookie(&dif->fscache); > kfree(dif->path); > kfree(dif); > return 0; > -- > 2.27.0