[2/6] btrfs: don't use path->leave_spinning for truncate
diff mbox series

Message ID 20200117140224.42495-3-josef@toxicpanda.com
State New
Headers show
Series
  • btrfs: fix hole corruption issue with !NO_HOLES
Related show

Commit Message

Josef Bacik Jan. 17, 2020, 2:02 p.m. UTC
The only time we actually leave the path spinning is if we're truncating
a small amount and don't actually free an extent, which is not a common
occurrence.  We have to set the path blocking in order to add the
delayed ref anyway, so the first extent we find we set the path to
blocking and stay blocking for the duration of the operation.  With the
upcoming file extent map stuff there will be another case that we have
to have the path blocking, so just swap to blocking always.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/inode.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Filipe Manana Jan. 17, 2020, 3:08 p.m. UTC | #1
On Fri, Jan 17, 2020 at 2:03 PM Josef Bacik <josef@toxicpanda.com> wrote:
>
> The only time we actually leave the path spinning is if we're truncating
> a small amount and don't actually free an extent, which is not a common
> occurrence.  We have to set the path blocking in order to add the
> delayed ref anyway, so the first extent we find we set the path to
> blocking and stay blocking for the duration of the operation.  With the
> upcoming file extent map stuff there will be another case that we have
> to have the path blocking, so just swap to blocking always.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

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

Looks good, thanks.

> ---
>  fs/btrfs/inode.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 10087e1a5946..4bdd412182ae 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -4066,7 +4066,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
>                 goto out;
>         }
>
> -       path->leave_spinning = 1;
>         ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
>         if (ret < 0)
>                 goto out;
> @@ -4218,7 +4217,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
>                      root == fs_info->tree_root)) {
>                         struct btrfs_ref ref = { 0 };
>
> -                       btrfs_set_path_blocking(path);
>                         bytes_deleted += extent_num_bytes;
>
>                         btrfs_init_generic_ref(&ref, BTRFS_DROP_DELAYED_REF,
> --
> 2.24.1
>

Patch
diff mbox series

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 10087e1a5946..4bdd412182ae 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4066,7 +4066,6 @@  int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
 		goto out;
 	}
 
-	path->leave_spinning = 1;
 	ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
 	if (ret < 0)
 		goto out;
@@ -4218,7 +4217,6 @@  int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
 		     root == fs_info->tree_root)) {
 			struct btrfs_ref ref = { 0 };
 
-			btrfs_set_path_blocking(path);
 			bytes_deleted += extent_num_bytes;
 
 			btrfs_init_generic_ref(&ref, BTRFS_DROP_DELAYED_REF,