[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251113084847.GH13846@twin.jikos.cz>
Date: Thu, 13 Nov 2025 09:48:47 +0100
From: David Sterba <dsterba@...e.cz>
To: Gladyshev Ilya <foxido@...ido.dev>
Cc: Chris Mason <clm@...com>, David Sterba <dsterba@...e.com>,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 6/8] btrfs: simplify cleanup via scoped_guard()
On Wed, Nov 12, 2025 at 09:49:42PM +0300, Gladyshev Ilya wrote:
> Simplify cases with multiple unlock paths like
>
> spin_lock(&lock);
> if (something) {
> spin_unlock(&lock);
> goto faraway; // or return
> }
> spin_unlock(&lock);
>
> with scoped_guards() to improve readability and robustness.
>
> Signed-off-by: Gladyshev Ilya <foxido@...ido.dev>
> ---
> fs/btrfs/block-group.c | 20 +++++-------
> fs/btrfs/compression.c | 13 ++++----
> fs/btrfs/extent-tree.c | 8 ++---
> fs/btrfs/extent_io.c | 33 +++++++++----------
> fs/btrfs/free-space-cache.c | 63 +++++++++++++++----------------------
> fs/btrfs/qgroup.c | 38 +++++++++++-----------
> fs/btrfs/send.c | 37 ++++++++++------------
> fs/btrfs/tree-log.c | 13 +++-----
This is probably the best example of the worst case of the conversions.
8 files changed, many of them likely target of future fixes that would
need to be backported, churn in many lines besides locking, code flow
and error handling is supposed to be improved but each instance needs to
be verified anyway. So this is quite costly cleanup.
Powered by blists - more mailing lists