From patchwork Thu Jan 25 10:26:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13530355 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 877071CA95 for ; Thu, 25 Jan 2024 10:26:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706178392; cv=none; b=DQDhq12S6RcTyF4SEVMnMvXhpOJESziZkJmYkM+43KXmP2+QA5tUVb727WRRejkOOFt+/iiKgQ6M322PugJS6FCwHufa6smVZpCTSwfC0RAjCUvZUT/sXRKoWykVbWc1DcK7pPaqBhxAJI1+NnXjyp7AV1W26Ahj8LOFMrnT65E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706178392; c=relaxed/simple; bh=7FrmPtriUSfYwwbZALzwmNLp7jyb4VUDGzOBW/ewuhM=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=WH3KZMVqXYH0OYkq2jN0bni6B/3eg1MJ1GnnmOu+K09d9EPElkxmPP4LtOf1m8Aiw9k+EZkAFZpC2182wPtNEkN4EJr3UZlSX2NKwA+MdAl+2hPLGCNvoVQO8SmLn9kniynsj0c0hlkDcC0HA4Ya4prELF8fwllueUQtFxB8DfE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qRqndaOJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qRqndaOJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97C5AC433F1 for ; Thu, 25 Jan 2024 10:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706178392; bh=7FrmPtriUSfYwwbZALzwmNLp7jyb4VUDGzOBW/ewuhM=; h=From:To:Subject:Date:From; b=qRqndaOJryU8WW0k6dG9rbBYsTijhMRnwOTPFulAOxlctr39ZPhPX4wgNg6IB8bSw s677gwXKBBPG98P0a78RM2vPd1+6iCn0M77uroXZapkzS1YdpUtM8sAbkg+bUgSfwZ 22l2nuFFlDz2lhnZO8JWivEI4vwXGa6e/TSkO/EmHWQ5XgGhLSP+a10XPwauGlG/VC hqLzVrqrj+JXMKaUbunuBbkzGSrN732uB4GY3gU8CGyNqQq6ln2zLuE8IXQ2s0Se48 NhgKOUssW0796vftCqib13KxCM1q+b0aOT6SWiaqTez83MgEGYeFnKjaL9W87lOIG8 XojV/0QiFOiNw== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 0/5] btrfs: some fixes around unused block deletion Date: Thu, 25 Jan 2024 10:26:23 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Filipe Manana These fix a couple issues regarding block group deletion, either deleting an unused block group when it shouldn't be deleted due to outstanding reservations relying on the block group, or unused block groups never getting deleted since they were created due to pessimistic space reservation and ended up never being used. More details on the change logs of each patch. Filipe Manana (5): btrfs: add and use helper to check if block group is used btrfs: do not delete unused block group if it may be used soon btrfs: add new unused block groups to the list of unused block groups btrfs: document what the spinlock unused_bgs_lock protects btrfs: add comment about list_is_singular() use at btrfs_delete_unused_bgs() fs/btrfs/block-group.c | 87 +++++++++++++++++++++++++++++++++++++++++- fs/btrfs/block-group.h | 7 ++++ fs/btrfs/fs.h | 3 ++ 3 files changed, 95 insertions(+), 2 deletions(-) Reviewed-by: Johannes Thumshirn Reviewed-by: Josef Bacik Reviewed-by: Boris Burkov