Re: [PATCH] btrfs: Remove BTRFS_INODE_IN_DELALLOC_LIST flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 27, 2020 at 12:42 PM Nikolay Borisov <nborisov@xxxxxxxx> wrote:
>
> The flag simply replicates whether btrfs_inode::delallocs_inodes list
> is empty or not. Just defer this check to the list management functions
> (btrfs_add_delalloc_inodes/__btrfs_del_delalloc_inode) which are
> always called under btrfs_root::delalloc_lock.

The flag is there to avoid taking the root's delalloc_lock spinlock
everytime a range is marked for delalloc for any inode of the
subvolume.
Have you measured performance with very high concurrency of buffered
writes against files in the same subvolume?

Thanks.

>
> Signed-off-by: Nikolay Borisov <nborisov@xxxxxxxx>
> ---
>  fs/btrfs/btrfs_inode.h |  1 -
>  fs/btrfs/inode.c       | 11 ++---------
>  2 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
> index aeff56a0e105..da6743c70412 100644
> --- a/fs/btrfs/btrfs_inode.h
> +++ b/fs/btrfs/btrfs_inode.h
> @@ -27,7 +27,6 @@ enum {
>         BTRFS_INODE_HAS_ASYNC_EXTENT,
>         BTRFS_INODE_NEEDS_FULL_SYNC,
>         BTRFS_INODE_COPY_EVERYTHING,
> -       BTRFS_INODE_IN_DELALLOC_LIST,
>         BTRFS_INODE_HAS_PROPS,
>         BTRFS_INODE_SNAPSHOT_FLUSH,
>  };
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 7d2f6e55a234..3e87a6644e09 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -1865,8 +1865,6 @@ static void btrfs_add_delalloc_inodes(struct btrfs_root *root,
>         if (list_empty(&BTRFS_I(inode)->delalloc_inodes)) {
>                 list_add_tail(&BTRFS_I(inode)->delalloc_inodes,
>                               &root->delalloc_inodes);
> -               set_bit(BTRFS_INODE_IN_DELALLOC_LIST,
> -                       &BTRFS_I(inode)->runtime_flags);
>                 root->nr_delalloc_inodes++;
>                 if (root->nr_delalloc_inodes == 1) {
>                         spin_lock(&fs_info->delalloc_root_lock);
> @@ -1887,8 +1885,6 @@ void __btrfs_del_delalloc_inode(struct btrfs_root *root,
>
>         if (!list_empty(&inode->delalloc_inodes)) {
>                 list_del_init(&inode->delalloc_inodes);
> -               clear_bit(BTRFS_INODE_IN_DELALLOC_LIST,
> -                         &inode->runtime_flags);
>                 root->nr_delalloc_inodes--;
>                 if (!root->nr_delalloc_inodes) {
>                         ASSERT(list_empty(&root->delalloc_inodes));
> @@ -1944,8 +1940,7 @@ void btrfs_set_delalloc_extent(struct inode *inode, struct extent_state *state,
>                 BTRFS_I(inode)->delalloc_bytes += len;
>                 if (*bits & EXTENT_DEFRAG)
>                         BTRFS_I(inode)->defrag_bytes += len;
> -               if (do_list && !test_bit(BTRFS_INODE_IN_DELALLOC_LIST,
> -                                        &BTRFS_I(inode)->runtime_flags))
> +               if (do_list)
>                         btrfs_add_delalloc_inodes(root, inode);
>                 spin_unlock(&BTRFS_I(inode)->lock);
>         }
> @@ -2014,9 +2009,7 @@ void btrfs_clear_delalloc_extent(struct inode *vfs_inode,
>                                          fs_info->delalloc_batch);
>                 spin_lock(&inode->lock);
>                 inode->delalloc_bytes -= len;
> -               if (do_list && inode->delalloc_bytes == 0 &&
> -                   test_bit(BTRFS_INODE_IN_DELALLOC_LIST,
> -                                       &inode->runtime_flags))
> +               if (do_list && inode->delalloc_bytes == 0)
>                         btrfs_del_delalloc_inode(root, inode);
>                 spin_unlock(&inode->lock);
>         }
> --
> 2.17.1
>


-- 
Filipe David Manana,

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




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux