diff mbox

Fix balance regression in 4.4-rc

Message ID 564B0F9C.6060707@googlemail.com (mailing list archive)
State Under Review
Headers show

Commit Message

Holger Hoffstätte Nov. 17, 2015, 11:29 a.m. UTC
There's a regression in 4.4-rc since commit bc3094673f22
(btrfs: extend balance filter usage to take minimum and maximum) in that
existing (non-ranged) balance with -dusage=x no longer works; all chunks
are skipped.

After staring at the code for a while and wondering why a non-ranged
balance would even need min and max thresholds (..which then were not
set correctly, leading to the bug) I realized that the only problem
was the fact that the filter functions were named wrong, thanks to
patching copypasta. Simply renaming both functions lets the existing
btrfs-progs call balance with -dusage=x and now the non-ranged filter
function is invoked, properly using only a single chunk limit.

Signed-off-by: Holger Hoffstätte <holger.hoffstaette@googlemail.com>
Fixes: bc3094673f22 ("btrfs: extend balance filter usage to take minimum and maximum")
---
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Duncan Nov. 18, 2015, 12:02 a.m. UTC | #1
Holger Hoffstätte posted on Tue, 17 Nov 2015 12:29:32 +0100 as excerpted:

> There's a regression in 4.4-rc since commit bc3094673f22 (btrfs: extend
> balance filter usage to take minimum and maximum) in that existing
> (non-ranged) balance with -dusage=x no longer works; all chunks are
> skipped.

Not being a dev I won't attempt to comment on the patch itself, but the 
title, please prefix the patch title with either btrfs: if it's for the 
kernel (as here), or btrfs-progs: if for userspace.

I was a bit confused here, thinking userspace, when it's apparently a 
kernel patch.  (The significance here being that I've not upgraded to 4.4-
rc kernel yet, and now probably won't until this gets in, since I tend to 
use -dusage=x balance filters reasonably frequently.  If I had already 
upgraded, I'd have probably dropped the patch into my autoapply dir until 
it was applied upstream.)

So...

[PATCH] Fix balance regression in 4.4-rc

... would become...

[PATCH] btrfs: fix balance regression in 4.4-rc

(Initial capitalization, fix/Fix, seems to be poster's choice.)
Filipe Manana Nov. 20, 2015, 4:09 p.m. UTC | #2
On Tue, Nov 17, 2015 at 11:29 AM, Holger Hoffstätte
<holger.hoffstaette@googlemail.com> wrote:
> There's a regression in 4.4-rc since commit bc3094673f22
> (btrfs: extend balance filter usage to take minimum and maximum) in that
> existing (non-ranged) balance with -dusage=x no longer works; all chunks
> are skipped.
>
> After staring at the code for a while and wondering why a non-ranged
> balance would even need min and max thresholds (..which then were not
> set correctly, leading to the bug) I realized that the only problem
> was the fact that the filter functions were named wrong, thanks to
> patching copypasta. Simply renaming both functions lets the existing
> btrfs-progs call balance with -dusage=x and now the non-ranged filter
> function is invoked, properly using only a single chunk limit.
>
> Signed-off-by: Holger Hoffstätte <holger.hoffstaette@googlemail.com>
> Fixes: bc3094673f22 ("btrfs: extend balance filter usage to take minimum and maximum")

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

Besides prefixing the title with "Btrfs: " as correctly pointed by
Duncan, a better title would be like "Btrfs: fix broken balance usage
filters", as it's a problem in the filters and not the balance code
itself.

Thanks for chasing and fixing this.

> ---
> --- linux-4.1.13/fs/btrfs/volumes.c     2015-11-16 22:34:27.475045363 +0100
> +++ linux-4.1.13-filters/fs/btrfs/volumes.c     2015-11-17 12:08:41.308898665 +0100
> @@ -3189,7 +3189,7 @@
>         return 1;
>  }
>
> -static int chunk_usage_filter(struct btrfs_fs_info *fs_info, u64 chunk_offset,
> +static int chunk_usage_range_filter(struct btrfs_fs_info *fs_info, u64 chunk_offset,
>                               struct btrfs_balance_args *bargs)
>  {
>         struct btrfs_block_group_cache *cache;
> @@ -3222,7 +3222,7 @@
>         return ret;
>  }
>
> -static int chunk_usage_range_filter(struct btrfs_fs_info *fs_info,
> +static int chunk_usage_filter(struct btrfs_fs_info *fs_info,
>                 u64 chunk_offset, struct btrfs_balance_args *bargs)
>  {
>         struct btrfs_block_group_cache *cache;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- linux-4.1.13/fs/btrfs/volumes.c	2015-11-16 22:34:27.475045363 +0100
+++ linux-4.1.13-filters/fs/btrfs/volumes.c	2015-11-17 12:08:41.308898665 +0100
@@ -3189,7 +3189,7 @@ 
 	return 1;
 }
 
-static int chunk_usage_filter(struct btrfs_fs_info *fs_info, u64 chunk_offset,
+static int chunk_usage_range_filter(struct btrfs_fs_info *fs_info, u64 chunk_offset,
 			      struct btrfs_balance_args *bargs)
 {
 	struct btrfs_block_group_cache *cache;
@@ -3222,7 +3222,7 @@ 
 	return ret;
 }
 
-static int chunk_usage_range_filter(struct btrfs_fs_info *fs_info,
+static int chunk_usage_filter(struct btrfs_fs_info *fs_info,
 		u64 chunk_offset, struct btrfs_balance_args *bargs)
 {
 	struct btrfs_block_group_cache *cache;