All of lore.kernel.org
 help / color / mirror / Atom feed
From: Filipe Manana <fdmanana@gmail.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>, kernel-team@fb.com
Subject: Re: [PATCH 1/8] btrfs: cleanup the locking in btrfs_next_old_leaf
Date: Mon, 9 Nov 2020 10:06:52 +0000	[thread overview]
Message-ID: <CAL3q7H6eWuPQ=t2BVJYQPGYmYm3ZJZgPiOFwznwU5KetLMaKyw@mail.gmail.com> (raw)
In-Reply-To: <74fe63263c2d9e7ffd6c0cef2a2f9ce893989638.1604697895.git.josef@toxicpanda.com>

On Fri, Nov 6, 2020 at 9:29 PM Josef Bacik <josef@toxicpanda.com> wrote:
>
> We are carrying around this next_rw_lock from when we would do spinning
> vs blocking read locks.  Now that we have the rwsem locking we can
> simply use the read lock flag unconditionally and the read lock helpers.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Filipe Manana <fdmanana@suse.com>

Looks good, thanks.

> ---
>  fs/btrfs/ctree.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index d2d5854d51a7..3a01e6e048c0 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -5327,7 +5327,6 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
>         struct btrfs_key key;
>         u32 nritems;
>         int ret;
> -       int next_rw_lock = 0;
>
>         nritems = btrfs_header_nritems(path->nodes[0]);
>         if (nritems == 0)
> @@ -5337,7 +5336,6 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
>  again:
>         level = 1;
>         next = NULL;
> -       next_rw_lock = 0;
>         btrfs_release_path(path);
>
>         path->keep_locks = 1;
> @@ -5401,12 +5399,11 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
>                 }
>
>                 if (next) {
> -                       btrfs_tree_unlock_rw(next, next_rw_lock);
> +                       btrfs_tree_read_unlock(next);
>                         free_extent_buffer(next);
>                 }
>
>                 next = c;
> -               next_rw_lock = path->locks[level];
>                 ret = read_block_for_search(root, path, &next, level,
>                                             slot, &key);
>                 if (ret == -EAGAIN)
> @@ -5437,7 +5434,6 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
>                                                        BTRFS_NESTING_RIGHT,
>                                                        path->recurse);
>                         }
> -                       next_rw_lock = BTRFS_READ_LOCK;
>                 }
>                 break;
>         }
> @@ -5446,13 +5442,13 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
>                 level--;
>                 c = path->nodes[level];
>                 if (path->locks[level])
> -                       btrfs_tree_unlock_rw(c, path->locks[level]);
> +                       btrfs_tree_read_unlock(c);
>
>                 free_extent_buffer(c);
>                 path->nodes[level] = next;
>                 path->slots[level] = 0;
>                 if (!path->skip_locking)
> -                       path->locks[level] = next_rw_lock;
> +                       path->locks[level] = BTRFS_READ_LOCK;
>                 if (!level)
>                         break;
>
> @@ -5466,11 +5462,9 @@ int btrfs_next_old_leaf(struct btrfs_root *root, struct btrfs_path *path,
>                         goto done;
>                 }
>
> -               if (!path->skip_locking) {
> +               if (!path->skip_locking)
>                         __btrfs_tree_read_lock(next, BTRFS_NESTING_RIGHT,
>                                                path->recurse);
> -                       next_rw_lock = BTRFS_READ_LOCK;
> -               }
>         }
>         ret = 0;
>  done:
> --
> 2.26.2
>


-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”

  reply	other threads:[~2020-11-09 10:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 21:27 [PATCH 0/8] Locking cleanups and lockdep fix Josef Bacik
2020-11-06 21:27 ` [PATCH 1/8] btrfs: cleanup the locking in btrfs_next_old_leaf Josef Bacik
2020-11-09 10:06   ` Filipe Manana [this message]
2020-11-06 21:27 ` [PATCH 2/8] btrfs: unlock to current level " Josef Bacik
2020-11-09 10:12   ` Filipe Manana
2020-11-06 21:27 ` [PATCH 3/8] btrfs: kill path->recurse Josef Bacik
2020-11-09 10:19   ` Filipe Manana
2020-11-06 21:27 ` [PATCH 4/8] btrfs: remove the recursion handling code in locking.c Josef Bacik
2020-11-09 10:20   ` Filipe Manana
2020-11-11 14:14   ` David Sterba
2020-11-11 14:29   ` David Sterba
2020-11-11 14:43     ` Josef Bacik
2020-11-11 14:59       ` David Sterba
2020-11-06 21:27 ` [PATCH 5/8] btrfs: remove __btrfs_read_lock_root_node Josef Bacik
2020-11-09 10:20   ` Filipe Manana
2020-11-06 21:27 ` [PATCH 6/8] btrfs: use btrfs_tree_read_lock in btrfs_search_slot Josef Bacik
2020-11-09 10:21   ` Filipe Manana
2020-11-06 21:27 ` [PATCH 7/8] btrfs: remove the recurse parameter from __btrfs_tree_read_lock Josef Bacik
2020-11-09 10:22   ` Filipe Manana
2020-11-06 21:27 ` [PATCH 8/8] btrfs: remove ->recursed from extent_buffer Josef Bacik
2020-11-09 10:23   ` Filipe Manana
2020-11-12 18:18 ` [PATCH 0/8] Locking cleanups and lockdep fix 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='CAL3q7H6eWuPQ=t2BVJYQPGYmYm3ZJZgPiOFwznwU5KetLMaKyw@mail.gmail.com' \
    --to=fdmanana@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.