Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2341336rwl; Fri, 6 Jan 2023 05:17:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXvSTtU4WiwdkhzZac7K/A0R41x7iT+8dsfcYxIzmVmaKEefpt+bw2WeT+HT9IymQUOa9xne X-Received: by 2002:a17:90a:acf:b0:226:ddf6:b7da with SMTP id r15-20020a17090a0acf00b00226ddf6b7damr2981980pje.41.1673011025796; Fri, 06 Jan 2023 05:17:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673011025; cv=none; d=google.com; s=arc-20160816; b=fvtwmLQhrZo8jo8yyNeBw7yB5ebUltVI5FFnBPbhItMZo6kIjnwvJO+6BHSEdnRJ+U hZ1CxkAulj/4TV6rgY9+jvQJ24bNJEV7SiLy1STxByxjaxpUvDL95PZ4er+OkI0+HtwK QkjQZSOO+u0e0rU/WW8HPnxmC1zDiSmFo1i2wtP8210kCthHEWruqjJyQcHAIII1vEvW 7XWGPIO5g+il5BdcaJiJNuvDcPUHFjk8laZn1pgMMMYb14LGjhp5ChosuwFxXofqfK7R fUx+7DVpuY51vbP69x7e73WvL9Uw+6H71mZBupf6ttTwoC6dri3tle88kNZoktq1g1Y2 IV0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=EhdxxlpYwtjX8jwA7cAhNWmBzIgaulcEQjTbzizakHA=; b=LfvSULUX4Watjvf66PHOXdxyhU2qCK3UReeeKpEacEYRC2/3tXAVhaERy49YdbLRS9 TaGLpJiHOc1MEGWnebjr4mHs6yNsJPNjQxVSlh7mFwLl0gAyQ1RbjwOetvn3bpWTDjCA NETh6qP5oatlbEnIWn69zxfzdanG1i5qLjmiJRpxYbmkhnZgttsGXawSMPZVJHNEh3KZ rDC1Vwbf/2aVbJrRct8lh1QtjVIfiMnaxG5mrIGukL9/dE3JxiJH80ZjD81P+IpuljAW 4Vgd16jkk5QjAKd1VMaOThQE2SR1exUe1gJlcaHP3Uvbj/HeJxy8yThW/Bit86F1+bEL Izrg== 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 b23-20020a17090a991700b002239c987051si1254050pjp.128.2023.01.06.05.16.58; Fri, 06 Jan 2023 05:17:05 -0800 (PST) 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 S234039AbjAFMyA (ORCPT + 54 others); Fri, 6 Jan 2023 07:54:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234177AbjAFMxf (ORCPT ); Fri, 6 Jan 2023 07:53:35 -0500 Received: from out30-7.freemail.mail.aliyun.com (out30-7.freemail.mail.aliyun.com [115.124.30.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D318728B7; Fri, 6 Jan 2023 04:53:34 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R891e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VZ-H5YK_1673009611; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VZ-H5YK_1673009611) by smtp.aliyun-inc.com; Fri, 06 Jan 2023 20:53:32 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: huyue2@coolpad.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH 1/6] erofs: remove unused device mapping in the meta routine Date: Fri, 6 Jan 2023 20:53:25 +0800 Message-Id: <20230106125330.55529-2-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230106125330.55529-1-jefflexu@linux.alibaba.com> References: <20230106125330.55529-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_MSPIKE_H2,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 Currently there're two anonymous inodes (inode and anon_inode in struct erofs_fscache) may be used for each blob. The former is only for bootstrap and used as the address_space of page cache, while the latter is used for both bootstrap and data blobs when share domain mode enabled and behaves as a sentinel in the shared domain. In prep for the following support for page cache sharing, following patch will unify these two anonymous inodes. That is, the unified anonymous inode not only acts as the address_space of page cache, but also a sentinel in share domain mode. However the current meta routine can't work if above change applied. Current meta routine will make a device mapping, and superblock of the filesystem is required to do the device mapping. Currently the superblock is derived from the input meta folio, which is reasonable since the anonymous inode (used for the address_space of page cache) is always allocated from the filesystem's sb. However after anonymous inodes are unified, that is no longer always true. For example, in share domain mode, the unified anonymous inode will be allocated from pseudo mnt, and the superblock derived from the folio is actually a pseudo sb, which can't be used for the device mapping at all. As for the meta routine itself, currently metadata is always on bootstrap, which means device mapping is not needed so far. After removing the redundant device mapping logic, we can derive the required fscache_ctx from anonymous inode's i_private. Signed-off-by: Jingbo Xu --- fs/erofs/fscache.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index 014e20962376..03de4dc99302 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -164,18 +164,8 @@ static int erofs_fscache_read_folios_async(struct fscache_cookie *cookie, static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio) { int ret; - struct super_block *sb = folio_mapping(folio)->host->i_sb; + struct erofs_fscache *ctx = folio_mapping(folio)->host->i_private; struct erofs_fscache_request *req; - struct erofs_map_dev mdev = { - .m_deviceid = 0, - .m_pa = folio_pos(folio), - }; - - ret = erofs_map_dev(sb, &mdev); - if (ret) { - folio_unlock(folio); - return ret; - } req = erofs_fscache_req_alloc(folio_mapping(folio), folio_pos(folio), folio_size(folio)); @@ -184,8 +174,8 @@ static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio) return PTR_ERR(req); } - ret = erofs_fscache_read_folios_async(mdev.m_fscache->cookie, - req, mdev.m_pa, folio_size(folio)); + ret = erofs_fscache_read_folios_async(ctx->cookie, req, + folio_pos(folio), folio_size(folio)); if (ret) req->error = ret; @@ -469,6 +459,7 @@ struct erofs_fscache *erofs_fscache_acquire_cookie(struct super_block *sb, inode->i_size = OFFSET_MAX; inode->i_mapping->a_ops = &erofs_fscache_meta_aops; mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); + inode->i_private = ctx; ctx->inode = inode; } -- 2.19.1.6.gb485710b