Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 1/2] btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure
Date: Thu, 18 Aug 2022 14:14:48 +0200	[thread overview]
Message-ID: <20220818121448.GI13489@twin.jikos.cz> (raw)
In-Reply-To: <e1cde76ba6cf7b14d6f38310113588d6486d5a00.1659989333.git.josef@toxicpanda.com>

On Mon, Aug 08, 2022 at 04:10:26PM -0400, Josef Bacik wrote:
> +static void __btrfs_remove_free_space_cache_locked(
> +				struct btrfs_free_space_ctl *ctl)
> +{
> +	struct btrfs_free_space *info;
> +	struct rb_node *node;
> +
> +	while ((node = rb_last(&ctl->free_space_offset)) != NULL) {

Please use rbtree_postorder_for_each_entry_safe instead of the
while/rb_next.

> +		info = rb_entry(node, struct btrfs_free_space, offset_index);
> +		if (!info->bitmap) {
> +			unlink_free_space(ctl, info, true);
> +			kmem_cache_free(btrfs_free_space_cachep, info);
> +		} else {
> +			free_bitmap(ctl, info);
> +		}
> +
> +		cond_resched_lock(&ctl->tree_lock);
> +	}
> +}

  reply	other threads:[~2022-08-18 12:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 20:10 [PATCH 0/2] btrfs: fix a lockdep_assert_locked() warning Josef Bacik
2022-08-08 20:10 ` [PATCH 1/2] btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure Josef Bacik
2022-08-18 12:14   ` David Sterba [this message]
2022-08-08 20:10 ` [PATCH 2/2] btrfs: remove use btrfs_remove_free_space_cache instead of variant Josef Bacik
2022-08-24 15:12 ` [PATCH 0/2] btrfs: fix a lockdep_assert_locked() warning 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=20220818121448.GI13489@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.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