Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp952763pxp; Wed, 16 Mar 2022 22:28:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyj1svHOGgSFzilpVkUpG1Lp9mezksE2pkPvqEce/C10qlXFbscEXjHoS9effTTptYSGnvY X-Received: by 2002:a17:903:2488:b0:153:8f59:8c03 with SMTP id p8-20020a170903248800b001538f598c03mr2984086plw.54.1647494881365; Wed, 16 Mar 2022 22:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647494881; cv=none; d=google.com; s=arc-20160816; b=rmIOfS9284ZX6nFHaLqW9u5YXOF3JGf0DZJVJr8mE7VRCFdt6VjBs2YliDKTtr3Frq AOanuLLOMJ9ofWunyOqPbdp80dfjsVcMZIlTJFKLz2gwYQFGRFRYJIfZ3emCyEhktXZM OH8BI2X9Hj8uFsAEEf1VuE3jwO/NyTHdYG77RsbzQSwCuw5I4d3C7OLCPeGXA7b5FEcf H6S8myCoX72zUd6NP1H1jFKOQayci2OUzpw/P/1SHg4KElm3HXXnAZrZGyw2pwJQNaZB sv+UwdKCX0W1stmHmX3o+JLxxmxPJyXAy9fgW+EK2BQNnKzG9VPHkpKiUbzIA55nZXxb FHUw== 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=0s2ULoAdydCbXkxVmZoGZaUV3ulGudAI9BjS05BMRBk=; b=wWWfxbmUK7ns1EpRGsN0g5JW3yV9EsqduOFs6yaSS5WXaLPJkcncBtX/JV9vg0VNzm t7cIZjrBwF78kOJ/yo9VLD+AmKFDwwrd2p49uCheCeyfPRPgKYTdpp9N92XSBW7zikWd 9Jov/hq/QYg3XHyHDOjO9vwW99xJa13N6c8jO7kxoPVv2/CftX3s0x5wNDP6Jr70sadJ 2vRve4yA1q4bLw6krShfX7QEk4hu2RwT9CbXSuJhot4K8Ccng77/qJwvVa1LPWkVRUAN O3JImFx77T1CTjSfxk8h6hvwdOnUNMswHnlHmADFZVZfkGca4i92JuhAdNqvWZENTxwi BtPw== 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 v8-20020a627a08000000b004f6fe1f3076si3637285pfc.326.2022.03.16.22.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:28:01 -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 C6D98209A7A; Wed, 16 Mar 2022 21:29:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356082AbiCPNUw (ORCPT + 99 others); Wed, 16 Mar 2022 09:20:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356308AbiCPNTq (ORCPT ); Wed, 16 Mar 2022 09:19:46 -0400 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E533255BE; Wed, 16 Mar 2022 06:17:58 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0V7MlTCc_1647436673; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V7MlTCc_1647436673) by smtp.aliyun-inc.com(127.0.0.1); Wed, 16 Mar 2022 21:17:54 +0800 From: Jeffle Xu To: dhowells@redhat.com, linux-cachefs@redhat.com, xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: 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 Subject: [PATCH v5 20/22] erofs: implement fscache-based data read for data blobs Date: Wed, 16 Mar 2022 21:17:21 +0800 Message-Id: <20220316131723.111553-21-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220316131723.111553-1-jefflexu@linux.alibaba.com> References: <20220316131723.111553-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,T_SCC_BODY_TEXT_LINE,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 This patch implements the data plane of reading data from data blob file over fscache. Signed-off-by: Jeffle Xu --- fs/erofs/data.c | 3 +++ fs/erofs/fscache.c | 16 +++++++++++++--- fs/erofs/internal.h | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index 1bff99576883..c5ccf55c050c 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -200,6 +200,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_ctx = EROFS_SB(sb)->bootstrap; if (map->m_deviceid) { down_read(&devs->rwsem); @@ -211,6 +212,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_ctx = dif->ctx; up_read(&devs->rwsem); } else if (devs->extra_devices) { down_read(&devs->rwsem); @@ -228,6 +230,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_ctx = dif->ctx; break; } } diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index 254b3e72ab4d..82c52b6e077e 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -70,11 +70,21 @@ static inline int erofs_fscache_get_map(struct erofs_fscache_map *fsmap, struct erofs_map_blocks *map, struct super_block *sb) { - struct erofs_sb_info *sbi = EROFS_SB(sb); + struct erofs_map_dev mdev; + int ret; + + mdev = (struct erofs_map_dev) { + .m_deviceid = map->m_deviceid, + .m_pa = map->m_pa, + }; + + ret = erofs_map_dev(sb, &mdev); + if (ret) + return ret; - fsmap->m_ctx = sbi->bootstrap; + fsmap->m_ctx = mdev.m_ctx; + fsmap->m_pa = mdev.m_pa; fsmap->m_la = map->m_la; - fsmap->m_pa = map->m_pa; fsmap->m_llen = map->m_llen; return 0; diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index d93de8b6ff44..f698bdeb88ef 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -486,6 +486,7 @@ struct erofs_map_dev { struct block_device *m_bdev; struct dax_device *m_daxdev; u64 m_dax_part_off; + struct erofs_fscache_context *m_ctx; erofs_off_t m_pa; unsigned int m_deviceid; -- 2.27.0