Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Gabriel Niebler <gniebler@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.com
Subject: RETRACTED [PATCH v4] btrfs: Turn delayed_nodes_tree into an XArray
Date: Tue, 19 Apr 2022 16:38:20 +0200	[thread overview]
Message-ID: <3dd9274d-0ab7-d5b4-ebd4-bf01a31a2273@suse.com> (raw)
In-Reply-To: <20220419133741.23849-1-gniebler@suse.com>

Disregard this patch, please, it has a syntax error and won't even 
compile...

Am 19.04.22 um 15:37 schrieb Gabriel Niebler:
> … in the btrfs_root struct and adjust all usages of this object to use the
> XArray API, because it is notionally easier to use and unserstand, as it
> provides array semantics, and also takes care of locking for us, further
> simplifying the code.
> 
> Signed-off-by: Gabriel Niebler <gniebler@suse.com>

<snip>

> @@ -128,36 +128,29 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node(
>   	u64 ino = btrfs_ino(btrfs_inode);
>   	int ret;
>   
> -again:
> -	node = btrfs_get_delayed_node(btrfs_inode);
> -	if (node)
> -		return node;
> -
> -	node = kmem_cache_zalloc(delayed_node_cache, GFP_NOFS);
> -	if (!node)
> -		return ERR_PTR(-ENOMEM);
> -	btrfs_init_delayed_node(node, root, ino);
> +        do {
> +		node = btrfs_get_delayed_node(btrfs_inode);
> +		if (node)
> +			return node;
>   
> -	/* cached in the btrfs inode and can be accessed */
> -	refcount_set(&node->refs, 2);
> +		node = kmem_cache_zalloc(delayed_node_cache, GFP_NOFS);
> +		if (!node)
> +			return ERR_PTR(-ENOMEM);
> +		btrfs_init_delayed_node(node, root, ino);
>   
> -	ret = radix_tree_preload(GFP_NOFS);
> -	if (ret) {
> -		kmem_cache_free(delayed_node_cache, node);
> -		return ERR_PTR(ret);
> -	}
> +		/* cached in the btrfs inode and can be accessed */
> +		refcount_set(&node->refs, 2);
>   
> -	spin_lock(&root->inode_lock);
> -	ret = radix_tree_insert(&root->delayed_nodes_tree, ino, node);
> -	if (ret == -EEXIST) {
> -		spin_unlock(&root->inode_lock);
> -		kmem_cache_free(delayed_node_cache, node);
> -		radix_tree_preload_end();
> -		goto again;
> -	}
> +		spin_lock(&root->inode_lock);
> +		ret = xa_insert(&root->delayed_nodes, ino, node, GFP_NOFS);
> +		if (ret) {
> +			spin_unlock(&root->inode_lock);
> +			kmem_cache_free(delayed_node_cache, node);
> +			if (ret != -EBUSY)
> +				return ERR_PTR(ret);
> +	} while (ret);

Here it is: missing "}"!

<snip>

Resubmission pending, sorry for the inconvenience

      reply	other threads:[~2022-04-19 14:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 13:37 [PATCH v4] btrfs: Turn delayed_nodes_tree into an XArray Gabriel Niebler
2022-04-19 14:38 ` Gabriel Niebler [this message]

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=3dd9274d-0ab7-d5b4-ebd4-bf01a31a2273@suse.com \
    --to=gniebler@suse.com \
    --cc=dsterba@suse.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