From nobody Sun Dec 14 11:56:17 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 EC96B1A4F12; Sun, 13 Apr 2025 22:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.7 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744584744; cv=fail; b=B5g/X+xmvGR827e1SFgZGu0yQ/f2dBSeMLXb/GGf1GjCtY98RSTLvyS3NLNrNwmvc/qlfN3QyMLmPp6OuVDSDlyciFqtXT+2eITBmYrjUTeW4r5KWWV+SJ43IEX/MhElzd0bFJ9rajQVS8CVufRIOYoRLXmSCiEvSoGioPoLrQ0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744584744; c=relaxed/simple; bh=I3WlmoctCRsRu608KNgUHS/YZw7T8Cy+O3uuocH4P6Q=; h=From:Date:Subject:Content-Type:Message-ID:References:In-Reply-To: To:CC:MIME-Version; b=Lst5fsI2StonQPU1N4TNEGelsR4v9IZIlhx5OAT/FyzpoU1ta5NbWnFJtTXXffA3CUYfzIscQ+O9zmK3GUOZIblCC0lykfl96epfhJFUi+xO8lrZPSE2hLJnt/4B4MY/qDCstko+fSxn9lkDKyh+YtxBztvin4jX63KhRy5CODY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZST3pmnh; arc=fail smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZST3pmnh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1744584742; x=1776120742; h=from:date:subject:content-transfer-encoding:message-id: references:in-reply-to:to:cc:mime-version; bh=I3WlmoctCRsRu608KNgUHS/YZw7T8Cy+O3uuocH4P6Q=; b=ZST3pmnhPfhbws4hjfqmkVlLyU/9LF+uGC4XD+G0p8dprgf146h3Y4Rj K50cARm9NA59OSU3U5Jc7xI0Tb8TtZeVo5Y7XJxvJVIhBtPk7ukx7Zqk8 ZmSDJVI/+FLSP5GCpadJsrBuRkOsPJOyj0ZrcyDWR1CyLyhctxk/3mPz8 voccTImh9GVFThLM2/iAWkw56JHgQgi9oSR+Mraoc+LVE7BThtttjVmKh su1bmQ84qsljzqFZcGb45sp75n98n6oqeC1uKIFlKHDtof7fSh0ULDzjM j/fJTYLXPD3mzSqlqYx3DzsL+oWIrSBEK14F9mHZRAt770NXERi9EycRm g==; X-CSE-ConnectionGUID: jDu/PE+hTJyUy7IVHck1sA== X-CSE-MsgGUID: gKQVLi7CTHWN7Cgwj/QE8A== X-IronPort-AV: E=McAfee;i="6700,10204,11402"; a="71431127" X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="71431127" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 15:52:19 -0700 X-CSE-ConnectionGUID: cJFQ5mnFREyj02i9NpsGVQ== X-CSE-MsgGUID: AGMRhiOMTUe88Ic8DWwUOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,211,1739865600"; d="scan'208";a="134405567" Received: from orsmsx901.amr.corp.intel.com ([10.22.229.23]) by fmviesa005.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2025 15:52:19 -0700 Received: from ORSMSX901.amr.corp.intel.com (10.22.229.23) by ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Sun, 13 Apr 2025 15:52:18 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14 via Frontend Transport; Sun, 13 Apr 2025 15:52:18 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.43) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.44; Sun, 13 Apr 2025 15:52:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fpxlzGU5IcG9PLvzOTvNoBqP1EJwYuxViYM5NXhZ2xvTKM+Kujfp5DOoP2Wt/vvIdSYjWSemoBM1xvkU3y5oAsTgxaikjanDp7UQkq2wjNoZauGNgK0xh8jr4royjaHBcaUPCj7aZUjlfOPFyKeTOvIFiZcGbVhpiU156VPLH58tjvi9jVST6i8uwLP4sJKKNeeI2zmBnMjjJ9ACaEt6FHf2mj4qNC+SwMdn9rfLUwLq9kJXfJSwjcRR2vUANnvX9DvM60Rz6F8ItM+iXsn9vB1SG901312qUX+a6b+D3hlULQfi2ryrqgSQzy/fEuw65Ud/xfsNX4h1jr1/TAHJ5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=jyAR64KNiC3ycVI/tr64P83Q9uWSXaiB1fBj4L9rC4k=; b=rfxKIEBQeDGGtNpslYzRX8FEuC1Ukp8QvG1wsYyzRidfqn6SBImBGvc2zMdzeDg6wcXxMLrvpcZV+Nf7EYXcXweoh7EAaeGqjd7TbDczey/cdaL30020JZgdysj7dcwhbbIDoR1DxkYC2pVgDP/AqMfedhRU/BiT67kdZ3d6rRU2zcgCGuTCTlniVSZzbgkXk8ch3YcdB05I1of04xw2avXSYsON3o2m632wDh/GgmcnmtmSKCJVW/wIBo1X3l2bRL168wKcnWagHuwK2eXt3+g+J1OLmJH7Hh+M8s8TzhzzZ4T2d/m04yyfEd1sreXH10ndQuOGpO8oYLlRs1BOEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MW4PR11MB6739.namprd11.prod.outlook.com (2603:10b6:303:20b::19) by PH7PR11MB7003.namprd11.prod.outlook.com (2603:10b6:510:20a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8632.33; Sun, 13 Apr 2025 22:52:05 +0000 Received: from MW4PR11MB6739.namprd11.prod.outlook.com ([fe80::a7ad:a6e8:fced:3f24]) by MW4PR11MB6739.namprd11.prod.outlook.com ([fe80::a7ad:a6e8:fced:3f24%4]) with mapi id 15.20.8606.033; Sun, 13 Apr 2025 22:52:05 +0000 From: Ira Weiny Date: Sun, 13 Apr 2025 17:52:22 -0500 Subject: [PATCH v9 14/19] dax/bus: Factor out dev dax resize logic Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250413-dcd-type2-upstream-v9-14-1d4911a0b365@intel.com> References: <20250413-dcd-type2-upstream-v9-0-1d4911a0b365@intel.com> In-Reply-To: <20250413-dcd-type2-upstream-v9-0-1d4911a0b365@intel.com> To: Dave Jiang , Fan Ni , "Jonathan Cameron" CC: Dan Williams , Davidlohr Bueso , Alison Schofield , "Vishal Verma" , Ira Weiny , , , X-Mailer: b4 0.15-dev-c25d1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1744584735; l=8758; i=ira.weiny@intel.com; s=20221211; h=from:subject:message-id; bh=I3WlmoctCRsRu608KNgUHS/YZw7T8Cy+O3uuocH4P6Q=; b=SZlCPR6IP2f3V11QT1z1FurtF22u7DLngSx2eSok0vdhz6XAvsfvGjBYrZJyn92y5KcIVMN9C nOQz0m2c+e8CivFJGOP3HPXBytKHHFfFZFUrKgMA+bdddXtBILVoFNJ X-Developer-Key: i=ira.weiny@intel.com; a=ed25519; pk=noldbkG+Wp1qXRrrkfY1QJpDf7QsOEthbOT7vm0PqsE= X-ClientProxiedBy: MW4PR03CA0227.namprd03.prod.outlook.com (2603:10b6:303:b9::22) To MW4PR11MB6739.namprd11.prod.outlook.com (2603:10b6:303:20b::19) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR11MB6739:EE_|PH7PR11MB7003:EE_ X-MS-Office365-Filtering-Correlation-Id: b7297b40-7696-4093-ef03-08dd7addd014 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?B?VDc2amRVNG16Yk00bUw5Ynp0MGhWdTFCbDFpR1h6ZitKQzVoMUlydTE2U2xH?= =?utf-8?B?ZE9qa0NXM1dxN1hCV3UrclJUYVBia2NHRXhyMFpGWXB6Z0RNSUljcGtxL2Na?= =?utf-8?B?ak5oUGMzQVVwenVwT1I0MWVIdXN3aFZheWZpQXlyc0FTTENHQytFWFFDbWsv?= =?utf-8?B?cEI5S3JnVkE1SEZRRWhVTUZoNk9iMnJqRlMvQUNhOGEvMHJ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I;SFV:NSPM;H:MW4PR11MB6739.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aVRWb3FJbUw0R1Awa3d2SG5VLzcrcU0rMWplc1FOTkUrWldXamxVUFlUQSsr?= =?utf-8?B?TjdiVXdNUlpaQ1grZlpFTzlDVGxRRVV1WnR2YkFnT1VUSlpUMisyVHQ5Znls?= =?utf-8?B?TUJaZWRZTHoxcmNJZExTM3NoTjhCTE00bTRSMUxkUXVpTlNHYllsaERGQ2ps?= =?utf-8?B?b3h2cjFKSmdaZnU1amxPVjZZWDRFTzRjS3dGdjZUUnl0TEt6ZmRKS0w1TVFu?= =?utf-8?B?dzJ5dUFvWkNmQ2VhOCtrVEdhc3hYSC8vK0cyc0xMRnZWa0NkendkT3dDcjhN?= =?utf-8?B?K3haRWUzQ3Q1TWVQZXpyUjV2K1NOcUkyOWloenBFRWxkZUxDR2Vmck9ESk5J?= =?utf-8?B?N1ArNS92MzV6SlkzYzNOVzNqZ0xrenhZYTBJeDIzRzRmL1RabXdCNGRJNVh0?= =?utf-8?B?WXR0RmVuODYzQm1HSC94OTg0RUl3b2VWaGNUMjRNNkE3OExiK3BJOWxCWWlD?= =?utf-8?B?NFE5MFVvNWhHVGVBYktDYU9YMFZqSXBZb3N6MmVtSUNtNEo2NWt2MkZGYWFH?= =?utf-8?B?OW5OaU5YTVB6TS9BaVVXNkdsWnJWcnBDcEFPZFZSTmx4aVNIdDVGQVJObDBO?= =?utf-8?B?RXkwQ01iQ1ZRT3NoVHkvQi9JL2MvVll4Z05vc2NTcGhTa2o0RGFScndJSml4?= =?utf-8?B?SEhMV0ZLc1lvVzgxQkdXYXdJUnlSQ2hzb2M5cVVwZ2w0K1FwYW5ISzc1cmE1?= =?utf-8?B?UWtYa2hvSHFVT0xSM3o0T2N1VXM4Vlc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WkRKMjc3NFdYdzBscFFWdGhtYlFqajg4NGNiNHlhTVhKSWlLZU9XK0RLU2NG?= =?utf-8?B?cHFFTTZEQmFWbGFFZ2VRaEp5YlQrMXJSa2pBcjY4UEdSNVA0eXlEMVVkTnJ6?= =?utf-8?B?Y04rWno3Z3R5NzFjNFQ4U2VBR1dHbzg2a21NYUlwWlh5RzlCWHFUWVRXWlRr?= =?utf-8?B?SXNIL0x6dHJTMVMySWlZQkFMWkozK0N3bHZJUFRBSDZrakUyTXp0NlNGWnRH?= =?utf-8?B?eGQyUFZ2ZmZsUkJweWRUcmFpSGgwTTJ1R3h6WVlQa2dhZGNyb0NQRnV1MU9C?= =?utf-8?B?N1E2bS9lNXc1ZDVMSDZLSWNQUFd4clNiSitVVVBpY1BKbFlDTmp0TW5hLzlO?= =?utf-8?B?OFJmdS9wMTVjbHdpd2h2MWdPMkhuMG5TNTh2WG4zc1Q5Vk9sYlUxeVJpS3pH?= =?utf-8?B?UkRLaThvUGpTSFZpTVk0NjZqdUdwOEk0bWdaZWVLcURxTW9EWEtLaWxJcVdz?= =?utf-8?Q?/Tic0GqFiH7bPrC9ZbPbeKT2X?= X-MS-Exchange-CrossTenant-Network-Message-Id: b7297b40-7696-4093-ef03-08dd7addd014 X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB6739.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2025 22:52:05.6382 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: C0L1WF7ygDjoN7/gEPVm5cu6/8fIlUS5s8umbZDKjdGk/SLNbMjaYuHtMIviomwCEnSR59SKuTI3IhGTIHJeog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7003 X-OriginatorOrg: intel.com Dynamic Capacity regions must limit dev dax resources to those areas which have extents backing real memory. Such DAX regions are dubbed 'sparse' regions. In order to manage where memory is available four alternatives were considered: 1) Create a single region resource child on region creation which reserves the entire region. Then as extents are added punch holes in this reservation. This requires new resource manipulation to punch the holes and still requires an additional iteration over the extent areas which may already have existing dev dax resources used. 2) Maintain an ordered xarray of extents which can be queried while processing the resize logic. The issue is that existing region->res children may artificially limit the allocation size sent to alloc_dev_dax_range(). IE the resource children can't be directly used in the resize logic to find where space in the region is. This also poses a problem of managing the available size in 2 places. 3) Maintain a separate resource tree with extents. This option is the same as 2) but with the different data structure. Most ideally there should be a unified representation of the resource tree not two places to look for space. 4) Create region resource children for each extent. Manage the dax dev resize logic in the same way as before but use a region child (extent) resource as the parents to find space within each extent. Option 4 can leverage the existing resize algorithm to find space within the extents. It manages the available space in a singular resource tree which is less complicated for finding space. In preparation for this change, factor out the dev_dax_resize logic. For static regions use dax_region->res as the parent to find space for the dax ranges. Future patches will use the same algorithm with individual extent resources as the parent. Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Signed-off-by: Ira Weiny --- drivers/dax/bus.c | 130 +++++++++++++++++++++++++++++++++-----------------= ---- 1 file changed, 80 insertions(+), 50 deletions(-) diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index d8cb5195a227..c25942a3d125 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -844,11 +844,9 @@ static int devm_register_dax_mapping(struct dev_dax *d= ev_dax, int range_id) return 0; } =20 -static int alloc_dev_dax_range(struct dev_dax *dev_dax, u64 start, - resource_size_t size) +static int alloc_dev_dax_range(struct resource *parent, struct dev_dax *de= v_dax, + u64 start, resource_size_t size) { - struct dax_region *dax_region =3D dev_dax->region; - struct resource *res =3D &dax_region->res; struct device *dev =3D &dev_dax->dev; struct dev_dax_range *ranges; unsigned long pgoff =3D 0; @@ -866,14 +864,14 @@ static int alloc_dev_dax_range(struct dev_dax *dev_da= x, u64 start, return 0; } =20 - alloc =3D __request_region(res, start, size, dev_name(dev), 0); + alloc =3D __request_region(parent, start, size, dev_name(dev), 0); if (!alloc) return -ENOMEM; =20 ranges =3D krealloc(dev_dax->ranges, sizeof(*ranges) * (dev_dax->nr_range + 1), GFP_KERNEL); if (!ranges) { - __release_region(res, alloc->start, resource_size(alloc)); + __release_region(parent, alloc->start, resource_size(alloc)); return -ENOMEM; } =20 @@ -1026,50 +1024,45 @@ static bool adjust_ok(struct dev_dax *dev_dax, stru= ct resource *res) return true; } =20 -static ssize_t dev_dax_resize(struct dax_region *dax_region, - struct dev_dax *dev_dax, resource_size_t size) +/** + * dev_dax_resize_static - Expand the device into the unused portion of the + * region. This may involve adjusting the end of an existing resource, or + * allocating a new resource. + * + * @parent: parent resource to allocate this range in + * @dev_dax: DAX device to be expanded + * @to_alloc: amount of space to alloc; must be <=3D space available in @p= arent + * + * Return the amount of space allocated or -ERRNO on failure + */ +static ssize_t dev_dax_resize_static(struct resource *parent, + struct dev_dax *dev_dax, + resource_size_t to_alloc) { - resource_size_t avail =3D dax_region_avail_size(dax_region), to_alloc; - resource_size_t dev_size =3D dev_dax_size(dev_dax); - struct resource *region_res =3D &dax_region->res; - struct device *dev =3D &dev_dax->dev; struct resource *res, *first; - resource_size_t alloc =3D 0; int rc; =20 - if (dev->driver) - return -EBUSY; - if (size =3D=3D dev_size) - return 0; - if (size > dev_size && size - dev_size > avail) - return -ENOSPC; - if (size < dev_size) - return dev_dax_shrink(dev_dax, size); - - to_alloc =3D size - dev_size; - if (dev_WARN_ONCE(dev, !alloc_is_aligned(dev_dax, to_alloc), - "resize of %pa misaligned\n", &to_alloc)) - return -ENXIO; - - /* - * Expand the device into the unused portion of the region. This - * may involve adjusting the end of an existing resource, or - * allocating a new resource. - */ -retry: - first =3D region_res->child; - if (!first) - return alloc_dev_dax_range(dev_dax, dax_region->res.start, to_alloc); + first =3D parent->child; + if (!first) { + rc =3D alloc_dev_dax_range(parent, dev_dax, + parent->start, to_alloc); + if (rc) + return rc; + return to_alloc; + } =20 - rc =3D -ENOSPC; for (res =3D first; res; res =3D res->sibling) { struct resource *next =3D res->sibling; + resource_size_t alloc; =20 /* space at the beginning of the region */ - if (res =3D=3D first && res->start > dax_region->res.start) { - alloc =3D min(res->start - dax_region->res.start, to_alloc); - rc =3D alloc_dev_dax_range(dev_dax, dax_region->res.start, alloc); - break; + if (res =3D=3D first && res->start > parent->start) { + alloc =3D min(res->start - parent->start, to_alloc); + rc =3D alloc_dev_dax_range(parent, dev_dax, + parent->start, alloc); + if (rc) + return rc; + return alloc; } =20 alloc =3D 0; @@ -1078,21 +1071,56 @@ static ssize_t dev_dax_resize(struct dax_region *da= x_region, alloc =3D min(next->start - (res->end + 1), to_alloc); =20 /* space at the end of the region */ - if (!alloc && !next && res->end < region_res->end) - alloc =3D min(region_res->end - res->end, to_alloc); + if (!alloc && !next && res->end < parent->end) + alloc =3D min(parent->end - res->end, to_alloc); =20 if (!alloc) continue; =20 if (adjust_ok(dev_dax, res)) { rc =3D adjust_dev_dax_range(dev_dax, res, resource_size(res) + alloc); - break; + if (rc) + return rc; + return alloc; } - rc =3D alloc_dev_dax_range(dev_dax, res->end + 1, alloc); - break; + rc =3D alloc_dev_dax_range(parent, dev_dax, res->end + 1, alloc); + if (rc) + return rc; + return alloc; } - if (rc) - return rc; + + /* available was already calculated and should never be an issue */ + dev_WARN_ONCE(&dev_dax->dev, 1, "space not found?"); + return 0; +} + +static ssize_t dev_dax_resize(struct dax_region *dax_region, + struct dev_dax *dev_dax, resource_size_t size) +{ + resource_size_t avail =3D dax_region_avail_size(dax_region); + resource_size_t dev_size =3D dev_dax_size(dev_dax); + struct device *dev =3D &dev_dax->dev; + resource_size_t to_alloc; + resource_size_t alloc; + + if (dev->driver) + return -EBUSY; + if (size =3D=3D dev_size) + return 0; + if (size > dev_size && size - dev_size > avail) + return -ENOSPC; + if (size < dev_size) + return dev_dax_shrink(dev_dax, size); + + to_alloc =3D size - dev_size; + if (dev_WARN_ONCE(dev, !alloc_is_aligned(dev_dax, to_alloc), + "resize of %pa misaligned\n", &to_alloc)) + return -ENXIO; + +retry: + alloc =3D dev_dax_resize_static(&dax_region->res, dev_dax, to_alloc); + if (alloc <=3D 0) + return alloc; to_alloc -=3D alloc; if (to_alloc) goto retry; @@ -1198,7 +1226,8 @@ static ssize_t mapping_store(struct device *dev, stru= ct device_attribute *attr, =20 to_alloc =3D range_len(&r); if (alloc_is_aligned(dev_dax, to_alloc)) - rc =3D alloc_dev_dax_range(dev_dax, r.start, to_alloc); + rc =3D alloc_dev_dax_range(&dax_region->res, dev_dax, r.start, + to_alloc); up_write(&dax_dev_rwsem); up_write(&dax_region_rwsem); =20 @@ -1466,7 +1495,8 @@ static struct dev_dax *__devm_create_dev_dax(struct d= ev_dax_data *data) device_initialize(dev); dev_set_name(dev, "dax%d.%d", dax_region->id, dev_dax->id); =20 - rc =3D alloc_dev_dax_range(dev_dax, dax_region->res.start, data->size); + rc =3D alloc_dev_dax_range(&dax_region->res, dev_dax, dax_region->res.sta= rt, + data->size); if (rc) goto err_range; =20 --=20 2.49.0