From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-b1-smtp.messagingengine.com (fhigh-b1-smtp.messagingengine.com [202.12.124.152]) (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 9DA23450F2 for ; Fri, 30 Jan 2026 00:11:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.152 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769731918; cv=none; b=WpXMKOF/zHh1nk9aBcE/vnOR2RZrWzcXUk0P2huPlnUF5uL3rOl6sEpe0dRnGvZzekxgE7uiHNeRDCdLcPpDKFnS8NXyqWO2EEIPB6dVIbfnlPDAaSPjAdbfacvtFINnOR0DEjQPqPflqBAh2gts0mKn3ZN8OAYSOJJ/YxPmvnY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769731918; c=relaxed/simple; bh=Cry29UxfZTdOJDUIOd3L+ZRDKNvzFtLK0YySIZuCtw4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Ygc/PD7MvzvvRBrZUS8AsoMEi9Fm20oTdfzJxElGzkaEztUmCbD44w425j3ryux5jXmrWUMF5VrEG34tMzfcpCDWp1BWC+D8bf1D63Hazz8czzgJPNFbU+iGZfqaOCpchaeFYL5I639p7jdgRICcmZB9WgjyKelY0r5I0g5Hkk8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bur.io; spf=pass smtp.mailfrom=bur.io; dkim=pass (2048-bit key) header.d=bur.io header.i=@bur.io header.b=lN6sx0Tv; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Jltic62i; arc=none smtp.client-ip=202.12.124.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bur.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bur.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bur.io header.i=@bur.io header.b="lN6sx0Tv"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Jltic62i" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id C723A7A0064; Thu, 29 Jan 2026 19:11:55 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Thu, 29 Jan 2026 19:11:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to; s=fm1; t=1769731915; x=1769818315; bh=o9ly8q6kwLfyrMA/5+mVb 7VwSWwKKit4Wd5wW075i+I=; b=lN6sx0TvTdFr4cHXthBhExixHm/BuOcdDgzi2 XKH1astkQVzZrEPrZZx/AYlS0oMaBI2eknQ+EntyxPTsbG4GDs40GJ7wTg31ejKG snu88wiG4xrtnRZ3HXN3FVtn16bQ4ibqHGMYMv4YBAhHoVY8ibugPgti0zOs61yb fITKZNGh0lirs8kzXPucKp0kfOUzfxcPr0Q+qCJPhtzsjSJVJxP4TJGGvM1VjG1c KqGoAcsFsUP2WZ5tddOJG1Dk7Vs/9rwL1PR+B8MFxpp6OUH0pKfRK+/0jdzvDojR /6PZofEIqHGpwK8bO4Vi9+Wq/9mwelyGsUBVHfLnqlgx45D5A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1769731915; x=1769818315; bh=o9ly8q6kwLfyrMA/5+mVb7VwSWwKKit4Wd5 wW075i+I=; b=Jltic62iGrNCv9Li6oKQnFAU4l3K1RyDXh6IlrVcrJodvK7TtQR AUZsbcPeNkjqMUHh0aew+wZz3RIDPgmHqJoZy1a/t7qZbawF+lIEP+4jFJnqWvH8 q90ReD0SIC9Xk+LTDzLUnx6mOrk9J7IW0XuegD1TkC52icKGw6ozHIYjC9UIzI01 rV59GSkZsvL29J2jzDJ290wWTbm6n/rKzANCs61FhauGp9de5y7sfFiNRSum4zIs Ja4gNJr2jQtoktFmagBJwFPJtYzTEMlEEWqiJDzzXGF6TxlqBwRSlAmpmZt7ih/m Sx8GZj2UI4Nq02Q9gpUfLGa+daJe+Ale3uQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduieejiedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtredttd enucfhrhhomhepuehorhhishcuuehurhhkohhvuceosghorhhishessghurhdrihhoqeen ucggtffrrghtthgvrhhnpeduiedtleeuieejfeelffevleeifefgjeejieegkeduudetfe ekffeftefhvdejveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpegsohhrihhssegsuhhrrdhiohdpnhgspghrtghpthhtohepvddpmhhouggvpe hsmhhtphhouhhtpdhrtghpthhtoheplhhinhhugidqsghtrhhfshesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehkvghrnhgvlhdqthgvrghmsehfsgdrtghomh X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Jan 2026 19:11:55 -0500 (EST) From: Boris Burkov To: linux-btrfs@vger.kernel.org, kernel-team@fb.com Subject: [PATCH v4 0/2] pending chunk allocation EEXIST fix Date: Thu, 29 Jan 2026 16:11:20 -0800 Message-ID: X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Fix a somewhat convoluted bug in chunk allocation with non consecutive pending extents. Also, add unit tests covering the new search functions and fix a build warning Changelog: v4: - fold the build warning fix into the unit test patch - clean up subtle and not-so-subtle coding style issues I missed in the AI generated test boilerplate. v3: - fix build warning when CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set v2: - change the semantics of btrfs_find_hole_in_pending_extents to return the largest hole on failure. A different bug in the implementation of the incorrect v1 semantics was hiding this. - add the unit tests - add the build warning fix Boris Burkov (2): btrfs: fix EEXIST abort due to non-consecutive gaps in chunk allocation btrfs: unit tests for pending extent walking functions fs/btrfs/Makefile | 3 +- fs/btrfs/tests/btrfs-tests.c | 3 + fs/btrfs/tests/btrfs-tests.h | 1 + fs/btrfs/tests/chunk-allocation-tests.c | 476 ++++++++++++++++++++++++ fs/btrfs/volumes.c | 246 +++++++++--- fs/btrfs/volumes.h | 6 + 6 files changed, 673 insertions(+), 62 deletions(-) create mode 100644 fs/btrfs/tests/chunk-allocation-tests.c -- 2.52.0