From patchwork Tue Jun 18 20:47:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13703033 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 22C9DC27C4F for ; Tue, 18 Jun 2024 20:49:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 905E78D0059; Tue, 18 Jun 2024 16:48:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EDA48D005E; Tue, 18 Jun 2024 16:48:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A8748D0060; Tue, 18 Jun 2024 16:48:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DE8F08D005B for ; Tue, 18 Jun 2024 16:48:45 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 98E321A0B18 for ; Tue, 18 Jun 2024 20:48:45 +0000 (UTC) X-FDA: 82245198210.17.82C0A07 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf27.hostedemail.com (Postfix) with ESMTP id 5301E40017 for ; Tue, 18 Jun 2024 20:48:42 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=o0CPx6Xl; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pHllqfjW; spf=pass (imf27.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=reject) header.from=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=1718743717; 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=ufcKmhI0a06m227Amm2QLiJQHiBuHSuMUYBepJaIpeI=; b=6it5tFnmrAUbjXLhmaeYXVKDTAYbn1IohGPperXsxgH2Ko5EelzoQmwbxCoL4pX3pPZ5Ok jdf7HGoZLpeGG1XYHeGUI9Q6PYgbpDkk3kbfeaviE4HQznuVnY/zXZtK/V0By52jncIO2D II0HSQzbtnDXR6/rZ1MwwQWLUdOKwKo= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=o0CPx6Xl; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pHllqfjW; spf=pass (imf27.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=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1718743717; a=rsa-sha256; cv=pass; b=CymD69ogex/gzEcQ9P+i3YmJJUxd+DJ0rwHWzVPk+ucPv69p3NDHzrpUkrjFP/OeK1DVJh eCC3P89CGyXM6XekpKNK+a52GCJQMMZJKrqQ2391phmFpL6KK9bRviXmrb3fG8gaL9d9mZ GTLc6b1UWofuBzPFE9gcZ5bhmtcWGxo= Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45IIUo5Q001568; Tue, 18 Jun 2024 20:48:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=ufcKmhI0a06m227Amm2QLiJQHiBuHSuMUYBepJaIpeI=; b= o0CPx6XlsYCtt165HO3NV5VBX7kL4yRTALa/lUrg0RDAUznPgUW9E6E2xJ2L2loC YOl6sxsA9wrE8DqNTg+AhbZu6KBKyNhtlvx8aOr2qnRf4Z6jyWhPQYwUN3segl4C az6U35pTRpIGG47Mh6Me2VcrjBwRkFXJlEO+yaqz0kt2ZgkK2pB7B8kUgrm0zjoI GUxirLKfv5b1XI8A0GwprvBx7ZF5GBLIEqeCXCQ6cT4mgMUjVXBu+7ZvoycrrYRl sHxlP4XjpSJIzIg3EXa1bclEOjtgTWpf3y218XQzQsn7eFQI2+HoLHZ6Zm4HGkNV bEyqvBC/F0dryt+YFIUHnw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ys3gsnw8v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2024 20:48:35 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45IJlTIW034656; Tue, 18 Jun 2024 20:48:34 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ys1dey4ud-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2024 20:48:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nSU5upelj8Efh6gkvY4EgGvOIZw059UtCaLLChX4FCgx2Q3PMYRzqpZiLRrAR121uVYAaheKGSLTifJdtR9JQJFjdui5gQBdmxmYENAs99DIcSHLEw43YqHt5pruTRZIBEk0QoLZe37VpgJVYV1Zk+2lGwlR1+ryUYltUL2BPBmVJTwJbJXLy9GdMBC+UOPZByYjpLb0k/Eu1068t1CO3PXbVUotvDyKiVmrlmLRHWWlCmcIG6OClpxvhieA9BPMEjwgG+0jKYixdQ8lLowjEx6DT4oyEcefnLh268U3WUf16Q0WQLmUr1XhX3BNwREHOx2mPoqQG7tJlvti3J24OA== 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=ufcKmhI0a06m227Amm2QLiJQHiBuHSuMUYBepJaIpeI=; b=OYmu4WhWM4OWmEqnXvQoQ0+iSyQr3/Lr5p6eCYVUwjCAaw79mVVUL4goAKnmYutSqVEk5dhixQd6SYg9BIUFu4DXTB2mzXSWGCpA8iINvfhrx/kYdj9PBafISepnZ4oPkRhMRMp2ElZe5C8D0HzNjmu20bFqm6VKjeIfsZCEellPaycy0S6dgOsfgbAfFczXeOsf5t7HT/ZPHk/hP6PKYYYYOLqn8ZK9d1mYBpe0PlQf/UfK4YdJERyYhpOjLNn/hmI/btX59qn7de6zTf6oCX5xPn/G9oxv2xCeLsFxLWh8eyYBGUr6qsfuQ9lTZr4EdtBd2o4AEJPWpDGSsmI/fQ== 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=ufcKmhI0a06m227Amm2QLiJQHiBuHSuMUYBepJaIpeI=; b=pHllqfjWOpEyOhQdvdQGI/TOC+oJqi+gU2eG9gxRnsTM7z4zPYzXSXSkqynsLlspDuTEcOe1sfrAJdoY440CNWKlUd8HmldZQVrIOefANJQmTS9rzUfWk/FGsygxGZY4jWHTemrRWl3SvPSSZXd5oRBCwz76AM7YE2WZMXrg+JE= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CY8PR10MB6465.namprd10.prod.outlook.com (2603:10b6:930:63::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Tue, 18 Jun 2024 20:48:27 +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.7677.030; Tue, 18 Jun 2024 20:48:27 +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 v3 13/16] maple_tree: have mas_store() allocate nodes if needed Date: Tue, 18 Jun 2024 13:47:47 -0700 Message-ID: <20240618204750.79512-14-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240618204750.79512-1-sidhartha.kumar@oracle.com> References: <20240618204750.79512-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR04CA0030.namprd04.prod.outlook.com (2603:10b6:a03:40::43) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CY8PR10MB6465:EE_ X-MS-Office365-Filtering-Correlation-Id: 7409078f-5286-4708-7270-08dc8fd800f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|366013|376011|1800799021; X-Microsoft-Antispam-Message-Info: T43cBfcq/9chhrXLe1LWXzj0cvE9GJxWyo+5JBvbuezbUoHa+bC6vM1rhH4PRF1LDKAa56ivmi22y7Jr3zVYDh3C7GDoAMOim3O5kbt/dZ2uAuSflGK8LstVR6RqAaxWKSOi0iVhQMLB88rVgBxyQ9nu3DL1/IuUfm14mk6gqXAnlm4excvp3HgD5y2FbxfO7c3IoFyHryV+LSsAS5NmS+aTzfEqRpryyVwEjjGYxckWWiBxbrfXPnlGOh1lp0cE0sgeZg4egzBjPJQ5ENVd366bHWUaQmup4s0jBAt8a5BJoNry2HiS+bl+PcK22Uer6ceSXmq1K9esogF3TCUIyZfPrBOdl0YXkSbDwOrjC1fzacL9cq/xvX3CYBoOysGUi3d5TUqjF5JsjKjIZorfWFV+kBH4+SUuqp+4GAzVAr4ubDsiRzcWvk1JWOimqM04hskN17wXtJK+v8o9DGkMlQLMuBihS/XNz34/tRujNZhP7VKaI6OU2vA9aE2Ps8eLdLCG+GZ6nkvf4i6BOQsK3N6EKWyytqcLpsqUJRaBTClRHzOGcri1wj5BtV88VucGec84NyiqslykGmDASwBfBgwERFE3KtfCh7UjOh6BrN+a8QeRoZelkTu4ipRM0xtvEF7Y8w5ipIc55hw9BndM48G5mAVRS0DhU3eG3KLan1bKmAue5jP6GD2tiMMktLj7loKMwastSe45tmsVUAqEgYLcROZfQxb6LbPTQgfUmlOgsHfVmpPCArH+cTi5mkH18QcL6ZOSWIvaefkwXXR3XEkwDWilpQyLf4ejL1vkpdgt94+npD+mCmd2O88FluF0HP8ETeNMExgtjQqL+unv7LOoTCFAAp6KG51IRFVJYr/N6lBt7in/5GdO18E1R873QUC2NNNT5R//p5R7Hi20cIHakY4D6DSJyMvVZV2WsJLR0Ow+2XBfpRt6OlZaXRW00aPlV552+Wx5ggKVTxULolHa16k83zXaCeE4nnouMpMaXP8JXUcIKHQ7h8hZVrYi5E43q7sHzgJA3Zllg7vuH0ge8qXH3oaP34Ql3jE27P6fmn6Y3f6A4Wuqs1UVJQTfvU4LrKVS81fFr1N11psodDiSvKtorBhOtG2opoWhehke7tAeRW7xfZVWS38K5eDCs8mwEuhiSRElBiK3x0slFfM+Sv3N+x9xdXdQL98KjNP0hqXOZiqxtxU8Gjso6fJzqakWazJUMylV3sKpaNlLrcACM7RSaLadQO1+uwy+d0fiKGcllH5eMSpG/u0OANlBPL+eZk1hZJ2XBegIQT3F/BFbR6vogyu4fTDQUVeh5n8= 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:(13230037)(366013)(376011)(1800799021);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5p696o8GXnaf9WuoQrkak7tX6Om1J99d0kahf1DuhttDuBcfFDI7OI+jqAC7SYedihekJOjmg+jfua+ZrOEoYmFbOD8+uHZBbJoizLPEisyhY9tdfLn8dkIlww/9UVTz59saAONDWjzIFgfPkY+YCxc/e0rEW4IPHgKgi8x6sm4/4FN9x7MeKV7yq3OBnLpCEjrVmFSuWfL32ywtzURM6NgMLet2k0MHlpeY2iAAcfJ43RCwq5AOBkTmKd0Paf88qPT+gZK5MoilZoFjjo6CqiBG3C8bjgmmjATktEG+s7Ta7iGGcwP+xYAey2yowOGpET8im07c7NV59HRu5JIhTg8bXhEFJEJlEpqxwby5WkPUuER92NsPb9pQUWZrkFb9Im5BBQehF2wq6dGYTKNKB8ypLCS3+6cK6PVkWynUmvS5PkT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0CE2XkPyEZmdfJJzhzSKpcLT10SFElPmE6y0sKXDYEK5Eiucz4QRlO0pMvD9F1JI+2h1v4yoUNTEDgPWvq7t9gSHM/baxloCFtHWKccuDO4Vnh6DAmFCnXTXMHwcFq2U= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UjTfgKRNNHr4ItMgRg1icyaOv+gMetpcy4bLY2Ybn/fkBC1Z5AGO9BT8JMUplMbzg1m8XvBdNiZo0cVJhP4skK8oM9RFqmKBpwkgdSnMaDK6podiaS5+4rSm/m3NTLFFnyZe1HqKfAz0o4PyCG3hZnj4GWLxTeZiqtOyunxjroGFdWYmfyQ7UisgLRFtUfelfQpqrCb3jdkBY2V/hbWvIyjEU2KtKwYBpTSJteyEq/Zl+bUVgnTyuucyCd/kX2Kg3DM1tlJi1AiGr5K3gqUOlvY8DK4W/2nfvd6kLhTtkDGsCkDzS2I4r6io7RwA7m17HeEGhKxMf+z1j1gFvi4Pu/WxsCjRnKan+jxomrT4GMMpHg7YvZVz9Nn1glG/NPeppGRaZhQiAuZ8Ayzf25K7JiD2Ykqh7SB4CrKzdYBErV2kCbmDC7G0yvQs9ac4r41lcgYmOG3fFRvaLBV8r+YP6TD2+rbsaIcyUfbUccPGOaSbZCrQ0DMNniafVZIkkldILI1beKSruTmEtjJxcaj3u3NjDVZ/2pH1Sd64gOLT8yKhvMevaktjPeLodnMD0zLQ5IzoKNZCP2rGeMSrXrGoPpk/DvcN6fhjCPq5Bn9QSwQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7409078f-5286-4708-7270-08dc8fd800f2 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2024 20:48:27.3171 (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: 58uE0oZzb83TiW2KbfbwLFySnLq/Xy5D/K902PNLOq0cy2+6ijAagLVMbFzOd9sjLTpESFAwGmFpFsP/K+aORhcbe8olABYKlLzY6TdInjw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6465 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-18_04,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 malwarescore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406180153 X-Proofpoint-ORIG-GUID: IKVFcOnYnJ8T9Mn0Wo5s0oRaKcuoK8Kw X-Proofpoint-GUID: IKVFcOnYnJ8T9Mn0Wo5s0oRaKcuoK8Kw X-Stat-Signature: ci3dfgaiz5dcth7myfhunrci8o7enkou X-Rspam-User: X-Rspamd-Queue-Id: 5301E40017 X-Rspamd-Server: rspam02 X-HE-Tag: 1718743722-182884 X-HE-Meta: U2FsdGVkX18FjLxJnytm+l13qVYddsmPT/DY9TENUanJQi5bMMHdn7fkJf2n8XBoWqkk/fxou+cCHpf/5QtfOfnemkZvu7nsqRaTm8xUiwNQYWjXY70MNKLafsnwQp9lFukJGQOJ2+lw+jBxFeLIgB8j8T/SH9+qaElX/QHVmBAeQU/1Jk7n/cKLzT1mL60KOI0TW02XbfLzBi4eIImBhLZjMAKDjjUEtQVdjv+nlqARyA5NEiiMMwymxWwyBJn8LodOCPmo3DYaZKkXvxutWQzRstaWdp3E4GuNt31y0osZB8RSp+BrF0JVecuWP2w4385o6V/DynZObH0ToGDyWEakpAv4J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uNkDn+YDoBWTDcS5NJV7fu2nABt13hsfFD9oIS4Y6uNMk4x/2UWuEzLaq98SKq4jA== 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 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 98c64aaedb55..46bdc4ce6662 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5536,13 +5536,12 @@ 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. */ void *mas_store(struct ma_state *mas, void *entry) { + int request; MA_WR_STATE(wr_mas, mas, entry); trace_ma_write(__func__, mas, 0, entry); @@ -5565,7 +5564,24 @@ void *mas_store(struct ma_state *mas, void *entry) */ mas_wr_prealloc_setup(&wr_mas); mas_wr_store_type(&wr_mas); + WARN_ON_ONCE(mas->store_type == wr_invalid); + if (mas->mas_flags & MA_STATE_PREALLOC) { + mas_wr_store_entry(&wr_mas); + MAS_WR_BUG_ON(&wr_mas, mas_is_err(mas)); + return wr_mas.content; + } + + request = mas_prealloc_calc(mas, entry); + if (!request) + goto store; + + mas_node_count(mas, request); + if (mas_is_err(mas)) + return NULL; + +store: mas_wr_store_entry(&wr_mas); + mas_destroy(mas); return wr_mas.content; } EXPORT_SYMBOL_GPL(mas_store);