linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout
@ 2018-01-24  2:38 Qu Wenruo
  2018-01-24  2:38 ` [PATCH 2/2] btrfs-progs: test-mkfs: Output minimal device size Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Qu Wenruo @ 2018-01-24  2:38 UTC (permalink / raw)
  To: linux-btrfs, dsterba

Commit 0b2161becf8e ("btrfs-progs: mkfs: Prevent temporary system chunk
to use space in reserved 1M range") changed the hard-coded temporary
chunk layout to avoid the first 1M.

However this also affects btrfs_min_dev_size() which still assume
temporary chunks starts at device offset 0.

This patch will fix it.

Fixes: 0b2161becf8e ("btrfs-progs: mkfs: Prevent temporary system chunk
to use space in reserved 1M range")
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 mkfs/common.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mkfs/common.c b/mkfs/common.c
index 5c5e9c3b9e01..8e85942ef4eb 100644
--- a/mkfs/common.c
+++ b/mkfs/common.c
@@ -483,6 +483,8 @@ u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile,
 
 	/*
 	 * Minimal size calculation is complex due to several factors:
+	 * 0) Reserved 1M range.
+	 *
 	 * 1) Temporary chunk reuse
 	 *    If specified chunk profile is SINGLE, we can reuse
 	 *    temporary chunks, no need to allocate new chunks.
@@ -501,7 +503,8 @@ u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile,
 	 * The latter two are all 8M, accroding to @calc_size of
 	 * btrfs_alloc_chunk().
 	 */
-	reserved += BTRFS_MKFS_SYSTEM_GROUP_SIZE + SZ_8M * 2;
+	reserved += BTRFS_BLOCK_RESERVED_1M_FOR_SUPER +
+		    BTRFS_MKFS_SYSTEM_GROUP_SIZE + SZ_8M * 2;
 
 	/*
 	 * For real chunks, we need to select different sizes:
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] btrfs-progs: test-mkfs: Output minimal device size
  2018-01-24  2:38 [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout Qu Wenruo
@ 2018-01-24  2:38 ` Qu Wenruo
  2018-01-24  9:40 ` [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout Nikolay Borisov
  2018-01-25 18:25 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2018-01-24  2:38 UTC (permalink / raw)
  To: linux-btrfs, dsterba

To make debugging a little easier.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/mkfs-tests/010-minimal-size/test.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/mkfs-tests/010-minimal-size/test.sh b/tests/mkfs-tests/010-minimal-size/test.sh
index f75a22d8ff8d..f33b8aa399f4 100755
--- a/tests/mkfs-tests/010-minimal-size/test.sh
+++ b/tests/mkfs-tests/010-minimal-size/test.sh
@@ -18,6 +18,7 @@ do_test()
 	good_size=$(echo "$output" | grep -oP "(?<=is )\d+")
 
 	prepare_test_dev "$good_size"
+	echo "Minimal device size is $good_size" >> "$RESULTS"
 	run_check $TOP/mkfs.btrfs -f $@ "$TEST_DEV"
 	run_check_mount_test_dev
 	run_check_umount_test_dev
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout
  2018-01-24  2:38 [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout Qu Wenruo
  2018-01-24  2:38 ` [PATCH 2/2] btrfs-progs: test-mkfs: Output minimal device size Qu Wenruo
@ 2018-01-24  9:40 ` Nikolay Borisov
  2018-01-25 18:25 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Nikolay Borisov @ 2018-01-24  9:40 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs, dsterba



On 24.01.2018 04:38, Qu Wenruo wrote:
> Commit 0b2161becf8e ("btrfs-progs: mkfs: Prevent temporary system chunk
> to use space in reserved 1M range") changed the hard-coded temporary
> chunk layout to avoid the first 1M.
> 
> However this also affects btrfs_min_dev_size() which still assume
> temporary chunks starts at device offset 0.
> 
> This patch will fix it.
> 
> Fixes: 0b2161becf8e ("btrfs-progs: mkfs: Prevent temporary system chunk
> to use space in reserved 1M range")
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  mkfs/common.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/mkfs/common.c b/mkfs/common.c
> index 5c5e9c3b9e01..8e85942ef4eb 100644
> --- a/mkfs/common.c
> +++ b/mkfs/common.c
> @@ -483,6 +483,8 @@ u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile,
>  
>  	/*
>  	 * Minimal size calculation is complex due to several factors:
> +	 * 0) Reserved 1M range.
> +	 *
>  	 * 1) Temporary chunk reuse
>  	 *    If specified chunk profile is SINGLE, we can reuse
>  	 *    temporary chunks, no need to allocate new chunks.
> @@ -501,7 +503,8 @@ u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile,
>  	 * The latter two are all 8M, accroding to @calc_size of
>  	 * btrfs_alloc_chunk().
>  	 */
> -	reserved += BTRFS_MKFS_SYSTEM_GROUP_SIZE + SZ_8M * 2;
> +	reserved += BTRFS_BLOCK_RESERVED_1M_FOR_SUPER +
> +		    BTRFS_MKFS_SYSTEM_GROUP_SIZE + SZ_8M * 2;
>  
>  	/*
>  	 * For real chunks, we need to select different sizes:
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout
  2018-01-24  2:38 [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout Qu Wenruo
  2018-01-24  2:38 ` [PATCH 2/2] btrfs-progs: test-mkfs: Output minimal device size Qu Wenruo
  2018-01-24  9:40 ` [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout Nikolay Borisov
@ 2018-01-25 18:25 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2018-01-25 18:25 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs, dsterba

On Wed, Jan 24, 2018 at 10:38:29AM +0800, Qu Wenruo wrote:
> Commit 0b2161becf8e ("btrfs-progs: mkfs: Prevent temporary system chunk
> to use space in reserved 1M range") changed the hard-coded temporary
> chunk layout to avoid the first 1M.
> 
> However this also affects btrfs_min_dev_size() which still assume
> temporary chunks starts at device offset 0.
> 
> This patch will fix it.
> 
> Fixes: 0b2161becf8e ("btrfs-progs: mkfs: Prevent temporary system chunk
> to use space in reserved 1M range")
> Signed-off-by: Qu Wenruo <wqu@suse.com>

As this would break bisection and the fix is short I've folded it to the
patch that fixed th 0-1M range. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-25 18:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-24  2:38 [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout Qu Wenruo
2018-01-24  2:38 ` [PATCH 2/2] btrfs-progs: test-mkfs: Output minimal device size Qu Wenruo
2018-01-24  9:40 ` [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout Nikolay Borisov
2018-01-25 18:25 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).