From: David Sterba <dsterba@suse.cz>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com,
Josef Bacik <jbacik@fb.com>
Subject: Re: [PATCH 01/22] btrfs: add btrfs_delete_ref_head helper
Date: Fri, 20 Jul 2018 16:48:09 +0200 [thread overview]
Message-ID: <20180720144809.GC26141@twin.jikos.cz> (raw)
In-Reply-To: <20180719145006.17532-1-josef@toxicpanda.com>
On Thu, Jul 19, 2018 at 10:49:45AM -0400, Josef Bacik wrote:
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2577,12 +2577,9 @@ static int cleanup_ref_head(struct btrfs_trans_handle *trans,
> spin_unlock(&delayed_refs->lock);
> return 1;
> }
> - delayed_refs->num_heads--;
> - rb_erase(&head->href_node, &delayed_refs->href_root);
> - RB_CLEAR_NODE(&head->href_node);
> - spin_unlock(&head->lock);
> + btrfs_delete_ref_head(delayed_refs, head);
> spin_unlock(&delayed_refs->lock);
> - atomic_dec(&delayed_refs->num_entries);
> + spin_unlock(&head->lock);
The order of unlocks is reversed, the head is nested to the delayed
refs.
> @@ -7122,22 +7119,9 @@ static noinline int check_ref_cleanup(struct btrfs_trans_handle *trans,
> if (!mutex_trylock(&head->mutex))
> goto out;
>
> - /*
> - * at this point we have a head with no other entries. Go
> - * ahead and process it.
> - */
> - rb_erase(&head->href_node, &delayed_refs->href_root);
> - RB_CLEAR_NODE(&head->href_node);
> - atomic_dec(&delayed_refs->num_entries);
> -
> - /*
> - * we don't take a ref on the node because we're removing it from the
> - * tree, so we just steal the ref the tree was holding.
> - */
> - delayed_refs->num_heads--;
> - if (head->processing == 0)
> - delayed_refs->num_heads_ready--;
> + btrfs_delete_ref_head(delayed_refs, head);
> head->processing = 0;
> +
> spin_unlock(&head->lock);
> spin_unlock(&delayed_refs->lock);
The right order eg. here and everywhere else.
next prev parent reply other threads:[~2018-07-20 15:36 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-19 14:49 [PATCH 01/22] btrfs: add btrfs_delete_ref_head helper Josef Bacik
2018-07-19 14:49 ` [PATCH 02/22] btrfs: add cleanup_ref_head_accounting helper Josef Bacik
2018-07-19 14:49 ` [PATCH 03/22] btrfs: use cleanup_extent_op in check_ref_cleanup Josef Bacik
2018-07-19 14:49 ` [PATCH 04/22] btrfs: only track ref_heads in delayed_ref_updates Josef Bacik
2018-07-21 8:49 ` Nikolay Borisov
2018-07-19 14:49 ` [PATCH 05/22] btrfs: introduce delayed_refs_rsv Josef Bacik
2018-07-19 14:49 ` [PATCH 06/22] btrfs: check if free bgs for commit Josef Bacik
2018-07-19 14:49 ` [PATCH 07/22] btrfs: don't leak ret from do_chunk_alloc Josef Bacik
2018-07-19 15:43 ` Nikolay Borisov
2018-07-24 11:24 ` David Sterba
2018-07-19 14:49 ` [PATCH 08/22] btrfs: dump block_rsv whe dumping space info Josef Bacik
2018-07-19 15:39 ` Nikolay Borisov
2018-07-20 11:59 ` David Sterba
2018-07-19 14:49 ` [PATCH 09/22] btrfs: release metadata before running delayed refs Josef Bacik
2018-07-19 14:49 ` [PATCH 10/22] btrfs: alloc space cache inode with GFP_NOFS Josef Bacik
2018-07-19 15:35 ` Nikolay Borisov
2018-07-19 15:44 ` David Sterba
2018-07-19 15:56 ` Josef Bacik
2018-07-19 15:55 ` Josef Bacik
2018-07-19 14:49 ` [PATCH 11/22] btrfs: fix truncate throttling Josef Bacik
2018-07-19 14:49 ` [PATCH 12/22] btrfs: don't use global rsv for chunk allocation Josef Bacik
2018-07-19 14:49 ` [PATCH 13/22] btrfs: reset max_extent_size properly Josef Bacik
2018-07-19 14:49 ` [PATCH 14/22] btrfs: don't enospc all tickets on flush failure Josef Bacik
2018-07-19 14:49 ` [PATCH 15/22] btrfs: run delayed iputs before committing Josef Bacik
2018-08-21 13:51 ` David Sterba
2018-07-19 14:50 ` [PATCH 16/22] btrfs: loop in inode_rsv_refill Josef Bacik
2018-07-19 14:50 ` [PATCH 17/22] btrfs: don't take the dio_sem in the fsync path Josef Bacik
2018-07-19 15:12 ` Filipe Manana
2018-07-19 15:21 ` Filipe Manana
2018-07-19 15:54 ` Josef Bacik
2018-07-19 15:57 ` Filipe Manana
2018-07-19 14:50 ` [PATCH 18/22] btrfs: add ALLOC_CHUNK_FORCE to the flushing code Josef Bacik
2018-07-19 14:50 ` [PATCH 19/22] btrfs: set max_extent_size properly Josef Bacik
2018-07-19 14:50 ` [PATCH 20/22] btrfs: don't use ctl->free_space for max_extent_size Josef Bacik
2018-07-19 14:50 ` [PATCH 21/22] btrfs: reset max_extent_size on clear in a bitmap Josef Bacik
2018-07-19 14:50 ` [PATCH 22/22] btrfs: only run delayed refs if we're committing Josef Bacik
2018-07-20 7:37 ` Nikolay Borisov
2018-07-19 16:08 ` [PATCH 01/22] btrfs: add btrfs_delete_ref_head helper David Sterba
2018-07-19 16:12 ` Josef Bacik
2018-07-19 16:36 ` David Sterba
2018-07-20 13:11 ` Nikolay Borisov
2018-07-20 14:18 ` Josef Bacik
2018-07-20 14:48 ` David Sterba [this message]
2018-07-20 16:04 ` 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=20180720144809.GC26141@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=jbacik@fb.com \
--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;
as well as URLs for NNTP newsgroup(s).