Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: remove btrfs_is_free_space_inode()
Date: Mon, 23 Nov 2026 09:06:02 +1030	[thread overview]
Message-ID: <5f24cb48-df8d-413a-82f4-6a50e650e8a2@suse.com> (raw)
In-Reply-To: <4d3a1d10aff29e6b65ee681cbd7e82e306e69d6e.1795385532.git.wqu@suse.com>



在 2026/11/23 08:42, Qu Wenruo 写道:
> Since we have disabled v1 space cache, there is no need to maintain that
> function.
> 
> Remove it along with the BTRFS_INODE_FREE_SPACE_INODE flag.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Please drop this one.

Sashiko mentioned that those paths can still be hit for v1 cache clearing.

> ---
>   fs/btrfs/btrfs_inode.h |  7 -------
>   fs/btrfs/inode.c       | 19 +++----------------
>   2 files changed, 3 insertions(+), 23 deletions(-)
> 
> diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
> index fbcf8ca05fb7..5ffe89279f15 100644
> --- a/fs/btrfs/btrfs_inode.h
> +++ b/fs/btrfs/btrfs_inode.h
> @@ -85,8 +85,6 @@ enum {
>   	 * on the same file.
>   	 */
>   	BTRFS_INODE_VERITY_IN_PROGRESS,
> -	/* Set when this inode is a free space inode. */
> -	BTRFS_INODE_FREE_SPACE_INODE,
>   	/* Set when there are no capabilities in XATTs for the inode. */
>   	BTRFS_INODE_NO_CAP_XATTR,
>   	/*
> @@ -394,11 +392,6 @@ static inline void btrfs_i_size_write(struct btrfs_inode *inode, u64 size)
>   	inode->disk_i_size = size;
>   }
>   
> -static inline bool btrfs_is_free_space_inode(const struct btrfs_inode *inode)
> -{
> -	return test_bit(BTRFS_INODE_FREE_SPACE_INODE, &inode->runtime_flags);
> -}
> -
>   static inline bool is_data_inode(const struct btrfs_inode *inode)
>   {
>   	return btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID;
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 40dd87276cc9..47d5da483d11 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -3930,8 +3930,6 @@ static int btrfs_init_file_extent_tree(struct btrfs_inode *inode)
>   		return 0;
>   	if (!S_ISREG(inode->vfs_inode.i_mode))
>   		return 0;
> -	if (btrfs_is_free_space_inode(inode))
> -		return 0;
>   
>   	inode->file_extent_tree = kmalloc_obj(struct extent_io_tree);
>   	if (!inode->file_extent_tree)
> @@ -4287,14 +4285,9 @@ int btrfs_update_inode(struct btrfs_trans_handle *trans,
>   	int ret;
>   
>   	/*
> -	 * If the inode is a free space inode, we can deadlock during commit
> -	 * if we put it into the delayed code.
> -	 *
> -	 * The data relocation inode should also be directly updated
> -	 * without delay
> +	 * The data relocation inode should be directly updated without delay.
>   	 */
> -	if (!btrfs_is_free_space_inode(inode)
> -	    && !btrfs_is_data_reloc_root(root)
> +	if (!btrfs_is_data_reloc_root(root)
>   	    && !test_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags)) {
>   		btrfs_update_root_times(trans, root);
>   
> @@ -5602,8 +5595,7 @@ void btrfs_evict_inode(struct inode *inode)
>   
>   	if (inode->i_nlink &&
>   	    ((btrfs_root_refs(&root->root_item) != 0 &&
> -	      btrfs_root_id(root) != BTRFS_ROOT_TREE_OBJECTID) ||
> -	     btrfs_is_free_space_inode(BTRFS_I(inode))))
> +	      btrfs_root_id(root) != BTRFS_ROOT_TREE_OBJECTID)))
>   		goto out;
>   
>   	if (is_bad_inode(inode))
> @@ -5872,11 +5864,6 @@ static int btrfs_init_locked_inode(struct inode *inode, void *p)
>   
>   	btrfs_set_inode_number(BTRFS_I(inode), args->ino);
>   	BTRFS_I(inode)->root = btrfs_grab_root(args->root);
> -
> -	if (args->root && args->root == args->root->fs_info->tree_root &&
> -	    args->ino != BTRFS_BTREE_INODE_OBJECTID)
> -		set_bit(BTRFS_INODE_FREE_SPACE_INODE,
> -			&BTRFS_I(inode)->runtime_flags);
>   	return 0;
>   }
>   


      reply	other threads:[~2026-11-22 22:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 22:12 [PATCH] btrfs: remove btrfs_is_free_space_inode() Qu Wenruo
2026-11-22 22:36 ` Qu Wenruo [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=5f24cb48-df8d-413a-82f4-6a50e650e8a2@suse.com \
    --to=wqu@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