linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz, Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v4 1/4] btrfs-progs: mkfs: Enhance minimal device size calculation to fix mkfs failure on small file
Date: Tue, 28 Nov 2017 08:40:47 +0800	[thread overview]
Message-ID: <a84fe81d-980a-e349-9643-fbdddc50ac44@gmx.com> (raw)
In-Reply-To: <20171127232131.GK3553@twin.jikos.cz>


[-- Attachment #1.1: Type: text/plain, Size: 2798 bytes --]



On 2017年11月28日 07:21, David Sterba wrote:
> On Wed, Nov 01, 2017 at 09:30:40AM +0800, Qu Wenruo wrote:
>> +u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile,
>> +		       u64 data_profile)
>> +{
>> +	u64 reserved = 0;
>> +	u64 meta_size;
>> +	u64 data_size;
>> +
>> +	if (mixed)
>> +		return 2 * (BTRFS_MKFS_SYSTEM_GROUP_SIZE +
>> +			    btrfs_min_global_blk_rsv_size(nodesize));
>> +
>> +	/*
>> +	 * minimal size calculation is complex due to several factors:
>> +	 * 1) Temporary chunk resue
>> +	 *    If specified chunk profile is SINGLE, we can resue
>> +	 *    temporary chunks, no need to alloc new chunks.
>> +	 *
>> +	 * 2) Different minimal chunk size for different profile
>> +	 *    For initial sys chunk, chunk size is fixed to 4M.
>> +	 *    For single profile, minimal chunk size is 8M for all.
>> +	 *    For other profiles, minimal chunk and stripe size
>> +	 *    differs from 8M to 64M.
>> +	 *
>> +	 * To calculate it a little easier, here we assume we don't
>> +	 * reuse any temporary chunk, and calculate the size all
>> +	 * by ourselves.
>> +	 *
>> +	 * Temporary chunks sizes are always fixed:
>> +	 * One initial sys chunk, one SINGLE meta, and one SINGLE data.
>> +	 * The latter two are all 8M, accroding to @calc_size of
>> +	 * btrfs_alloc_chunk().
>> +	 */
>> +	reserved += BTRFS_MKFS_SYSTEM_GROUP_SIZE + SZ_8M * 2;
>> +
>> +	/*
>> +	 * For real chunks, we need to refer different sizes:
>> +	 * For SINGLE, it's still fixed to 8M (@calc_size).
>> +	 * For other profiles, refer to max(@min_stripe_size, @calc_size).
>> +	 *
>> +	 * And use the stripe size to calculate its physical used space.
>> +	 */
>> +	if (meta_profile & BTRFS_BLOCK_GROUP_PROFILE_MASK)
>> +		meta_size = SZ_8M + SZ_32M;
>> +	else
>> +		meta_size = SZ_8M + SZ_8M;
>> +	/* Only metadata put 2 stripes into one disk */
> 
> 'mkfs.btrfs -d dup' also works, so I think this should be handled here
> the same way as metadata, right?

Just a few lines under.
> 
>> +	if (meta_profile & BTRFS_BLOCK_GROUP_DUP)
>> +		meta_size *= 2;
>> +	reserved += meta_size;
>> +
>> +	if (data_profile & BTRFS_BLOCK_GROUP_PROFILE_MASK)
>> +		data_size = SZ_64M;
>> +	else
>> +		data_size = SZ_8M;
>> +	if (data_profile & BTRFS_BLOCK_GROUP_DUP)
>> +		data_size *= 2;
Here data DUP is also handled.

So the problem is about the word "Only".

Do I need to re-submit the whole patchset or just a separate patch to
update the comment?

Thanks,
Qu

>> +	reserved += data_size;
>> +	return reserved;
>> +}
> --
> 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
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]

  reply	other threads:[~2017-11-28  0:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01  1:30 [PATCH v4 0/4] mkfs: Fix minimal device check so that reported Qu Wenruo
2017-11-01  1:30 ` [PATCH v4 1/4] btrfs-progs: mkfs: Enhance minimal device size calculation to fix mkfs failure on small file Qu Wenruo
2017-11-27 23:21   ` David Sterba
2017-11-28  0:40     ` Qu Wenruo [this message]
2017-11-28 12:32       ` David Sterba
2017-11-01  1:30 ` [PATCH v4 2/4] btrfs-progs: test/common: Introduce run_mustfail_stdout Qu Wenruo
2017-11-27 23:28   ` David Sterba
2017-11-01  1:30 ` [PATCH v4 3/4] btrfs-progs: test/common: Enhance prepare_test_dev to reset device size Qu Wenruo
2017-11-27 23:30   ` David Sterba
2017-11-01  1:30 ` [PATCH v4 4/4] btrfs-progs: test/mkfs: Test if the minimal device size is valid Qu Wenruo
2017-11-28 14:34   ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a84fe81d-980a-e349-9643-fbdddc50ac44@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).