From patchwork Fri Jun 7 18:52:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13690602 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 073B8C27C53 for ; Fri, 7 Jun 2024 18:54:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 880386B00AA; Fri, 7 Jun 2024 14:53:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B9A86B00AB; Fri, 7 Jun 2024 14:53:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 572DB6B00AA; Fri, 7 Jun 2024 14:53:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2785F6B00A8 for ; Fri, 7 Jun 2024 14:53:50 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CD6041219B9 for ; Fri, 7 Jun 2024 18:53:49 +0000 (UTC) X-FDA: 82204991778.22.04E0A19 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf02.hostedemail.com (Postfix) with ESMTP id 648578000C for ; Fri, 7 Jun 2024 18:53:46 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=mPwP9hu3; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=llvC4aRZ; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf02.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=quarantine) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717786426; 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=eVZpxqxt2vbi+6AHnTDpG54BWzJdcL9VsTS5wEF3vJs=; b=7yZq0JYfbB1a3rYLlpTgw3lLKfTip6oxdtq17bWg6xeLKMYN/RQyJYNa1b6+HxKTW01GUd Gwwco2OxacAif5eBVkWg4sV4z+FZksSn39KT7nbsCtCw3q+ca3GYPhYrg/SMW4lv4oFlF4 Ur6WqxujSZhQ1dANXHP5EPl6k8qpodY= ARC-Authentication-Results: i=2; imf02.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=mPwP9hu3; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=llvC4aRZ; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf02.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=quarantine) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1717786426; a=rsa-sha256; cv=pass; b=Uv8oZYu6Y+BxMLG4gjsUfxDZ/8HUfw0ZqZbrfeMsc3H41Y5SEtpR3hG3b3RcLJ1gInhP+j t2PX5lnbjOMHiU8dVAWm2xRMnTFZ0rP/r15MoiJcKmwxzWpTK/BIzEW8lkSdyAtHn0W0rl sB1iYFSY8tGfk0SmE404knod86IqGls= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 457CuhbN016014; Fri, 7 Jun 2024 18:53:44 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=eVZpxqxt2vbi+6AHnTDpG54BWzJdcL9VsTS5wEF3vJs=; b=mPwP9hu3VOY9Kqs1fK6qeMA3kblbfG0DfdY+y+pg7rvPNY2LD+kaiyiglM+qRequpEEC KFSpmjyaQEJI1GMegHS9LWC/xzhDSxmhFsKN2GrSqUPzA/0GdE5pSvfijmOpccXFpdZ9 rmlQgyTZuSl6RkK1JFwGYGxyLWiei5nDA9lWdm9GLZ86DcLWt4hpRy7z39gdMSxti/pJ 9uGx76/dnWv9o0Sqe3qzcDAzW1B7ywyt5JejmT+c1Hyv+b/EB5NgsS/WzBzAQ2/mRtjk nPN2Yd9z7UJ28Gmtyme7MSke+JAgrl5Oqy9aU60fNWXen1n53fXsWASo7fBSp8j5/WT8 zw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yjbqn69he-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 07 Jun 2024 18:53:43 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 457ICR4I023938; Fri, 7 Jun 2024 18:53:42 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ygrr2k7tv-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 07 Jun 2024 18:53:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EmaLlyBgxNSIEqnduUU82QI162cr6IS37Ux9Vr5607Tkt9H/iyWcK+Rnl2G5I/JWP4FEsYWfw1vVtm8E8pk1X2sFjd0Cfa+ifn1a2gAp3eCX8puPe7DTYyXy0H2dSAU6EXcR8PcSPoeDip6R5uTS9vfvawzS257M3hX1H/wa2Ap0bmeKDzZ6Mb+D9cKAukne7UOiTfi86XZDjAVvzHlLmVAvnT8/yOWeJSDX6e0FJPh9ajhNex58It26nFCTrHQ/yNkZQDE1Sv57ROU/OfyXwG0owZoLeAK8+eTMTK6BItk2L2EYMoaJ7EA9moxf36ndXbmSBxVNRcEKdb2ay7im3A== 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=eVZpxqxt2vbi+6AHnTDpG54BWzJdcL9VsTS5wEF3vJs=; b=enhX8DtfuakhAlNQYAcYkTyZcFKS5rIdAspnsxsKqvHcYV9aXADrUfaEc21QpGMLXVX1ddSiIpS2dz9YKlqXcChL01naG1DFKJlFShohfADCes+C6wM4E0e/4yR5pXye0ZLbVz4eX44EyDKlS3ZtpU9lur7OIV2oMAaeSAREYaY1GdrZkWe2O+t+V38yA7Jl6Z0a0lQI19Gng8XtE8OgGxwvcv8w4fa6+gD2ltULQvCSOFpSsq+71Q29BaG9iBye23IfbdT1EjYZpocTpspCmIEkLNiUh4wgUPx+7oePHBI7yXhN1lxuGQ8EwLnbMwYvm0133356SnWnc78TrsYyIA== 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=eVZpxqxt2vbi+6AHnTDpG54BWzJdcL9VsTS5wEF3vJs=; b=llvC4aRZHe7l1kM7IoIaBGp9DisDTygD7+Dc38+d4PUh3mKFgTW//SYXhoTPs1ZUJXKaWiNrILlqZ0glurFtnwIVqgJ6EKujvQzS1nfj+ja8iVF5Z1rkzTH5C8wLiiKf29tkf7qL7g/FRl7XiWMqPoRFERPHf4Q8wL1ZSfxt3IY= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by SJ0PR10MB5629.namprd10.prod.outlook.com (2603:10b6:a03:3e2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.26; Fri, 7 Jun 2024 18:53:28 +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:28 +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 10/16] maple_tree: convert mas_insert() to preallocate nodes Date: Fri, 7 Jun 2024 11:52:51 -0700 Message-ID: <20240607185257.963768-11-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: MN2PR05CA0057.namprd05.prod.outlook.com (2603:10b6:208:236::26) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|SJ0PR10MB5629:EE_ X-MS-Office365-Filtering-Correlation-Id: 57e3d91f-7cd1-494e-3d3d-08dc87231e1f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: WTEbk7w+Wz1C4OdBLx31MYD0OiiMSF5bvbTnSUnVrGU4hlxyjaJ57Gi1E9hjHMiAFYZCI96mN3YPVwscudNoP88TRS6ZsL0D/J7x71zJJ/MiGVsKIi79qSOEllLiz7LfV/JOQ1tCpFB5nQFPgq8Le0k4CttaYIkfKIm4A7PZK8Quq40hIce/Kfh/3cYYrbBmPk/YgPWnOYlIOFMba2NfUU4X2z0qQ8XLYnFX78yxe4IouCxYyMeHH5Jhck/228TusT0xNmYx0taZd9w31k6kpRiu131b6BGEfDt2EruZbaff+sIpXOCCIBWKWp6T6CJpdJu1WJaY0yUgEdGcchT/BeIoVFtx/3hlE7tfRY6ciu9LmK4QU8O4uU75yITHqtS7iYT6mGw680N183CHq5vgyDDWGRtyEHPGG3SqxXj1inDneSBQ8TAPAsiHpcVOyezl4LUaVNK+eroOJhQ0zbXbKSZ7+GJ+aD+s6U0MtgCtLEbsVdGMO5xb2AR+n1tuw15Oae/S3TO4O48Cl9i96f7WQjLm9IPr3P177vx5yF3Uh0bLq3KzAqBnr7ntmzD+RdM/zDSvnvGcSFd35PwJuyshopOskbz0VVcI1UG81q4oT7NHIRPeQEdLDUibGN9n+zURji7GTjmYvAeOkwXOYejwYiRArcK5j+hs7dD2y48Wnnr8a//LRRDqZT10rk2n76ep7skFDjErhTFhwb7712Kpb3zMoPDp2rnP+OleG93+dwGR7j14i3SBxsCORTvuUxE7/zXqSDOBb03PPpKMxEz7HHsciOJtMLSz6/2W/XdSaLkdNy+BE1AVd3MkG4MNLpfb/qXJLVUwWipfZcGeu3jMjx+M5fWW6zRf/uyKMYLoI3j2y3gMVscRAgfhs5abruqeJI9QfD1reqQbKYtGQ8+o9xXzYeLzmSJxM6dvNzD5eH3Kvn2APDWBGgajV03eCn6H4tBI6LSCIAOfyxl4FQ0FqE/ZcNqKvA0IqFBbsOGEv/4Wo1q+Sk+9sMSRFgaz7J4CGAKiMmePuYBVjjEVJqxzLtLzyla2qrxqpEAWlkm1UNhoK9+gl1o7Yq9mnUEufYiiqlQSUcmI8giFARq1Hi8RS5AiT5EKJBLt0L5oAHJQvJxVmFN6P7JzmuUfUMBxgNp4e2ovLfnb/tMrnqoifw44mSG7f8nDsAP4KKmzzxAd2reDqE0lSKTPZUhL5bCp1mC2rOv1HijK1qF6BYzbc8LBDMLUponCAlF7uSGRIiWuhrzg9GJGP8viFUfic3OUnfZUa36rVjoipeulhA4cLMD+eoPMgkpgaNoEOB5nFrJqfO5ywb7SjwsqSjq6tjPV8cVY 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)(376005)(366007)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8mytOo4cbF1iQU2cULe6pyu9qR6EwI5ngVTQWyoAb3bXuV2sOHs2lswMnSsm9m73AiJ9S95mPKTpKFBeEy1uThjSbaA/D0HuyIvYTghK8O+NiZssw0+8i3/OyE3y0YO7Qh1zGt6ZnuEEEr/tucTRElrxt1j+BW1do1D9S/p8xe4mI0TLLQvjQ8Wwk+JS9oXcXwPseevCMnuGBzCQrnHY9RmI8p37xVHfupYJU8YMUWz1ZKrX/3kLUZaeEn/UD+8S8XuzNjTXm5pzIK23fQMwSH6Kj36kk8s6yUyKG7+Sx6sQf5rGhH3dNSY4GcO0VraJDdAq1WS2LHSkf8eesSl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a6fe8aQo+T0qXUuP6+bH/MOWZ5PWLLl/BvDvm1Auv2c2W20g92b1pkrHMuM61hSvIZVOyynoaCoUAyfVyvQfENRgAEnvdStAeXXSjvCGFfvWxLF2hErJDnVaaT1WzLjboKTrq3La8YYEz4WDE51SstUfM6BgU1tGmztc+F1q7pjriKJxgp7J0/yRZ++4CDfmScxJMnOaNHeAlPB5QklRspcHHB6tHyKvRY+pAg= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: fqagOroq3N8zXVEUqcH0zbnoF8a77p7LM3yBOlnAsIkqf0BnRMqUo5oHguL7POXg9YveZMhidHldNK3K9sHtT+abBB1U9S0yj3KOZQo3N+296wrR8RRReVijuyEz5JA5Y+/1LiOMp+RakpqDzJu0DXtR373lRzTCdVq4y5w/tZ6wYUHoLABvSSzgTw20p7mKbh6Wkgm8QvueS8Ncn43yP32VVaw6j8fggZAG0wIK4hzhIxdpKvGe/MBeDynKuZ7viB7dF7GfxOFGjPBv7a5B0f2EqxBJcHmOzc0Q9jo01Iw2aE4YlMZQY6T+NAsBKAKhxSDZ9/1vTNiAcVcizdaw9PrmxR/qtZ9wIiNKK925VuIzuXWU66kwDfnMqgKkknGMNoBgYUI1ulWBRodF13phH68dvDX9rlVBMkpMmy0s7NsVBQNPDOX5/lVKRf7JsQSNkIXvEUtMWBAb/s/BHRSkJRnxNT+aEwIgtQbMeYO7YrLapExnDRSj7G3qsknp73/yKDbPfhAmG850oSIhQszAvIIX/YoZTfUNNLDMozptSL6PbQB4qlp+ZutoOcvY8n1Q6mKJiniVkH6dO1jPVaNYeKbSFv3endwWfLAsyHBUxO8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57e3d91f-7cd1-494e-3d3d-08dc87231e1f X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2024 18:53:28.1157 (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: qnwJ+apMvAJsbvjAjjGhA0HrSdRq02IBAlMp104A+qxH16xqnkOHzrwrczC9II+99xK+4AsY9gkgPt3scCbnx8M8Hjb1xnJYcb8qGH58GBw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5629 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 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406070138 X-Proofpoint-ORIG-GUID: WfjCc5LVIUqqxIfatAo4ADc8W21uDvhU X-Proofpoint-GUID: WfjCc5LVIUqqxIfatAo4ADc8W21uDvhU X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 648578000C X-Stat-Signature: r8mqbordkszt6u8rfrnj1ceb7cehru91 X-HE-Tag: 1717786426-588784 X-HE-Meta: U2FsdGVkX1/dN1EzOl2qjBkkZiHYyUMrUlIxsMo1732ENnM8Gbed2iYj8rM2McIhn5Y5uCvFeR1WNXSQeiFBQXwAOuxJ8k8jiYuNQ0IKCe0xwdhkBwihyQSbfOYyTFpbTWAosdsZuRxsaiFILZOzRrqYSzSoppqMJDK66Du9gI14TzSkvv86y4z3ND1QfxA1m+so2wzxtCNT9xPwCWLjPa17gL+ldRKdymvBH4MbMkYiLCiM13GMQW2gpI2QN0TdaFyPxRLd2jNuIJ2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HxnvtsVI3QXFzHz1VhqWnk3kCy4vk1FJcnO7FBcaqdsG0iubI64BDy5FL3P/bB3RAIWEPbkw7hO9gGfqyVIpBtowYInbQuq1o2nKwNNuJCav0SEp6yV76t/Q== 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: By setting the store type in mas_insert(), we no longer need to use mas_wr_modify() to determine the correct store function to use. Instead, set the store type and call mas_wr_store_entry(). Also, pass in the requested gfp flags to mas_insert() so they can be passed to the call to mas_wr_preallocate(). Signed-off-by: Sidhartha Kumar --- lib/maple_tree.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 2c42e99c400c..c37bfac4f622 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4442,11 +4442,12 @@ static inline void mas_wr_preallocate(struct ma_wr_state *wr_mas, void *entry, g * mas_insert() - Internal call to insert a value * @mas: The maple state * @entry: The entry to store + * @gfp: The GFP_FLAGS to use for allocations * * Return: %NULL or the contents that already exists at the requested index * otherwise. The maple state needs to be checked for error conditions. */ -static inline void *mas_insert(struct ma_state *mas, void *entry) +static inline void *mas_insert(struct ma_state *mas, void *entry, gfp_t gfp) { MA_WR_STATE(wr_mas, mas, entry); @@ -4468,26 +4469,24 @@ static inline void *mas_insert(struct ma_state *mas, void *entry) if (wr_mas.content) goto exists; - if (mas_is_none(mas) || mas_is_ptr(mas)) { - mas_store_root(mas, entry); + mas_wr_preallocate(&wr_mas, entry, gfp); + if (mas_is_err(mas)) return NULL; - } /* spanning writes always overwrite something */ - if (!mas_wr_walk(&wr_mas)) + if (mas->store_type == wr_spanning_store) goto exists; /* At this point, we are at the leaf node that needs to be altered. */ - wr_mas.offset_end = mas->offset; - wr_mas.end_piv = wr_mas.r_max; - - if (wr_mas.content || (mas->last > wr_mas.r_max)) - goto exists; + if (mas->store_type != wr_new_root && mas->store_type != wr_store_root) { + wr_mas.offset_end = mas->offset; + wr_mas.end_piv = wr_mas.r_max; - if (!entry) - return NULL; + if (wr_mas.content || (mas->last > wr_mas.r_max)) + goto exists; + } - mas_wr_modify(&wr_mas); + mas_wr_store_entry(&wr_mas); return wr_mas.content; exists: @@ -4532,7 +4531,7 @@ int mas_alloc_cyclic(struct ma_state *mas, unsigned long *startp, return ret; do { - mas_insert(mas, entry); + mas_insert(mas, entry, gfp); } while (mas_nomem(mas, gfp)); if (mas_is_err(mas)) return xa_err(mas->node); @@ -6536,7 +6535,7 @@ int mtree_insert_range(struct maple_tree *mt, unsigned long first, mtree_lock(mt); retry: - mas_insert(&ms, entry); + mas_insert(&ms, entry, gfp); if (mas_nomem(&ms, gfp)) goto retry; @@ -6585,7 +6584,7 @@ int mtree_alloc_range(struct maple_tree *mt, unsigned long *startp, if (ret) goto unlock; - mas_insert(&mas, entry); + mas_insert(&mas, entry, gfp); /* * mas_nomem() may release the lock, causing the allocated area * to be unavailable, so try to allocate a free area again. @@ -6667,7 +6666,7 @@ int mtree_alloc_rrange(struct maple_tree *mt, unsigned long *startp, if (ret) goto unlock; - mas_insert(&mas, entry); + mas_insert(&mas, entry, gfp); /* * mas_nomem() may release the lock, causing the allocated area * to be unavailable, so try to allocate a free area again.