From patchwork Thu May 18 14:55:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13246955 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 B09BEC7EE25 for ; Thu, 18 May 2023 14:57:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E3C7280003; Thu, 18 May 2023 10:57:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 66B6B900005; Thu, 18 May 2023 10:57:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BDCF280004; Thu, 18 May 2023 10:57:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3A6F0900005 for ; Thu, 18 May 2023 10:57:08 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C11B74088F for ; Thu, 18 May 2023 14:57:07 +0000 (UTC) X-FDA: 80803678494.21.B8F8AFE Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf13.hostedemail.com (Postfix) with ESMTP id 3883920013 for ; Thu, 18 May 2023 14:57:04 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=lnva68kS; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Hc38volS; spf=pass (imf13.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684421824; 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=0gyCDIKC93BPQ76stKJ0o4Op1QUgFXcRfpAud8qjgE4=; b=zPQKSgDPK2xdYNI8vYwDT5QeGU2Eu9QaVwPpHCPSiwr1MKhXAfyJv89rWdgJz1cLfZu5Zl qsHXbNmXtQ1dumcUFcGQpdstOYqvjX6q67bE0sWPpGPotFWspgD6f7yqXCGl7yaPeTTvYH T1Gn8j/Z9YzFcvXUZOkTAeHkPTcSpzs= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1684421824; a=rsa-sha256; cv=pass; b=T2yfS/HDEFOz67LXl7yzjATUM/s2/GG9FNWsLigmVjh6fuG/HlchmqaLYQv75N7eKAKj7f h/bAqANRfJCjNMCginh5GKxrg/5GTH1d0XJT54W+i/Bg9L2B3n9lXeC7ob2U/6ZMY1/bBM OUVFy0B7L+LP/0ZkQ3g6TWzTSHHKw4M= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=lnva68kS; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Hc38volS; spf=pass (imf13.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34I6JDTm018335; Thu, 18 May 2023 14:57:03 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-03-30; bh=0gyCDIKC93BPQ76stKJ0o4Op1QUgFXcRfpAud8qjgE4=; b=lnva68kSo21o0aH1JC4h9OJcPhe4YEmXRna2qQc17X2kH+uZJ2I+9MBFASoysp4nmZmr sXd/qcH4NJMp9WglDrDdmEz8lAxZ+PY71XW5f8X29s9MZjbVchc8qWECT82HDkGzfuXa orUXMJp7V6sMykGM2eY7sg/iikJoPzfl3Wr0IZH9g3YFNvB+k/Kp9YoWjGKFeQdfTOmi jlOINMd67+OYwPD/OQuh7ilm7KPjqVs37EQ9kpLBSyIIQZUWAyBkjAftbalXGMtmYKWO 9VvNu/USi5zSyt8Iky3hHlyyhtNgkceDLRdvx+1Gp5cix+uT/iB0hyt5lP2qOxI/TBmq jA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qmx8j2vq3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 May 2023 14:57:02 +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 34IEXVLW036331; Thu, 18 May 2023 14:57:01 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2106.outbound.protection.outlook.com [104.47.55.106]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qmm03w47f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 May 2023 14:57:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eG/qlrq12kr7tuLTEsnLYA5lDsQdb/2xIWtjc7PV5BvtHapUAUuULiE/zgsSfpK6uqKwZ5UWq6p8W08LIlBrNzmBeezNq1e9EdDPHxzya5zYl3lXwqJe4NvawaOpGs4y16MpYJ/CZx4vlxtxANraTqvCHFrn401xx7ej6gV+1gjGl0MPTLfkUda3hbP4Kd11Sj9zbZp4hQwfzsspjXm9IrqEUfIkiKwjhdky5RHbjieqCV7qDhjaq8lvPBSAseF3rfptHjy+o968rf7pURiYqsMhKPI/jfzNLczz0hAQUs+C2vkhGB4+LJAslr8592cQApQ0qTZdE0viQcr6n0CcCQ== 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=0gyCDIKC93BPQ76stKJ0o4Op1QUgFXcRfpAud8qjgE4=; b=SDU71bLJpLY9Ai8VL0KbUu3FpnZ3qBpNEjmm4j9YdaZO3iJ/QzMIHGiovEkPYARDZQUv+GsAD6O+lM1InQRLy4NpBoqs8sq/JPX6CJezmCvX4OQnEiIOkzVVfk4hMAKcejAdhAxUVZAInjn5Hg0HRDStLT46K/vO9rb97Rs5LVa1Jz/rYPWeXp+fG5/Vkwjq3MQogBbXbiGJqxuKAiLsoKm6JYwm4CEi9OXQIDGDcYZfyW6XK8j4M7iKhafvU+WonZkGuLl0GmzNPeL8yruyJBhXSQrQYdzXNhP5gPdSkQlPtU/MCHUV9WKp8mlwB3eHQqvli8hs/Tm9sgkV/1S9OQ== 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=0gyCDIKC93BPQ76stKJ0o4Op1QUgFXcRfpAud8qjgE4=; b=Hc38volSE3m+xSa2G8uxF+5yONa9GjHd/qOXYS8WMssbR9gnPVnlEPRdBCJuheRrQBGD4xHOCz/x8liv/AilIQx58deNK8pXCNLTCNDCEP7RskYg7xgePTAJvOtRPyB1E9/q5u9wP4TXhRgEVBD8dGpBM9BFaA0kzv/8mSTiQtg= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DM4PR10MB7427.namprd10.prod.outlook.com (2603:10b6:8:181::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Thu, 18 May 2023 14:56:58 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6411.017; Thu, 18 May 2023 14:56:58 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v4 28/35] maple_tree: Add mas_next_range() and mas_find_range() interfaces Date: Thu, 18 May 2023 10:55:37 -0400 Message-Id: <20230518145544.1722059-29-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230518145544.1722059-1-Liam.Howlett@oracle.com> References: <20230518145544.1722059-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1PR01CA0122.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2c::31) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|DM4PR10MB7427:EE_ X-MS-Office365-Filtering-Correlation-Id: af7d2979-f9dd-41ef-0f9e-08db57b02102 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XzCI15xzlLLUNsHzoZ0bXkP7Ip4oe42g9nbJ+4i49BTxzA/O1mWAJ/P9UUHckOigBGAtSYbNT2ID22FX3oPyNAZ1Oa3k535JYQLgQoP36JG+dPRiQ67UOLbHZD3yz1cf4zfsyAGrVwAOatPgY3FhpnXbNM47na8boT3DKNP2weowJUpqOtsUs8QM0Cy4RjyzOMowMFELumJOG8+d/4ajVXSp+tPuUZp1D/4iW5/eUrqLGoNBmdCYEPp+ow7Ha2DDip3G7bGWiyXaM0lp1V0vuY1tor9N/V/v4kwvnYYJRL/ndF/YuFk10YfmxS9C1/Fl3woXzDDY0p121hGwj+Bb70JC06kbzekuPa8s9mxIHK1sXxtV0D5vdE1OpRgqoVEbfORZkVts1cqbXFXPHhaZX4RW1wUIZC+I02kj9X+CgisFj4miNxhM9b/kKVLvwoJjon44a5f3KfJsxmcwc2NX5oB+0whb8zOFuPMC+zXs5urXXCh693RZ7tzPzl/XhcKk3xZmv0Tq71mTYtT3JOMNdXKCW84DTmRwuI8b6mLs23ZpC1x5qZlBTVdCABxZou/Y X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(396003)(346002)(136003)(376002)(366004)(451199021)(8676002)(5660300002)(8936002)(4326008)(316002)(6512007)(1076003)(83380400001)(6506007)(26005)(107886003)(86362001)(186003)(38100700002)(2616005)(41300700001)(478600001)(66476007)(6666004)(66946007)(66556008)(6916009)(6486002)(36756003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q8iw9Ka/PnVEh31if7PG0pmilDgQb97az3is4ylGhJ40dENa43CCER1GPobECiW9T+4K65GNyNYlXwISDKjdSC2M/D/Ei9299DFS/rS9uPrfZwZKFD+7CrxkyEFFVCPx91gWRf38Zdd5BkuY26BieSWonVAKTxDm3CN4Mhgr704gS/kPMOR2ehxVazv2HmgrxvX2rb6hzGxZ1A0j6h8pGKxOV2PDISzhTTcbOvr6wme+uf5CathXfgHyPjaLzJd8FTL028apOHVLCfT44t7ehwpzlZ9gdOiISu9igef0FrVwJmM4Vi0f0DWXkoC7ZUtZD/ypSTRvJ3tBCrf+o359uCkZpLnJnt3l6z/HGwzkTjnBON1LMgRRcGO2dbsVW8HszYoiQlGgT1CpnMbDNU0Tva5ID7hq+bWUVWRRgeSMWJa64XU7mmfvhgVc6ErpFSKNzMw81M7FOvIt3S7euEx0grO4QB32sKDZLSdqT49yySINPOduWRDeDqyLzZokWkglyl2CoBfuHOSZXUJiir8vglliY8UFIUTmfGcdALaVIOgXzSYeY7CpwFwlbf3LwQsAmVKhXBVZht0Yvr7WFnlEmuvHoq9QQwfLNVE5VMtuV+y+cL6/sylEtDZFFakLo/+icyn8LjNf8tL0YvKivYm7kHYGrXIbACEDTByEBwwJznOiMoyi57v1svYWaaBXattVm1V7tPX7qN1I/c6BnZWAp2C99XdphOBoVerR6LGS02IaCwHwBRk5oe1+84xEf9u24ukIRJMoBDbHGAN0Gq/1tahsk/62TV5q73JFybWQTEkFM0zLunMS3ORt+26A0mAAL/lOQsi8UnV4f/lZWXGbtcsG4g4Rr78NFdNkwqDmMVLpxniz9YYCLr+o9Hv3+TzI/7U/2aH5F9zNLaOC4nWJcmv0GYxGvQn4nIbiudlQyP/yozfN6ls9YD77swVE35tzYCjR+o9ZRP6fM4vgvEq8JD3TOLNfZ2ycuCiRP7fHW86mVrxbRdMNk/Id8HlxEqJtVPRkQvFHE5BmLuNOECVjMGAkXZNtnY3pQK70lKw+fxHw45hJ2OavtqksTB0k998RL4IKpYh422do5IUppLucfB01LuZ8F9YZ7b+o7b0BkbMo58oDrRFdyFlhX4tWJQX4yB2JtDn30K0esqowLxi3FLzNFtsACzM7z9pTkfSiGtaj1lUt/LvzbamCAVUde00woJ+7bmfzq/IixV29P/Cf6EiKlQhz49LtWw0Zsbx9kkXf8+ySjfTQQVKMcWLJVKwJ3Ect/GSvAFsign48RPKyWS/rxHyA0yd1hKZYUsTJK20eOxXv0tLEQQcE2PVjtBxjhFm3jZQOIXIZstjdH497Wxj0FEP9nQRMAggfN6D4SKr5NYqMvQMW16EqyX8DFzwLPae9AmFk45fR5aa9YZF+Z9ue6d1+irEguxf2z9EkNCiB9aWyLQV/nL1OKZ8WM14h353yt2dU7dYc70zh2hABMNDCIbckMwIpRjPKZhL5spilMbZrvdB2C4olt4L95clDDUijQ9sxNUmVGwhlk0qT13RN01NjhmNktofANN/P7BAK3Ut625tooOG1BqHJ4PTq6EWhra8Xdq+pC4vI9Mpadw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: fQL3GSMfXf+ULnGzcaUIBOU72maZ+L4eetJiHDNOx3V8DjbLvd+YC6XUCSB8XHJQRbEPPcob6qU1E6XuRYPfvJCNFZAdIKls58jH1ZSLw0DOLJy+42SB9j72mftVSErb6aagGqzuLYeupIHv2E7wSMgCK/hOh72T+Ffm7NN5cLGXeFRcQK2H0jIWNrv5xDZwH/MUsM99yku+xz+Cb0c3nznhip9bjL026c0ajxxFzmYo5xBTdx5v2tdjCtrHp7EY323gc+EiWmA/APELA+N89gp+7TLtadu1dQXXiJEWBwMTyUZyEIMN0swBM4sOR7cIa0B9XEL5Rjh2A1XfuljHdo8NaygPzeNQ4QLXjVbKZFA1P5+1UqjW/R7UfOA6+9V0MgifTP4rS+MH9jaAX6Tj34wWxOPlvaahob4WLjSBg6c9IdxdQP8kemiCijn+jLHp6AXueyAAcDDgkbPPOjCmlNQ/hLIRsiltjCFT5hwmU0MwK3vA4gMC0SD5vdNcZqhmzEWYJf/pPa1d3HeiAVxAFelTJjwI8rqVqvKEFUiyUpwcfO1qywNnKhEoSN0SSHiBp/l8fQYsMwLIOJGZrGtVvW6RpwAQwRh0shbcSlte0udOdYdARbbwVqjnb04sg8Bj1Fj7T2TLn3ZhExh7t6LlkgP15oFa0fVaMbVkl4XcYOPBeR9j4C4cnrhK1LqVAEJxDi35bkLXIramew8yjIPznU/ULx+AspxVOCWELQJRSr9NIjmgUZ9chCbJ47B8jybJTo03tnQlxNBXrgJSp1Nc49QhW/riIkGtFdG/xhCyH/bH02kZxQSQH/xsYtLOrvoBZJRDER8SnqZQCdSz7yusl+vzjUWYrPjStS87+NuwHFCXyi06HJU5ADSKIC2/ZVVBmRvKmZ2Oue9o2QsLYR9B2w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: af7d2979-f9dd-41ef-0f9e-08db57b02102 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2023 14:56:58.4505 (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: u59zC5DxlY6DI7lDhruYJlarOksT2kBpmwcrpMrJ5kTX93E77hLBH4bmfAeMGE8yRbO8HCojeAhP2F9VSKnuDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7427 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-18_11,2023-05-17_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305180120 X-Proofpoint-GUID: zRrZvx-ozfeRgEKek_FlX8EficT-XQxg X-Proofpoint-ORIG-GUID: zRrZvx-ozfeRgEKek_FlX8EficT-XQxg X-Stat-Signature: 34ehwtttc6nis8i6abr7kqaus6xshp14 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 3883920013 X-Rspam-User: X-HE-Tag: 1684421824-374455 X-HE-Meta: U2FsdGVkX19qf8DA1p73ARFkKioBUHM/vlsxnD31MKEHhIxMrZnvQdN/BGm3mQ7nJ55xujCASUQ6t1+pmYdRn3cuH1TNxSWJcwqLEzkX9viDfnvSn1uSndytlUuXADkKbfSmCkMSjCuCo6WeQ7oZX0FwSvRbXnW76xLI/Kcvg2Rn5Bqt/q5/rSgWqnh0FFh+RANit9EOKCAmF4g4H9ZL9XGGN5g3aQGb38V7JUGGR6I3QL2cbsLDAvVbYYxcUVYsvN6WMnRe+sk3XqPDIwMAjJEe13BU80S8sWpgOTwbRUNpIwK6aG0FaSltWCGihDM1/XCT4wJYjBieUi67mQk7Q8fdKlw6B5BUaA5TsRup1LinrCeQzrYVzMh3DgtrOx4zvc8Zd7xw2Fh+1JUaYoodAdNG5rZorZ/1k1bh3AYSaziL0vJevwQspk2SFJjCgK+4J54cDKz84Y0/CAgXqZMAdxLQ9o3oQ3K87SfgN8xaVyYki+9F81EwR0W8I8+xNg9BWkefF6UoC78+xemp3qSGIH+sgcLfdaeOxAzgMoBc+uO3iY+zMYFNWjBKkL0RnW03Du6tRg+CwNEigC0TPYXIMXNt4QOTWoZwDpF5jKgZtfS1C9rhwvy2RycjOut2Ulqs/jvF9hH5thYhD16y6M57rz1KmJkpyzYforhjHZbDWjzINKSyy03oKugWSIwJS8bo4AJbFGrK9Achd794H1++1STmimJHUIaAFX+hgB4TU4YXHt6r4SeZnyFonLwi5K30Npr+WkkmH4OElx+/VYD9i+ASI8lzfYq0yRY7woiL8DZjO0TsVPi27uK9GFhUnUnRn8zIL5hur5Db0eiAmDOhUqDIdsALHS7XQ+oBRAr4Ib7sHWsSUaDlewSC7pnHZItJO3GfePCKGRNrDdKROB7c5BL448dXP+YqIr705ycr/ZjUcIeBe+4CPc5vZSrVE4LSvFqraQ9rYw2ku3s7O9G vJSOdKpw 3vuWsd7LqDh1dFlBatvaa9OyUDojEQ8h6l1uNmDXeY2RpvLrXqzxRIxn2fOC7SzhJd1UM+qzYPXWvWF4UtHQyeqJCKtrhcTJ1tLRiMBPd7Ktk7qoUXyPPtbwL50aGMBanAwCUvGecgREtH2dvWaUpl7Stw6LJ3+bNJGiq10vNbd/T43yFEcA2p32fSRKdgEGXLA+AUPxAlsvPQzxIP4pHxiUTthhuIPeC+94GAsi+W0QGka3FgE2UHmKphw/AhqkpXCb7SGTRIRlQfY3Rf4T6fXrp79vWdP+IfO+7lJ3V8uBOpBagqNlnnYMBbKUmrCbKOx9Vj44C9sgLQz9SmNUuIbpREqhURQNgm/CqDl6cJD4K7mq7WG3RNpKTElbz/Fd8F5YKA+uoCDR//N8cgL3E65QzdQs7HR9s+/J2yVOAG7xiG6c= 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: Some users of the maple tree may want to move to the next range in the tree, even if it stores a NULL. This family of function provides that functionality by advancing one slot at a time and returning the result, while mas_contiguous() will iterate over the range and stop on encountering the first NULL. Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 3 +- lib/maple_tree.c | 172 ++++++++++++++++++++++++++----------- 2 files changed, 124 insertions(+), 51 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index ed92abf4c1fb..9d040043858a 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -455,6 +455,7 @@ void *mas_erase(struct ma_state *mas); int mas_store_gfp(struct ma_state *mas, void *entry, gfp_t gfp); void mas_store_prealloc(struct ma_state *mas, void *entry); void *mas_find(struct ma_state *mas, unsigned long max); +void *mas_find_range(struct ma_state *mas, unsigned long max); void *mas_find_rev(struct ma_state *mas, unsigned long min); int mas_preallocate(struct ma_state *mas, gfp_t gfp); bool mas_is_err(struct ma_state *mas); @@ -467,6 +468,7 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries); void *mas_prev(struct ma_state *mas, unsigned long min); void *mas_next(struct ma_state *mas, unsigned long max); +void *mas_next_range(struct ma_state *mas, unsigned long max); int mas_empty_area(struct ma_state *mas, unsigned long min, unsigned long max, unsigned long size); @@ -528,7 +530,6 @@ static inline void mas_reset(struct ma_state *mas) #define mas_for_each(__mas, __entry, __max) \ while (((__entry) = mas_find((__mas), (__max))) != NULL) - /** * mas_set_range() - Set up Maple Tree operation state for a different index. * @mas: Maple Tree operation state. diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 860f82e16166..b5df37be7a15 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4792,13 +4792,10 @@ static void *mas_next_slot(struct ma_state *mas, unsigned long max, bool empty) */ static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit) { - void *entry = NULL; - if (mas->last >= limit) return NULL; - entry = mas_next_slot(mas, limit, false); - return entry; + return mas_next_slot(mas, limit, false); } /* @@ -5885,18 +5882,8 @@ int mas_expected_entries(struct ma_state *mas, unsigned long nr_entries) } EXPORT_SYMBOL_GPL(mas_expected_entries); -/** - * mas_next() - Get the next entry. - * @mas: The maple state - * @max: The maximum index to check. - * - * Returns the next entry after @mas->index. - * Must hold rcu_read_lock or the write lock. - * Can return the zero entry. - * - * Return: The next entry or %NULL - */ -void *mas_next(struct ma_state *mas, unsigned long max) +static inline bool mas_next_setup(struct ma_state *mas, unsigned long max, + void **entry) { bool was_none = mas_is_none(mas); @@ -5904,24 +5891,71 @@ void *mas_next(struct ma_state *mas, unsigned long max) mas->node = MAS_START; if (mas_is_start(mas)) - mas_walk(mas); /* Retries on dead nodes handled by mas_walk */ + *entry = mas_walk(mas); /* Retries on dead nodes handled by mas_walk */ if (mas_is_ptr(mas)) { + *entry = NULL; if (was_none && mas->index == 0) { mas->index = mas->last = 0; - return mas_root(mas); + return true; } mas->index = 1; mas->last = ULONG_MAX; mas->node = MAS_NONE; - return NULL; + return true; } - /* Retries on dead nodes handled by mas_next_entry */ - return mas_next_entry(mas, max); + if (mas_is_none(mas)) + return true; + return false; +} + +/** + * mas_next() - Get the next entry. + * @mas: The maple state + * @max: The maximum index to check. + * + * Returns the next entry after @mas->index. + * Must hold rcu_read_lock or the write lock. + * Can return the zero entry. + * + * Return: The next entry or %NULL + */ +void *mas_next(struct ma_state *mas, unsigned long max) +{ + void *entry = NULL; + + if (mas_next_setup(mas, max, &entry)) + return entry; + + /* Retries on dead nodes handled by mas_next_slot */ + return mas_next_slot(mas, max, false); } EXPORT_SYMBOL_GPL(mas_next); +/** + * mas_next_range() - Advance the maple state to the next range + * @mas: The maple state + * @max: The maximum index to check. + * + * Sets @mas->index and @mas->last to the range. + * Must hold rcu_read_lock or the write lock. + * Can return the zero entry. + * + * Return: The next entry or %NULL + */ +void *mas_next_range(struct ma_state *mas, unsigned long max) +{ + void *entry = NULL; + + if (mas_next_setup(mas, max, &entry)) + return entry; + + /* Retries on dead nodes handled by mas_next_slot */ + return mas_next_slot(mas, max, true); +} +EXPORT_SYMBOL_GPL(mas_next_range); + /** * mt_next() - get the next value in the maple tree * @mt: The maple tree @@ -6031,49 +6065,41 @@ void mas_pause(struct ma_state *mas) EXPORT_SYMBOL_GPL(mas_pause); /** - * mas_find() - On the first call, find the entry at or after mas->index up to - * %max. Otherwise, find the entry after mas->index. + * mas_find_setup() - Internal function to set up mas_find*(). * @mas: The maple state - * @max: The maximum value to check. - * - * Must hold rcu_read_lock or the write lock. - * If an entry exists, last and index are updated accordingly. - * May set @mas->node to MAS_NONE. + * @max: The maximum index + * @entry: Pointer to the entry * - * Return: The entry or %NULL. + * Returns: True if entry is the answer, false otherwise. */ -void *mas_find(struct ma_state *mas, unsigned long max) +static inline bool mas_find_setup(struct ma_state *mas, unsigned long max, + void **entry) { + *entry = NULL; + if (unlikely(mas_is_none(mas))) { if (unlikely(mas->last >= max)) - return NULL; + return true; mas->index = mas->last; mas->node = MAS_START; - } - - if (unlikely(mas_is_paused(mas))) { + } else if (unlikely(mas_is_paused(mas))) { if (unlikely(mas->last >= max)) - return NULL; + return true; mas->node = MAS_START; mas->index = ++mas->last; - } - - - if (unlikely(mas_is_ptr(mas))) + } else if (unlikely(mas_is_ptr(mas))) goto ptr_out_of_range; if (unlikely(mas_is_start(mas))) { /* First run or continue */ - void *entry; - if (mas->index > max) - return NULL; + return true; - entry = mas_walk(mas); - if (entry) - return entry; + *entry = mas_walk(mas); + if (*entry) + return true; } @@ -6081,23 +6107,69 @@ void *mas_find(struct ma_state *mas, unsigned long max) if (unlikely(mas_is_ptr(mas))) goto ptr_out_of_range; - return NULL; + return true; } if (mas->index == max) - return NULL; + return true; - /* Retries on dead nodes handled by mas_next_slot */ - return mas_next_slot(mas, max, false); + return false; ptr_out_of_range: mas->node = MAS_NONE; mas->index = 1; mas->last = ULONG_MAX; - return NULL; + return true; +} + +/** + * mas_find() - On the first call, find the entry at or after mas->index up to + * %max. Otherwise, find the entry after mas->index. + * @mas: The maple state + * @max: The maximum value to check. + * + * Must hold rcu_read_lock or the write lock. + * If an entry exists, last and index are updated accordingly. + * May set @mas->node to MAS_NONE. + * + * Return: The entry or %NULL. + */ +void *mas_find(struct ma_state *mas, unsigned long max) +{ + void *entry = NULL; + + if (mas_find_setup(mas, max, &entry)) + return entry; + + /* Retries on dead nodes handled by mas_next_slot */ + return mas_next_slot(mas, max, false); } EXPORT_SYMBOL_GPL(mas_find); +/** + * mas_find_range() - On the first call, find the entry at or after + * mas->index up to %max. Otherwise, advance to the next slot mas->index. + * @mas: The maple state + * @max: The maximum value to check. + * + * Must hold rcu_read_lock or the write lock. + * If an entry exists, last and index are updated accordingly. + * May set @mas->node to MAS_NONE. + * + * Return: The entry or %NULL. + */ +void *mas_find_range(struct ma_state *mas, unsigned long max) +{ + void *entry; + + if (mas_find_setup(mas, max, &entry)) + return entry; + + /* Retries on dead nodes handled by mas_next_slot */ + return mas_next_slot(mas, max, true); +} +EXPORT_SYMBOL_GPL(mas_find_range); + /** * mas_find_rev: On the first call, find the first non-null entry at or below * mas->index down to %min. Otherwise find the first non-null entry below