linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/3] btrfs: refactor __btrfs_run_delayed_refs loop
Date: Fri, 21 Sep 2018 16:39:14 +0200	[thread overview]
Message-ID: <20180921143914.GH5847@twin.jikos.cz> (raw)
In-Reply-To: <1534318796-23111-4-git-send-email-nborisov@suse.com>

On Wed, Aug 15, 2018 at 10:39:56AM +0300, Nikolay Borisov wrote:
> Refactor the delayed refs loop by using the newly introduced
> btrfs_run_delayed_refs_for_head function. This greatly simplifies
> __btrfs_run_delayed_refs and makes it more obvious what is happening.
> We now have 1 loop which iterates the existing delayed_heads and then
> each selected ref head is processed by the new helper. All existing
> semantics of the code are preserved so no functional changes.

What a mess, took me some time to understand and find the hidden loop,
this is a perfect counter example. Thanks for fixing it up.

Reviewed-by: David Sterba <dsterba@suse.com>


> -		rb_erase(&ref->ref_node, &locked_ref->ref_tree);

There was a merge conflict with the rb_root_cached tree update, but the
fixup was trivial.

> +	} while ((nr != -1 && count < nr) || locked_ref);

I can't be the first to notice that the '-1' is signed long compared to
an unsigned long. This part is not obvious as this means to process all
delayed refs, called from the contexts like commit.  Replacing that with
something more explicit would be good.

  reply	other threads:[~2018-09-21 20:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-15  7:39 [PATCH 0/3] Refactor delayed refs processing loop Nikolay Borisov
2018-08-15  7:39 ` [PATCH 1/3] btrfs: Factor out ref head locking code in __btrfs_run_delayed_refs Nikolay Borisov
2018-09-21 14:30   ` David Sterba
2018-08-15  7:39 ` [PATCH 2/3] btrfs: Factor out loop processing all refs of a head Nikolay Borisov
2018-09-21 14:39   ` David Sterba
2018-08-15  7:39 ` [PATCH 3/3] btrfs: refactor __btrfs_run_delayed_refs loop Nikolay Borisov
2018-09-21 14:39   ` David Sterba [this message]
2018-09-21 14:43 ` [PATCH 0/3] Refactor delayed refs processing loop 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=20180921143914.GH5847@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@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).