public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gladyshev Ilya <foxido@foxido.dev>
To: Qu Wenruo <wqu@suse.com>
Cc: Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 0/8] use cleanup.h in btrfs
Date: Thu, 13 Nov 2025 11:01:16 +0300	[thread overview]
Message-ID: <39aedcbd-aca9-4963-8131-a3cdb7a4289a@foxido.dev> (raw)
In-Reply-To: <31b5e88c-0979-44cc-9e7a-1cb3320caf39@suse.com>

On 11/12/25 23:55, Qu Wenruo wrote:
> 在 2025/11/13 05:19, Gladyshev Ilya 写道:
>> This series represents my experimentation with refactoring with
>> cleanup guards. In my opinion, RAII-style locking improves readability
>> in most cases and also improves code robustness for future code changes,
>> so I tried to refactor simple cases that really benefits from lock 
>> guards.
> 
> Although I totally agree with the guard usages, it's not yet determined 
> we will fully embrace guard usages.
> 
>>
>> However readability is a subjective concept, so you can freely disagree
>> and reject any of those changes, I won't insist on any. Please note that
>> patches 1-3 can be useful even without lock guards.
>>
>> I didn't know how to split this series, mostly because it's just a lot of
>> small changes... so I tried to split it by types of transformation:
> 
> And even if we're determined to go guard path, I doubt if it should be 
> done in such a rushed way.
> 
> There are already some cases where scope based auto-cleanup conversion 
> led to some regressions, no matter how trivial they seem.
> Thankfully they are all caught early, but we have to ask one critical 
> question:
> 
>    Have you run the full fstest test cases?
> 
> If not, please run it first. Such huge change is not really that easy to 
> review.

No, because it's RFC only [however I tried to verify that no locking 
semantics/scopes changed and I tried not to touch any really complex 
scenarios.]
> Although I love the new scope based auto cleanup, I still tend to be 
> more cautious doing the conversion.
> 
> Thus my recommendation on the conversion would be:
> 
> - Up to the author/expert on the involved field
>    E.g. if Filipe wants to use guards for send, he is 100% fine to
>    send out dedicated patches to do the conversion.
> 
>    This also ensures reviewablity, as such change will only involve one
>    functionality.
> 
> - During other refactors of the code
>    This is pretty much the same for any code-style fixups.
>    We do not accept dedicated patches just fixing up whitespace/code-
>    style errors.
>    But if one is refactoring some code, it's recommended to fix any code-
>    style related problems near the touched part.

Personally I don't like this approach for correctness-sensitive 
refactoring. When it's something dedicated and standalone, it's easier 
to focus and verify that all changes are valid

> So I'm afraid we're not yet at the stage to accept huge conversions yet.

I would be surprised if such patchset would be accepted as one thing, 
honestly) For now, it's only purpose is to show how code _can_ be 
refactored in theory [not _should_]. And then, for example, if there is 
positive feedback on scoped guards, but not on full-function guards, I 
will send smaller, fully tested patch with only approved approaches.

Probably I should've been more clear on that in the cover letter, sorry...

      reply	other threads:[~2025-11-13  8:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 18:49 [RFC PATCH 0/8] use cleanup.h in btrfs Gladyshev Ilya
2025-11-12 18:49 ` [RFC PATCH 1/8] btrfs: remove redundant label in __del_qgroup_relation Gladyshev Ilya
2025-11-12 18:49 ` [RFC PATCH 2/8] btrfs: move kfree out of btrfs_create_qgroup's cleanup path Gladyshev Ilya
2025-11-12 20:30   ` Qu Wenruo
2025-11-12 18:49 ` [RFC PATCH 3/8] btrfs: simplify control flow in scrub_simple_mirror Gladyshev Ilya
2025-11-12 18:49 ` [RFC PATCH 4/8] btrfs: simplify function protections with guards Gladyshev Ilya
2025-11-13  8:43   ` David Sterba
2025-11-13 10:06     ` Gladyshev Ilya
2025-11-13 11:25       ` David Sterba
2025-11-13 12:30         ` Daniel Vacek
2025-11-12 18:49 ` [RFC PATCH 5/8] btrfs: use cleanup.h guard()s to simplify unlocks on return Gladyshev Ilya
2025-11-12 18:49 ` [RFC PATCH 6/8] btrfs: simplify cleanup via scoped_guard() Gladyshev Ilya
2025-11-13  8:48   ` David Sterba
2025-11-12 18:49 ` [RFC PATCH 7/8] btrfs: simplify return path via cleanup.h Gladyshev Ilya
2025-11-12 20:50   ` Qu Wenruo
2025-11-13  8:54     ` David Sterba
2025-11-13 12:48       ` Daniel Vacek
2025-11-12 18:49 ` [RFC PATCH 8/8] btrfs: simplify cleanup in btrfs_add_qgroup_relation Gladyshev Ilya
2025-11-12 20:46   ` Qu Wenruo
2025-11-12 20:55 ` [RFC PATCH 0/8] use cleanup.h in btrfs Qu Wenruo
2025-11-13  8:01   ` Gladyshev Ilya [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39aedcbd-aca9-4963-8131-a3cdb7a4289a@foxido.dev \
    --to=foxido@foxido.dev \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox