linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs: ctree: Reduce one indent level for btrfs_search_slot()
Date: Tue, 10 Sep 2019 11:24:17 +0300	[thread overview]
Message-ID: <c5db2dfd-19df-685c-71fb-e7e0e59a0b85@suse.com> (raw)
In-Reply-To: <20190910074019.23158-2-wqu@suse.com>



On 10.09.19 г. 10:40 ч., Qu Wenruo wrote:
> In btrfs_search_slot(), we something like:
> 
> 	if (level != 0) {
> 		/* Do search inside tree nodes*/
> 	} else {
> 		/* Do search inside tree leaves */
> 		goto done;
> 	}
> 
> This caused extra indent for tree node search code.
> Change it to something like:
> 
> 	if (level == 0) {
> 		/* Do search inside tree leaves */
> 		goto done'
> 	}
> 	/* Do search inside tree nodes */
> 
> So we have more space to maneuver our code, this is especially useful as
> the tree nodes search code is more complex than the leaves search code.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

I actually thing this patch makes comprehending the function worse.
Because the else is now somewhat implicit. E.g. one has to pay careful
attention to the contents inside the first if and especially the
unconditional 'goto done' to be able to understand the code after the
'if' construct.

  parent reply	other threads:[~2019-09-10  8:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10  7:40 [PATCH 0/3] Small code style cleanup for ctree.c Qu Wenruo
2019-09-10  7:40 ` [PATCH 1/3] btrfs: ctree: Reduce one indent level for btrfs_search_slot() Qu Wenruo
2019-09-10  7:54   ` Anand Jain
2019-09-10  8:24   ` Nikolay Borisov [this message]
2019-09-10  8:31     ` Qu Wenruo
2019-09-10  8:42       ` Nikolay Borisov
2019-09-23 16:09         ` David Sterba
2019-09-10  7:40 ` [PATCH 2/3] btrfs: ctree: Reduce one indent level for btrfs_search_old_slot() Qu Wenruo
2019-09-10  7:58   ` Anand Jain
2019-09-23 16:32   ` David Sterba
2019-09-10  7:40 ` [PATCH 3/3] btrfs: ctree: Remove stalled comment of setting up path lock Qu Wenruo
2019-09-10  7:51   ` Nikolay Borisov
2019-09-23 16:36 ` [PATCH 0/3] Small code style cleanup for ctree.c 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=c5db2dfd-19df-685c-71fb-e7e0e59a0b85@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).