linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Naohiro Aota <naohiro.aota@wdc.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, David Sterba <dsterba@suse.com>,
	Chris Mason <clm@fb.com>, Nikolay Borisov <nborisov@suse.com>,
	Damien Le Moal <damien.lemoal@wdc.com>,
	Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	Hannes Reinecke <hare@suse.com>,
	Anand Jain <anand.jain@oracle.com>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 05/20] btrfs: factor out set_parameters()
Date: Fri, 7 Feb 2020 16:59:01 +0900	[thread overview]
Message-ID: <20200207075901.o4lfuf3txharr4co@naota.dhcp.fujisawa.hgst.com> (raw)
In-Reply-To: <82286a4a-0688-2ada-b245-abdb998147c4@toxicpanda.com>

On Thu, Feb 06, 2020 at 11:40:37AM -0500, Josef Bacik wrote:
>On 2/6/20 5:41 AM, Naohiro Aota wrote:
>>Factor out set_parameters() from __btrfs_alloc_chunk(). This function
>>initialises parameters of "struct alloc_chunk_ctl" for allocation.
>>set_parameters() handles a common part of the initialisation to load the
>>RAID parameters from btrfs_raid_array. set_parameters_regular() decides
>>some parameters for its allocation.
>>
>>Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
>>---
>>  fs/btrfs/volumes.c | 96 ++++++++++++++++++++++++++++------------------
>>  1 file changed, 59 insertions(+), 37 deletions(-)
>>
>>diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>>index cfde302bf297..a5d6f0b5ca70 100644
>>--- a/fs/btrfs/volumes.c
>>+++ b/fs/btrfs/volumes.c
>>@@ -4841,6 +4841,60 @@ struct alloc_chunk_ctl {
>>  	int ndevs;
>>  };
>>+static void set_parameters_regular(struct btrfs_fs_devices *fs_devices,
>>+				   struct alloc_chunk_ctl *ctl)
>
>init_alloc_chunk_ctl_policy_regular()
>
>>+{
>>+	u64 type = ctl->type;
>>+
>>+	if (type & BTRFS_BLOCK_GROUP_DATA) {
>>+		ctl->max_stripe_size = SZ_1G;
>>+		ctl->max_chunk_size = BTRFS_MAX_DATA_CHUNK_SIZE;
>>+	} else if (type & BTRFS_BLOCK_GROUP_METADATA) {
>>+		/* for larger filesystems, use larger metadata chunks */
>>+		if (fs_devices->total_rw_bytes > 50ULL * SZ_1G)
>>+			ctl->max_stripe_size = SZ_1G;
>>+		else
>>+			ctl->max_stripe_size = SZ_256M;
>>+		ctl->max_chunk_size = ctl->max_stripe_size;
>>+	} else if (type & BTRFS_BLOCK_GROUP_SYSTEM) {
>>+		ctl->max_stripe_size = SZ_32M;
>>+		ctl->max_chunk_size = 2 * ctl->max_stripe_size;
>>+		ctl->devs_max = min_t(int, ctl->devs_max,
>>+				      BTRFS_MAX_DEVS_SYS_CHUNK);
>>+	} else {
>>+		BUG();
>>+	}
>>+
>>+	/* We don't want a chunk larger than 10% of writable space */
>>+	ctl->max_chunk_size = min(div_factor(fs_devices->total_rw_bytes, 1),
>>+				  ctl->max_chunk_size);
>>+}
>>+
>>+static void set_parameters(struct btrfs_fs_devices *fs_devices,
>>+			   struct alloc_chunk_ctl *ctl)
>
>init_alloc_chunk_ctl().  These function names need to be more descriptive.  Thanks,

I see. I renamed these two.

