Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp741201rwb; Tue, 29 Nov 2022 04:57:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf5VzxOCehHucL2MkcxXitDioTHQg3FejaioKijGVehi/Ro4mImViJxSJm3JmckLvQ7yDxsQ X-Received: by 2002:a62:1601:0:b0:575:ba22:26b2 with SMTP id 1-20020a621601000000b00575ba2226b2mr947373pfw.39.1669726669511; Tue, 29 Nov 2022 04:57:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669726669; cv=none; d=google.com; s=arc-20160816; b=SZNVPCOuHNZTta/cFbv4pNIjtTcmDFuegDIOOhZ5sTkkNMgzyByjpnZbAJu0FUn4x+ jxiZKZ3F5de/ZgqjlEYxr68zz6jC89wh0Reh9QOVfCfkL+DWHhyn7tlQns5jo5kHJCxB PFoedfHyv/Ij8i4U8kUbAh/rdQu2mIl1Pnuo4YrPpz2EU1HIH9P0mHWHygYD1Ed9PcRN fwJBOlFwqfD7pS4drPOZiiNXlKu1JveDfBMMWaqJBvxIK59iAaHU9XyrIRMj6TGuv5mu CulXpxElMCqfeu3QbsnVz+o0rqlT8Xkp9M/qfxjSI/3W1oY13zAsKmy7DLzXKDyaSL/S a1Ag== 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 :message-id:date:subject:cc:to:from; bh=5IPnGgjOEqOhpHRGmhy0BrzLRJ0qrtlqr++0EkAr/KA=; b=SCN3nHw1nhyH/8nAFiAo64YbbTC8e405Cvel1JOdojolNTHQ375pgi7dtChmLxIAZ7 Y+SWgUu3/Z1EGx1GtHHjq04SK0ZR2unfnV3Fk/hWk8TIOoJF+gK1DOOIlj/AtlB5t2A7 fhQV7z3rFP3PW5J4NpH8FaoNYDNJQ28ZT0jKGI3h2ySrZ2U0soVEEj/uw07lXgUNhpgy WGSF8SMxCDe/7LN4deAQJGdcV+AeT8LjaZnzObZSwu0PEUy29xjC9cFRYSybiA8UwB3p GsVLuG8hk5wyTglGoUiCJKQNB9XN1cpBM6QmlMul9T0yc0Jq2OSpfKnqsfi2GDA9KDwk tnvw== 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 u38-20020a631426000000b0046fb2a57348si14336967pgl.84.2022.11.29.04.57.37; Tue, 29 Nov 2022 04:57:49 -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 S233368AbiK2L7F (ORCPT + 83 others); Tue, 29 Nov 2022 06:59:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbiK2L6j (ORCPT ); Tue, 29 Nov 2022 06:58:39 -0500 Received: from out30-6.freemail.mail.aliyun.com (out30-6.freemail.mail.aliyun.com [115.124.30.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB54C65CC for ; Tue, 29 Nov 2022 03:58:37 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R511e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VW-kQll_1669723113; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VW-kQll_1669723113) by smtp.aliyun-inc.com; Tue, 29 Nov 2022 19:58:34 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v3 0/2] erofs: support large folios for fscache mode Date: Tue, 29 Nov 2022 19:58:31 +0800 Message-Id: <20221129115833.41062-1-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b 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,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 v3: - patch 1: when large folios supported, one folio or folio range can be mapped into several slices, with each slice mapped to different cookies, and thus each slice needs its own netfs_cache_resources. In the implementation of v2, each .read_folio() or .readahead() calling corresponds to only one request, and thus only one netfs_cache_resources (embedded in the request). In this case, fscache_begin_read_operation() may be called multiple times on this cres, while cres->ops->end_operation() is called only once when the whole request completes. This can cause the leakage of the corresponding cachefiles_object->n_accesses refcount, which will cause the user daemon hangs there forever waiting for cache->object_count decreasing to 0 when the user daemon exits. Worsely, as we mentioned previously, when large folios supported, one folio or folio range can be mapped to multiple chunks on different cookies, in which case each mapped chunk needs its own cres. In the implementation of v2, each .read_folio() or .readahead() calling corresponds to only one request, and thus only one cres. This will make the only cres used by the first chunk gets overridden by the following chunk. To fix this, we introduce listed requests, where each .read_folio() or .readahead() calling can correspond to a list of requests, with each request corresponds to one cres. v2: https://lore.kernel.org/all/20221128025011.36352-1-jefflexu@linux.alibaba.com/ v1: https://lore.kernel.org/all/20221126005756.7662-1-jefflexu@linux.alibaba.com/ v2: - patch 2: keep the enabling for iomap and fscache mode in separate patches; don't enable the feature for the meta data routine for now (Gao Xiang) Patch 1 is the main part of supporting large folios for fscache mode. It relies on a pending patch[1] adding .prepare_ondemand_read() interface in Cachefiles. Patch 2 just turns the switch on and enables the feature for fscache mode. It relies on a previous patch[2] which enables this feature for iomap mode. [1] https://lore.kernel.org/all/20221124034212.81892-1-jefflexu@linux.alibaba.com/ [2] https://lore.kernel.org/all/20221110074023.8059-1-jefflexu@linux.alibaba.com/ Jingbo Xu (2): erofs: support large folios for fscache mode erofs: enable large folios for fscache mode fs/erofs/fscache.c | 166 ++++++++++++++++++++++++--------------------- fs/erofs/inode.c | 3 +- 2 files changed, 89 insertions(+), 80 deletions(-) -- 2.19.1.6.gb485710b