From: Nikolay Borisov <nborisov@suse.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: Refactor unlock_up
Date: Tue, 14 Dec 2021 18:18:26 +0200 [thread overview]
Message-ID: <0ecf0600-9768-d8d4-b79a-bc997a28f36f@suse.com> (raw)
In-Reply-To: <YbiuGuFdSM/BWHzk@localhost.localdomain>
On 14.12.21 г. 16:45, Josef Bacik wrote:
> On Tue, Dec 14, 2021 at 03:39:39PM +0200, Nikolay Borisov wrote:
>> The purpose of this function is to unlock all nodes in a btrfs path
>> which are above 'lowest_unlock' and whose slot used is different than 0.
>> As such it used slightly awkward structure of 'if' as well as somewhat
>> cryptic "no_skip" control variable which denotes whether we should
>> check the current level of skipiability or no.
>>
>> This patch does the following (cosmetic) refactorings:
>>
>> * Renames 'no_skip' to 'check_skip' and makes it a boolean. This
>> variable controls whether we are below the lowest_unlock/skip_level
>> levels.
>>
>> * Consolidates the 2 conditions which warrant checking whether the
>> current level should be skipped under 1 common if (check_skip) branch,
>> this increase indentation level but is not critical.
>>
>> * Consolidates the 'skip_level < i && i >= lowest_unlock' and
>> 'i >= lowest_unlock && i > skip_level' condition into a common branch
>> since those are identical.
>>
>> * Eliminates the local extent_buffer variable as in this case it doesn't
>> bring anything to function readability.
>>
>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
>
> This was weirdly difficult to review in both diff and vimdiff, had to look at
> the resulting code to see how it worked out.
>
> Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Yeah, sorry about that but the function has a bunch of IF's ... I could
have probably broken it into 3 patches but each separate refactoring is
really small.
>
> Thanks,
>
> Josef
>
next prev parent reply other threads:[~2021-12-14 16:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 13:39 [PATCH] btrfs: Refactor unlock_up Nikolay Borisov
2021-12-14 14:45 ` Josef Bacik
2021-12-14 16:18 ` Nikolay Borisov [this message]
2021-12-14 16:21 ` David Sterba
2021-12-14 16:35 ` David Sterba
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=0ecf0600-9768-d8d4-b79a-bc997a28f36f@suse.com \
--to=nborisov@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
/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