From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 15/19] ext4: tune mballoc's default group prealloc size for bigalloc file systems
Date: Tue, 3 May 2011 18:24:45 -0400 [thread overview]
Message-ID: <1304461490-11056-16-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1304461490-11056-1-git-send-email-tytso@mit.edu>
The default group preallocation size had been previously set to 512
blocks/clusters, regardless of the block/cluster size. This is
probably too big for large cluster sizes. So adjust the default so
that it is 2 megabytes or 32 clusters, whichever is larger.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
fs/ext4/mballoc.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index a7af56c..4f8494d 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -126,7 +126,8 @@
* list. In case of inode preallocation we follow a list of heuristics
* based on file size. This can be found in ext4_mb_normalize_request. If
* we are doing a group prealloc we try to normalize the request to
- * sbi->s_mb_group_prealloc. Default value of s_mb_group_prealloc is
+ * sbi->s_mb_group_prealloc. The default value of s_mb_group_prealloc is
+ * dependent on the cluster size; for non-bigalloc file systems, it is
* 512 blocks. This can be tuned via
* /sys/fs/ext4/<partition/mb_group_prealloc. The value is represented in
* terms of number of blocks. If we have mounted the file system with -O
@@ -2531,7 +2532,20 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery)
sbi->s_mb_stats = MB_DEFAULT_STATS;
sbi->s_mb_stream_request = MB_DEFAULT_STREAM_THRESHOLD;
sbi->s_mb_order2_reqs = MB_DEFAULT_ORDER2_REQS;
- sbi->s_mb_group_prealloc = MB_DEFAULT_GROUP_PREALLOC;
+ /*
+ * The default group preallocation is 512, which for 4k block
+ * sizes translates to 2 megabytes. However for bigalloc file
+ * systems, this is probably too big (i.e, if the cluster size
+ * is 1 megabyte, then group preallocation size becomes half a
+ * gigabyte!). As a default, we will keep a two megabyte
+ * group pralloc size for cluster sizes up to 64k, and after
+ * that, we will force a minimum group preallocation size of
+ * 32 clusters. This translates to 8 megs when the cluster
+ * size is 256k, and 32 megs when the cluster size is 1 meg,
+ * which seems reasonable as a default.
+ */
+ sbi->s_mb_group_prealloc = max(MB_DEFAULT_GROUP_PREALLOC >>
+ sbi->s_cluster_bits, 32);
sbi->s_locality_groups = alloc_percpu(struct ext4_locality_group);
if (sbi->s_locality_groups == NULL) {
--
1.7.3.1
next prev parent reply other threads:[~2011-05-03 22:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-03 22:24 [PATCH 00/19] V2 Bigalloc patches Theodore Ts'o
2011-05-03 22:24 ` [PATCH 01/19] ext4: read-only support for bigalloc file systems Theodore Ts'o
2011-05-03 22:24 ` [PATCH 02/19] ext4: enforce bigalloc restrictions (e.g., no online resizing, etc.) Theodore Ts'o
2011-05-03 22:24 ` [PATCH 03/19] ext4: convert instances of EXT4_BLOCKS_PER_GROUP to EXT4_CLUSTERS_PER_GROUP Theodore Ts'o
2011-05-03 22:24 ` [PATCH 04/19] ext4: factor out block group accounting into functions Theodore Ts'o
2011-05-03 22:24 ` [PATCH 05/19] ext4: split out ext4_free_blocks_after_init() Theodore Ts'o
2011-05-03 22:24 ` [PATCH 06/19] ext4: bigalloc changes to block bitmap initialization functions Theodore Ts'o
2011-05-03 22:24 ` [PATCH 07/19] ext4: convert block group-relative offsets to use clusters Theodore Ts'o
2011-05-03 22:24 ` [PATCH 08/19] ext4: teach mballoc preallocation code about bigalloc clusters Theodore Ts'o
2011-05-03 22:24 ` [PATCH 09/19] ext4: teach ext4_free_blocks() about bigalloc and clusters Theodore Ts'o
2011-05-03 22:24 ` [PATCH 10/19] ext4: teach ext4_ext_map_blocks() about the bigalloc feature Theodore Ts'o
2011-05-03 22:24 ` [PATCH 11/19] ext4: teach ext4_ext_truncate() " Theodore Ts'o
2011-05-03 22:24 ` [PATCH 12/19] ext4: convert s_freeblocks_counter to s_freeclusters_counter Theodore Ts'o
2011-05-03 22:24 ` [PATCH 13/19] ext4: convert the free_blocks field in s_flex_groups to be free_clusters Theodore Ts'o
2011-05-03 22:24 ` [PATCH 14/19] ext4: teach ext4_statfs() to deal with clusters if bigalloc is enabled Theodore Ts'o
2011-05-03 22:24 ` Theodore Ts'o [this message]
2011-05-03 22:24 ` [PATCH 16/19] ext4: enable mounting bigalloc as read/write Theodore Ts'o
2011-05-03 22:24 ` [PATCH 17/19] ext4: Rename ext4_free_blks_{count,set}() to refer to clusters Theodore Ts'o
2011-05-03 22:24 ` [PATCH 18/19] ext4: rename ext4_count_free_blocks() to ext4_count_free_clusters() Theodore Ts'o
2011-05-03 22:24 ` [PATCH 19/19] ext4: rename ext4_free_blocks_after_init() to ext4_free_clusters_after_init() Theodore Ts'o
2011-05-03 22:24 ` [E2FSPROGS PATCH] Interim patches for e2fsprogs Theodore Ts'o
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=1304461490-11056-16-git-send-email-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
/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).