Thanks,

  reply	other threads:[~2020-02-07  7:59 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 10:41 [PATCH 00/20] btrfs: refactor and generalize chunk/dev_extent/extent allocation Naohiro Aota
2020-02-06 10:41 ` [PATCH 01/20] btrfs: change type of full_search to bool Naohiro Aota
2020-02-06 11:26   ` Johannes Thumshirn
2020-02-06 16:03   ` Josef Bacik
2020-02-06 10:41 ` [PATCH 02/20] btrfs: introduce chunk allocation policy Naohiro Aota
2020-02-06 11:30   ` Johannes Thumshirn
2020-02-07  6:11     ` Naohiro Aota
2020-02-06 16:06   ` Josef Bacik
2020-02-06 16:07   ` Josef Bacik
2020-02-06 10:41 ` [PATCH 03/20] btrfs: refactor find_free_dev_extent_start() Naohiro Aota
2020-02-06 12:02   ` Johannes Thumshirn
2020-02-07  6:22     ` Naohiro Aota
2020-02-06 16:34   ` Josef Bacik
2020-02-06 10:41 ` [PATCH 04/20] btrfs: introduce alloc_chunk_ctl Naohiro Aota
2020-02-06 12:07   ` Johannes Thumshirn
2020-02-06 16:38   ` Josef Bacik
2020-02-07  7:08     ` Naohiro Aota
2020-02-06 10:41 ` [PATCH 05/20] btrfs: factor out set_parameters() Naohiro Aota
2020-02-06 13:51   ` Johannes Thumshirn
2020-02-06 16:40   ` Josef Bacik
2020-02-07  7:59     ` Naohiro Aota [this message]
2020-02-06 10:42 ` [PATCH 06/20] btrfs: factor out gather_device_info() Naohiro Aota
2020-02-06 15:43   ` Johannes Thumshirn
2020-02-07  9:54     ` Naohiro Aota
2020-02-06 16:44   ` Josef Bacik
2020-02-06 10:42 ` [PATCH 07/20] btrfs: factor out decide_stripe_size() Naohiro Aota
2020-02-06 15:59   ` Johannes Thumshirn
2020-02-06 16:47   ` Josef Bacik
2020-02-06 10:42 ` [PATCH 08/20] btrfs: factor out create_chunk() Naohiro Aota
2020-02-06 16:49   ` Josef Bacik
2020-02-07  9:17     ` Naohiro Aota
2020-02-06 10:42 ` [PATCH 09/20] btrfs: parameterize dev_extent_min Naohiro Aota
2020-02-06 16:52   ` Josef Bacik
2020-02-07  9:00     ` Naohiro Aota
2020-02-06 10:42 ` [PATCH 10/20] btrfs: introduce extent allocation policy Naohiro Aota
2020-02-06 10:42 ` [PATCH 11/20] btrfs: move hint_byte into find_free_extent_ctl Naohiro Aota
2020-02-06 10:42 ` [PATCH 12/20] btrfs: introduce clustered_alloc_info Naohiro Aota
2020-02-06 12:44   ` Su Yue
2020-02-07  9:25     ` Naohiro Aota
2020-02-06 17:01   ` Josef Bacik
2020-02-07  9:53     ` Naohiro Aota
2020-02-06 10:42 ` [PATCH 13/20] btrfs: factor out do_allocation() Naohiro Aota
2020-02-06 10:42 ` [PATCH 14/20] btrfs: drop unnecessary arguments from clustered allocation functions Naohiro Aota
2020-02-06 10:42 ` [PATCH 15/20] btrfs: factor out release_block_group() Naohiro Aota
2020-02-06 10:42 ` [PATCH 16/20] btrfs: factor out found_extent() Naohiro Aota
2020-02-06 10:42 ` [PATCH 17/20] btrfs: drop unnecessary arguments from find_free_extent_update_loop() Naohiro Aota
2020-02-06 10:42 ` [PATCH 18/20] btrfs: factor out chunk_allocation_failed() Naohiro Aota
2020-02-06 10:42 ` [PATCH 19/20] btrfs: skip LOOP_NO_EMPTY_SIZE if not clustered allocation Naohiro Aota
2020-02-06 10:42 ` [PATCH 20/20] btrfs: factor out prepare_allocation() Naohiro Aota
2020-02-06 11:43 ` [PATCH 00/20] btrfs: refactor and generalize chunk/dev_extent/extent allocation Martin Steigerwald
2020-02-07  6:06   ` Naohiro Aota
2020-02-07  8:02     ` Martin Steigerwald

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=20200207075901.o4lfuf3txharr4co@naota.dhcp.fujisawa.hgst.com \
    --to=naohiro.aota@wdc.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=anand.jain@oracle.com \
    --cc=clm@fb.com \
    --cc=damien.lemoal@wdc.com \
    --cc=dsterba@suse.com \
    --cc=hare@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=nborisov@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).