Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp574731imw; Fri, 15 Jul 2022 08:48:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t38nhsDfPL6tKh9T+BUxVd82l1IdP4z0o+uShfzgVzl9fJUqZ4KMTwqI0lrb6QwmRh/ZsG X-Received: by 2002:a17:906:4482:b0:70a:19e3:d18a with SMTP id y2-20020a170906448200b0070a19e3d18amr14450041ejo.510.1657900133537; Fri, 15 Jul 2022 08:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657900133; cv=none; d=google.com; s=arc-20160816; b=mHwhSqqYk8awG5FTZmr6WLBy69z1bwgajI2DxNx3BJ39Zc6njM3OPMS4lHgtCXkUlB 8oDr2UHkj4IEx1wuANRNnvyIJ74oq8gioh/WRdjOK5zIWixl/WompUy5TB7b7yTc/73w vpeGVU5Vrflail61zRLI99vGSKZu0UCkgUpBEpxbiV8fadgj3R+wPngv+qJ5WjjYYhQa HcHtV2yb+AhMqoz4WXI54BkTe10nhe7e0/p2pM+2g7Pu6LimUAGuhvIi7UmSOmDVXAqW xPjqDO1oELR8gXOgrhnN/uBsOqMK3QvtCu+MYC6/obrI65rPo1giWSIEqzx7T7O8OaWB nlPg== 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=R510sPnl4LugHpnuKNpsVT3FQK3ccLsphOD1edsjBYs=; b=FRM1XFhE2HRWpyW6OX4C13WqGWN9Im7zMVyLBTPUEiD+eeLGhXSfLRErgNpONGfVwi ChO5SXVpFlpwCOIEuW4ZYSNR/CJQplBUbNsPVb3m6if9Ot9c9MaZ3xKYrzBR/kgd7U4g lpWRoAUQn9z3WunRQKcrzkAZ5eXFrP6Z83enxHhby6eqvxOuZUNVZBbFUOBm+SYDk350 1BnAwn3Sqp/7Qyiabv6wjD5ihTeLgrKMxlU8vBKmDsSnn65WsSMspj7bGwp9vxDqkxZ2 4neU7KB2rZiCIKrfFD9FDmUG8frmJ6wKSV0PHEEWSr3nOBAerB+meznb7GePhtojbMsx KhaQ== 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 z22-20020a170906435600b0072b4567e761si5737717ejm.201.2022.07.15.08.47.59; Fri, 15 Jul 2022 08:48:53 -0700 (PDT) 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 S235502AbiGOPnA (ORCPT + 99 others); Fri, 15 Jul 2022 11:43:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235080AbiGOPmb (ORCPT ); Fri, 15 Jul 2022 11:42:31 -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 4DBFF58841 for ; Fri, 15 Jul 2022 08:42:28 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R521e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VJPnC79_1657899744; Received: from e18g06460.et15sqa.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VJPnC79_1657899744) by smtp.aliyun-inc.com; Fri, 15 Jul 2022 23:42:25 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu Cc: LKML , Gao Xiang Subject: [PATCH v2 11/16] erofs: get rid of `z_pagemap_global' Date: Fri, 15 Jul 2022 23:41:58 +0800 Message-Id: <20220715154203.48093-12-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.24.4 In-Reply-To: <20220715154203.48093-1-hsiangkao@linux.alibaba.com> References: <20220715154203.48093-1-hsiangkao@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_DNSWL_NONE,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 In order to introduce multi-reference pclusters for compressed data deduplication, let's get rid of the global page array for now since it needs to be re-designed then at least. Signed-off-by: Gao Xiang --- fs/erofs/zdata.c | 28 ++++------------------------ fs/erofs/zdata.h | 1 - 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index d1f907f4757d..3f735ca0415e 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -291,9 +291,6 @@ struct z_erofs_decompress_frontend { .inode = __i, .owned_head = Z_EROFS_PCLUSTER_TAIL, \ .mode = Z_EROFS_PCLUSTER_FOLLOWED, .backmost = true } -static struct page *z_pagemap_global[Z_EROFS_VMAP_GLOBAL_PAGES]; -static DEFINE_MUTEX(z_pagemap_global_lock); - static void z_erofs_bind_cache(struct z_erofs_decompress_frontend *fe, enum z_erofs_cache_alloctype type, struct page **pagepool) @@ -966,26 +963,11 @@ static int z_erofs_decompress_pcluster(struct super_block *sb, mutex_lock(&pcl->lock); nr_pages = pcl->nr_pages; - if (nr_pages <= Z_EROFS_VMAP_ONSTACK_PAGES) { + if (nr_pages <= Z_EROFS_VMAP_ONSTACK_PAGES) pages = pages_onstack; - } else if (nr_pages <= Z_EROFS_VMAP_GLOBAL_PAGES && - mutex_trylock(&z_pagemap_global_lock)) { - pages = z_pagemap_global; - } else { - gfp_t gfp_flags = GFP_KERNEL; - - if (nr_pages > Z_EROFS_VMAP_GLOBAL_PAGES) - gfp_flags |= __GFP_NOFAIL; - + else pages = kvmalloc_array(nr_pages, sizeof(struct page *), - gfp_flags); - - /* fallback to global pagemap for the lowmem scenario */ - if (!pages) { - mutex_lock(&z_pagemap_global_lock); - pages = z_pagemap_global; - } - } + GFP_KERNEL | __GFP_NOFAIL); for (i = 0; i < nr_pages; ++i) pages[i] = NULL; @@ -1065,9 +1047,7 @@ static int z_erofs_decompress_pcluster(struct super_block *sb, z_erofs_onlinepage_endio(page); } - if (pages == z_pagemap_global) - mutex_unlock(&z_pagemap_global_lock); - else if (pages != pages_onstack) + if (pages != pages_onstack) kvfree(pages); pcl->nr_pages = 0; diff --git a/fs/erofs/zdata.h b/fs/erofs/zdata.h index 75f6fd435388..43c91bd2d84f 100644 --- a/fs/erofs/zdata.h +++ b/fs/erofs/zdata.h @@ -175,6 +175,5 @@ static inline void z_erofs_onlinepage_endio(struct page *page) #define Z_EROFS_VMAP_ONSTACK_PAGES \ min_t(unsigned int, THREAD_SIZE / 8 / sizeof(struct page *), 96U) -#define Z_EROFS_VMAP_GLOBAL_PAGES 2048 #endif -- 2.24.4