From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 348A01D9663 for ; Sun, 16 Aug 2026 13:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786885657; cv=none; b=PJmLQkeC7akV4Ox8Sbw41PZjoX2fX26SVUYRgVJdycrbSiixoYzBtxPtOe79t5yoss3m0K3h8p+iYlw+aPp3BDRkmwRz+01VqgQgYaY9x7aAyacjNFyQajZUlH26ik03V0yYkAOgaCTEVcXytn/57QCx23vs13stLB17YMc66Cs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786885657; c=relaxed/simple; bh=w+7jC9kzR01kmhqpr4p7cOGEI0E2jusJ7CDTjHZJpso=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pU2/w9GxcHnnXYCSNUEMp6658CUTEjloch7y8qoY3aTiOtn7bQS6c4HGXr8pLx6G+yCgkhnbaKlBH9G9Leh3nGvs7/2Kd+Jb1dW/GkQ+ShNjoaJjGtIg82Qa6fSX04cARtLfZ6Lte93bPBiP9QiiZzQcyQKxgGK4/Uts88UKWio= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=CN5VLIaJ; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="CN5VLIaJ" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67GB1fjj619428; Sun, 16 Aug 2026 13:07:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=O3x8z09z/5qY8lR5G CxQbc4OxO9+aOu3hJ7ywUtZCzw=; b=CN5VLIaJHqg9bftEy4hcbliaTNROO2f3M yUXCTpB/NljH0RRoseUhVGA7hEZ/HjmYJs+eQxPsYDL4r2DZYqSQGb1OB/TToy2a 96g67RLRSJfbs7zW0hrNw41ZPV/y/JPqqde3DlXQbeQlwmS6Gh/klhvKhC14XK/F lkS41DrJBH69XE9RSGPYCAg3omThbaWhylmVDPHOVhnxJ+PC+o7wtY29mVGy3MT7 j3cIEiHAnEPrqLYhUzCOuiFijiqQZ5BJykcPa5TxbPASBqFxxhdRHKFiJjwzwEsh rPywqnzOPnkwH1hnzMMzPv93qbTDx5z6YZIudiPb7nl1YD2wErvUw== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4g2fsqdaay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 16 Aug 2026 13:07:21 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 67GCuIIQ021375; Sun, 16 Aug 2026 13:07:20 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4g354y1a5q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 16 Aug 2026 13:07:20 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 67GD7I1Y30671382 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Aug 2026 13:07:18 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C0DA20049; Sun, 16 Aug 2026 13:07:18 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2FFCB20040; Sun, 16 Aug 2026 13:07:15 +0000 (GMT) Received: from li-dc0c254c-257c-11b2-a85c-98b6c1322444.ibm.com (unknown [9.39.17.50]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Sun, 16 Aug 2026 13:07:14 +0000 (GMT) From: Ojaswin Mujoo To: linux-erofs@lists.ozlabs.org Cc: Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Hongbo Li , Chunhai Guo , linux-kernel@vger.kernel.org, Shirisha G Subject: [PATCH 1/1] erofs: fix unused pcluster_pools for higher page sizes Date: Sun, 16 Aug 2026 18:37:09 +0530 Message-ID: <808f25346aeac628aa9968f786fdbba09366fd76.1786884312.git.ojaswin@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODE2MDEwMyBTYWx0ZWRfX8joBcYdqrP// F2ObEYvnpsuSzAsWR5bIxEs2Q/AKgjdPZ0KoUmIJbVz4dKcYWzoGuppHofUxYm8qXsJPJbz1gEB UIruLd6FezXxII6IAOygEnnxWIcHTBnnsV7r/VYbkA/LwbN9cRzwZAJKBHx470x011Lrc2s2m8a JXJ2m854WmBVVUyc7FLjeKYvM7dFgh4cSd7AcEnXL47STbNq2dwXRWOjHs4YclFXktkyNC9+gAo yzlS/tRLNmSFKX5WBfzEC8n9Xti8C77M89Axxug9jgAYx1o8NvSP9sEpvHtELxEN6HBUN/5WAPG 08CRylE6ZiH+00ug6w1n/Du48asUZcWo/POPM7qjrIclX7uBIExTIinuhjlyCimWN0a9Y53Wsm4 w/SugjgxYaVXMTdmJC2xblZoRHiMRfk/DGTBYPdNr/xpxJlMC97WyJsplkHBx27kg1Rukn6n/Ey iJNK/nsL3lgQ86J6zBw== X-Proofpoint-ORIG-GUID: 4CDJiDd-9pqYqwAFq3vEdoWuLddS3uxD X-Proofpoint-Spam-Info: AW1haW4tMjYwODE2MDEwMyBTYWx0ZWRfX+9nk5L0l1bCy na7NyOyuOKV5GnL5YJTojlPDi6iHvOvfkcLFy5+BfUaxCzXF9OgHmOQay1RH0xDR/01vbP/Jszz tSI3cbm//1Gihgx9MdQbABPeQ0Z0i8k= X-Authority-Analysis: v=2.4 cv=DJe/JSNb c=1 sm=1 tr=0 ts=6a81b609 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=ejRqyOJfSNhr-pxtSPoA:9 X-Proofpoint-GUID: PutnbgkwCSXqOwUWVYVrl69BoIzsWjEc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-16_03,2026-08-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 spamscore=0 clxscore=1011 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608160103 pcluster_pool[] hardcodes {1,4,16,64,128,Z_EROFS_PCLUSTER_MAX_PAGES+1}, but the assumption of Z_EROFS_PCLUSTER_MAX_PAGES == 256 is only right for 4k page sizes. For higher page sizes like 16k or 64k, This results in us ending up with clusters bigger than what we will ever use, since we only support upto 1MB of compressed data. For example, on 64k page size we will only ever use clusters with nrpages= 1, 4 and 17. This patch fixes the allocation for such higher pages sizes by adding some compile time checks. Below are the clusters created right after boot on a 64KB page size machine $cat /proc/slabinfo | grep pcluster | cut -d" " -f1: Before the patch: erofs_pcluster-1 erofs_pcluster-4 erofs_pcluster-16 erofs_pcluster-17 erofs_pcluster-64 erofs_pcluster-128 After the patch: erofs_pcluster-1 erofs_pcluster-4 erofs_pcluster-17 Fixes: 9f6cc76e6ff0 ("erofs: introduce physical cluster slab pools") Reported-by: Shirisha G Signed-off-by: Ojaswin Mujoo --- fs/erofs/zdata.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 602ba8b7cc79..5c2c22ed64d0 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -128,7 +128,17 @@ struct z_erofs_pcluster_slab { #define _PCLP(n) { .maxpages = n } static struct z_erofs_pcluster_slab pcluster_pool[] __read_mostly = { - _PCLP(1), _PCLP(4), _PCLP(16), _PCLP(64), _PCLP(128), + _PCLP(1), + _PCLP(4), +#if Z_EROFS_PCLUSTER_MAX_PAGES > 16 + _PCLP(16), +#endif +#if Z_EROFS_PCLUSTER_MAX_PAGES > 64 + _PCLP(64), +#endif +#if Z_EROFS_PCLUSTER_MAX_PAGES > 128 + _PCLP(128), +#endif _PCLP(Z_EROFS_PCLUSTER_MAX_PAGES + 1) }; -- 2.55.0