diff mbox series

[v3,20/21] btrfs: skip LOOP_NO_EMPTY_SIZE if not clustered allocation

Message ID 20200225035626.1049501-21-naohiro.aota@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs: refactor and generalize chunk/dev_extent/extent allocation | expand

Commit Message

Naohiro Aota Feb. 25, 2020, 3:56 a.m. UTC
LOOP_NO_EMPTY_SIZE is solely dedicated for clustered allocation. So, we can
skip this stage and give up the allocation.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/extent-tree.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

David Sterba Feb. 28, 2020, 2:20 p.m. UTC | #1
On Tue, Feb 25, 2020 at 12:56:25PM +0900, Naohiro Aota wrote:
> LOOP_NO_EMPTY_SIZE is solely dedicated for clustered allocation. So, we can
> skip this stage and give up the allocation.
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
>  fs/btrfs/extent-tree.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index cb82eaf28033..055097bff12b 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -3848,6 +3848,9 @@ static int find_free_extent_update_loop(struct btrfs_fs_info *fs_info,
>  		}
>  
>  		if (ffe_ctl->loop == LOOP_NO_EMPTY_SIZE) {
> +			if (ffe_ctl->policy != BTRFS_EXTENT_ALLOC_CLUSTERED)
> +				return -ENOSPC;

This looks like functional change, unlike the rest so will need some
review still.
diff mbox series

Patch

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index cb82eaf28033..055097bff12b 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3848,6 +3848,9 @@  static int find_free_extent_update_loop(struct btrfs_fs_info *fs_info,
 		}
 
 		if (ffe_ctl->loop == LOOP_NO_EMPTY_SIZE) {
+			if (ffe_ctl->policy != BTRFS_EXTENT_ALLOC_CLUSTERED)
+				return -ENOSPC;
+
 			/*
 			 * Don't loop again if we already have no empty_size and
 			 * no empty_cluster.