From patchwork Fri Jun 7 18:52:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sid Kumar X-Patchwork-Id: 13690608 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35339C27C53 for ; Fri, 7 Jun 2024 18:54:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65BB56B00B8; Fri, 7 Jun 2024 14:54:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E4516B00BA; Fri, 7 Jun 2024 14:54:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C2A96B00BB; Fri, 7 Jun 2024 14:54:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1238F6B00B8 for ; Fri, 7 Jun 2024 14:54:33 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C8FFBA02DF for ; Fri, 7 Jun 2024 18:54:32 +0000 (UTC) X-FDA: 82204993584.01.D47E202 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf13.hostedemail.com (Postfix) with ESMTP id 890C420007 for ; Fri, 7 Jun 2024 18:54:29 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=MHrlq8kZ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wWKRoBXq; dmarc=pass (policy=quarantine) header.from=oracle.com; spf=pass (imf13.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717786469; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tFwzT4b7TDN8LupwfhTxyMGZTb5M4uMCFAvDfp7nMBc=; b=YuId3JdG/+YTddc4NKJiS3JIKqRnduA7JpZWLjPDujGQ3Eb8cJGTqnUu8x1HXOyfRwbn8c uYjSL6tCHRh96WKhNkIwpK9opzloEI4Rdb4QnGkNQ04W9ukNCAWOdfdWSQWOWCvwvz9OM4 iEgSeEXy38gxZhkH4j4U1XG7E9h5k1g= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=MHrlq8kZ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wWKRoBXq; dmarc=pass (policy=quarantine) header.from=oracle.com; spf=pass (imf13.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1717786469; a=rsa-sha256; cv=pass; b=FEQK6WuUMLiDlqwlApvXQDokZQHUdfQHp808AdZSachSlUMhvVI/HoEtlQVFFt4hGhnfCE Pm1N5yPptSHUhN4egk/v0e2ZtQCxdiaAf0Vg2EdSEg1IT5FMFHqMULN+tsJiENt8L6Naod H31cpPx4OzC5ptVMzEbHKc33EMH/vz8= Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 457CuVi8023604; Fri, 7 Jun 2024 18:54:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc : content-transfer-encoding : content-type : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=corp-2023-11-20; bh=tFwzT4b7TDN8LupwfhTxyMGZTb5M4uMCFAvDfp7nMBc=; b=MHrlq8kZ4mlfKiCX6SQYeRN7RZFKeUlLf3iFZB7FKUx7GYSxpOd6YLl8B00M6qjGBMNB se/R2SBcwVhM34nzUEp90PyyMRo98YPRKQ7u8XWK5fyFvgnSdP7jWTA1zGSb5YvB5dNJ 5X0ZjITvdUo0x9wFBKZ0mMtUeZpbpA+rXXAvt3Ry7U3q1tqyHZO4uODM7LINSAtGgYJo FMt6jpCYYD3Lyq5Md/lLerusiGkwmphYXLFsElFcX8HXPoK6HgsRudzVldFF5w1fGg+y pS3RefKynBtCGr9ga1hTValpcL0Ix3dWekIDcCeJ7vPRMzSrI7VMfM7ti6EnBsKs0WDN oQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yjbrse5mu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 07 Jun 2024 18:54:26 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 457HKoA5016160; Fri, 7 Jun 2024 18:54:26 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2173.outbound.protection.outlook.com [104.47.58.173]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ygrseudmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 07 Jun 2024 18:54:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O56hIkUdAA0GLLxTLFoUehIW4laKjHx/RMGrgNvvJgQaBeZnvkTw35pUZBNVMxynl2vcEljZDSjal4bVNPE9KnNQUFd2gezCWLs2Zuk8s73u56fLA6ZBtrsU3VNNzxqwd6FnCgew027PTjefWWOjCvBZEcBMAf3foX6QBa2C1jhAKaEc+9iJ7IIDr2Cegr5/URq0FDpbFQN3acJYARvktBTFBwohMIZn4GteKIrtgQbegJHTtKXphW0CzzxocQBcpwt4vsBADs5Anaa7xskwPD7OC8HUyJBXFPOe+hIocZrb+u3gvvnhdOU8GEuFpr6frEBfsSeVHrLtl5NDn2E+9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tFwzT4b7TDN8LupwfhTxyMGZTb5M4uMCFAvDfp7nMBc=; b=R2KiCHrArWo296Hv4+E1zIpwuVITu1mjPHtXSUQ/NaHJ52vevCvEntXMf7JFNSoSuBslApumUefMU2yO00UwXTTK87T3NGLwxFq2sqsM3MxzBQocO0bWNaThpGIxJQ7R8+9f1ltGBmLd7JTvbRGjN33bFML00piccPfWS7a8RTbOb33B3e5LjTNlJxHMkOFSipN5IZtEB4tSb3qbevPBGp5n//UH5IDrEiOjBUUsHATHCiAZwT4o0e28QXb8XlmqZlMalaueFfNuU/YXv8pYabTGIxWZvy71t1zA0xZAyEkTJBnwxccMnxV7cIlWTKvXZ79P7SI1LtusLma+bniy+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tFwzT4b7TDN8LupwfhTxyMGZTb5M4uMCFAvDfp7nMBc=; b=wWKRoBXqdalL4CQtdLCH2OZyTXh4UiRtBtQ+nEMM/4loXm3NsusoFmLvJ2HKaBbQBqtfrzXaUohUXid6P7QnSGTzr9tzF7mdHMyA7cq+l64Pcatd72BxSTrBGPLOh5ka5Yft5mnKdidBtHOc+4v/BdYg3TEct/nOd/AgwyBn2iY= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by SA1PR10MB6640.namprd10.prod.outlook.com (2603:10b6:806:2b6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22; Fri, 7 Jun 2024 18:53:44 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::eab6:6dcc:f05f:5cb2]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::eab6:6dcc:f05f:5cb2%7]) with mapi id 15.20.7633.034; Fri, 7 Jun 2024 18:53:43 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, liam.howlett@oracle.com, willy@infradead.org, Sidhartha Kumar Subject: [PATCH v2 13/16] maple_tree: have mas_store() allocate nodes if needed Date: Fri, 7 Jun 2024 11:52:54 -0700 Message-ID: <20240607185257.963768-14-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240607185257.963768-1-sidhartha.kumar@oracle.com> References: <20240607185257.963768-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR13CA0022.namprd13.prod.outlook.com (2603:10b6:a03:2c0::27) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|SA1PR10MB6640:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d5fd1d0-3b0e-46ff-0e86-08dc87232671 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|366007; X-Microsoft-Antispam-Message-Info: R3jJnELtoj6iyAPX1kl5kpii/V95z6McDsyztJVlAGJ+x+fQa0hmDOnEO8ofKrVn1V1EWnETtRrAVjLOXFAdhoacfv9tpfwNPXhGKX7E72X3ngBc0cjoOYJb6fY8EWwl7WyGU0Sc7sZxHbA2TmK7XUPunBe2iTI3YvShsqLkbON44G6uFRMGvMH1Ytw76El/w9rOuqFmpNv8gz1qrGzJzdhsALrfzRM9hV4CXWocOHFBpq7oUPos98TUpXe/d1Y/J1ff7DmjRDYrOtfLOUZEqtSWWE5JGF0jlcsrqNzWamGzuJEfXrHI5NiwGI/n473EtK+QpeyvAfQEaTHJXfDDZVhJjw22H37MVARuiqkkS2P+DwC3SQvC+U0u5btcbZw6OF6LyFZULkyIhIdsSgLFrRcS1xpEPd98mLoYwbXJ7JVAuISLAWY5IWESSI896bLGYvWyHoctEDZnazTMRuJX4wt6Pj/4mBsu+yYEnupSjT/sEnc9cwmL5zXRViFQdYV7Gg7fga+LQXvzZjArgi/lhgZ2jfQ34W15v7GpYLzaRZgCfNAs2XzL8k40akDOYLYeWXcY3UzbKISQQJxHdjITBK7dfCln60kMhZA5ADf6rvMIFiagKY2e+8dF4ZAzS2RSN/shVoTBaoTLTpF6b7EUdHvVQ627PI9n7AwlZ11Jurj/93MshgQJGmtAe+VNwQuGKe4XDpqs9II51wPMSL5NBCByA7QGYawj0rWgMhaiGKjzBZt3sNdEYC4tx4/LwGszUYZgQr78tJ6HpWNAeKIZWqbJFRPg1tj5I0GREF2CaHxhLQ0bK+D2I5/3C4m7FxLbN9ka44uS9X5XXd4V4q/htxg1tk3hbqVfOv0Zn9YFHSuBnJ1tD3C2TkjrZ2ccVqD+Q5JaXpEV1mLnVLtF4ayUOtKHTzx4bzpdaSdlDH5NnIn5Hq1X5tWrCez5ey/LkZM082SGyFHA2wbdU47h8TLtfzBmPUPpZ0yECkWaoqWT2vFrBa7BOAlJVS1EwLtxtVMWoH+7LQ7N1QbpyJh7X1p1Fyj87jWEwMTwsThMgKlDCBEZi7rzObUIe7JEmhE3cxCMpL0CEoYAIiN7de6F24e+hXxu418SB7ofSWR9VWZd6qbrO4Pd4kf8fEEXhZLFBa70VFOrG3qtr54NG30122u31E3LWIcNaMqVAW4Ml+L2bNKQ0SV3lPbbwxTZplJ6B0bz0pC5NA7D0ATtht9p1siZyJiABRYU36aw+r1jab5B1xJJtMRjEOEXvgQz/yaMMJtNzpMZ+lKUVHoJW/JbZn0OADsQ1AKj6xklkvugA62P7+Y= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UAkL086aNNkJBVJ6KNlYuk7wJPuOLFlzsEkiqUKJrhmDC5qFy+Owabgn6Nt7619FAvy3gslew2Am9dQ74jUWUY4dnX1YPnSs9AZF+0Ui6DIpDdGY1vtIvSQFOMRE2jDyD2sXtML8jmn9iGDxuuLDMakWJsTw97nC3plVjy3Wu3U5/DdW6zv4WLwvvX0hWS/dpH1if7/RUs52AhU/hBg/ThdqLO0AUDvOwu3DrBX66ZMenRSx17SF1CZi3q8C8KYNMHOiwP7XWWt2q4obeNkHZIrcKR9x6qrBHdrXa9Nvk/QRV9mfW5Xr3t2Qbo/X13QWnm5Xj+4URogKrbd6Y93WcvVV//ocG81sWYwRmW8mFxSXJE9S52kqS11ZXlhk2b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RV8JrVYuyFGOWFgeK76rL+0xd53hozd1AB7D5IwSajTdzJoEuG3xjbh6+PF2YzpiQsr+3vWPnhzGMfb7WebPS8YBuwG5kTCwNPTJM+eNsV9CSf1/oizU6W9/XJOVgSP1Yzrznmig/WxGv8fcEMaBnI6v4FZe/qJJ4gdLSt2ZFQKgGbdJJAdeipltV2ghrk2i8= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: TxWphX6prQRgD2Eigb06bq5OSzoICFgHJ3bjLdaWD7Nfl7MSmH1Zx4SNn9F2c6DX9eIc4uL6AKnvINQSVKKNoPZez3gwKczIz4Ltx4Bv7tZsiKDsNWHD3qDiy7HrDxD5tu+qUZLsatBTRbO8c5eTGcWJjy93m5LBniQSMLNqyBkATgQDR+OOrurQCfLDL69NM1ukU9gIuT080Y36QIUxwMgH5/SIYpe79N7PS+ZuHXR89hOVb0dy32J7+Oqrfxgl250snQM+7HSIeBxN1B+OK0YO6BwqFeWKRrdXUgntiIaSMg9KxNRJsIZ8hMNEWSXI6yXADUgOBxd4K1wSWwYOZhmHwqTejmgo5aP+u+dzmPKssO6J9MMl6uldLUIIR58GvoUPglxxRPOtI7z75r1MSUDf0see+N55WYEapDEqYEjjNpbbYicO4uKIx12W01IGUrErMYPVfs3PSshgGRQNe743VdES3Wfwstg6DJeYmWdWzXUfnhncltACWw+EqLzkrQK/03VmHVClnWPITmZRLPYG+OBIxJK8veYgodXaBNvAAHs9Gq4SkhbUCmfVvQ/tPff/uwAdM4waPx9eURxftDMhxSj3uGvzQkcReXhijPY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d5fd1d0-3b0e-46ff-0e86-08dc87232671 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2024 18:53:43.6410 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0KuC6v8vzSoxfQ8bqyafBMwx4z8AK2/RhbGypHyxSmgmImQxv5vbWefcCYoS/8WDuSG4PGEjS0JeTg3cZE/QxcnEZ4ToOgJciiFRrQR0Q/w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB6640 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-07_11,2024-06-06_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 spamscore=0 malwarescore=0 suspectscore=0 phishscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406070138 X-Proofpoint-ORIG-GUID: kMzbxoZGb6okFKYZ3_q_lPtin-gZ5thz X-Proofpoint-GUID: kMzbxoZGb6okFKYZ3_q_lPtin-gZ5thz X-Rspamd-Queue-Id: 890C420007 X-Stat-Signature: 9fmdp1oy3gbdwuehowciumtaen8fj89y X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1717786469-513065 X-HE-Meta: U2FsdGVkX19PklShD+jRScL+u/k3WBd1A5/hgp4MCVN+5Tkocdmq1bt1Pi9e39WvZEzs5qjm+Y6i6yodosufzv1h3z+saYFS2Cb1aVNpTYUp9W019GHlGkRA1hzTPez2w/S7P+WyKlXJ8jOjwHvScpCmhcKaNLaCAwtiLaEODr1rzX1tbqrLNZ1rkID0CXXSwe3P5M94yX2hbQxUvQNlSyqnopDEGCMdaDMVgJuV4G1qjrRabzGgkvOf4a9S/2rHWQa9oRcKtxcgiWjeB9UrghiZwaBmk5P3VZv6OEIASsDGw4Lc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dqjPqs+5jiKGkU/QLKzRCRv9CFQIpjsl1ObYUoqmqpiGW8iSwIlE8f1BbuqKUug7NNuhjMoIkf41kmhXpNiBxFqkZRY4g033WFHttDYapw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Not all users of mas_store() enter with nodes already preallocated. Check for the MA_STATE_PREALLOC flag to decide whether to preallocate nodes within mas_store() rather than relying on future write helper functions to perform the allocations. This allows the write helper functions to be simplified as they do not have to do checks to make sure there are enough allocated nodes to perform the write. Signed-off-by: Sidhartha Kumar --- lib/maple_tree.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 8b17768db5f2..92f133ea5f00 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5528,6 +5528,20 @@ static inline void mte_destroy_walk(struct maple_enode *enode, mt_destroy_walk(enode, mt, true); } } + +static inline void mas_wr_store_prealloc(struct ma_wr_state *wr_mas, void *entry) +{ + struct ma_state *mas = wr_mas->mas; + int request; + + mas_wr_prealloc_setup(wr_mas); + mas_wr_store_type(wr_mas); + request = mas_prealloc_calc(mas, entry); + if (!request) + return; + + mas_node_count(mas, request); +} /* Interface */ /** @@ -5536,8 +5550,6 @@ static inline void mte_destroy_walk(struct maple_enode *enode, * @entry: The entry to store. * * The @mas->index and @mas->last is used to set the range for the @entry. - * Note: The @mas should have pre-allocated entries to ensure there is memory to - * store the entry. Please see mas_expected_entries()/mas_destroy() for more details. * * Return: the first entry between mas->index and mas->last or %NULL. */ @@ -5563,9 +5575,21 @@ void *mas_store(struct ma_state *mas, void *entry) * want to examine what happens if a single store operation was to * overwrite multiple entries within a self-balancing B-Tree. */ - mas_wr_prealloc_setup(&wr_mas); - mas_wr_store_type(&wr_mas); + if (mas->mas_flags & MA_STATE_PREALLOC) { + mas_wr_prealloc_setup(&wr_mas); + mas_wr_store_type(&wr_mas); + mas_wr_store_entry(&wr_mas); + MAS_WR_BUG_ON(&wr_mas, mas_is_err(mas)); + return wr_mas.content; + } + + mas_wr_store_prealloc(&wr_mas, entry); + WARN_ON_ONCE(mas->store_type == wr_invalid); + if (mas_is_err(mas)) + return NULL; + mas_wr_store_entry(&wr_mas); + mas_destroy(mas); return wr_mas.content; } EXPORT_SYMBOL_GPL(mas_store);