diff options
author | Josef Bacik <jbacik@redhat.com> | 2009-04-21 17:40:57 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-04-24 15:46:02 -0400 |
commit | 97e728d4353f38c87bf0804cdfd79a9b13fc2c3e (patch) | |
tree | 853d3317ff1476e4ad28921265e28b4919196304 /fs/btrfs/super.c | |
parent | 546888da82082555a56528730a83f0afd12f33bf (diff) |
Btrfs: try to keep a healthy ratio of metadata vs data block groups
This patch makes the chunk allocator keep a good ratio of metadata vs data
block groups. By default for every 8 data block groups, we'll allocate 1
metadata chunk, or about 12% of the disk will be allocated for metadata. This
can be changed by specifying the metadata_ratio mount option.
This is simply the number of data block groups that have to be allocated to
force a metadata chunk allocation. By making sure we allocate metadata chunks
more often, we are less likely to get into situations where the whole disk
has been allocated as data block groups.
Signed-off-by: Josef Bacik <jbacik@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 9744af9d71e9..30c9a8ca2a54 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -68,7 +68,7 @@ enum { | |||
68 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, | 68 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, |
69 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, | 69 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, |
70 | Opt_ssd, Opt_thread_pool, Opt_noacl, Opt_compress, Opt_notreelog, | 70 | Opt_ssd, Opt_thread_pool, Opt_noacl, Opt_compress, Opt_notreelog, |
71 | Opt_flushoncommit, Opt_err, | 71 | Opt_ratio, Opt_flushoncommit, Opt_err, |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static match_table_t tokens = { | 74 | static match_table_t tokens = { |
@@ -87,6 +87,7 @@ static match_table_t tokens = { | |||
87 | {Opt_noacl, "noacl"}, | 87 | {Opt_noacl, "noacl"}, |
88 | {Opt_notreelog, "notreelog"}, | 88 | {Opt_notreelog, "notreelog"}, |
89 | {Opt_flushoncommit, "flushoncommit"}, | 89 | {Opt_flushoncommit, "flushoncommit"}, |
90 | {Opt_ratio, "metadata_ratio=%d"}, | ||
90 | {Opt_err, NULL}, | 91 | {Opt_err, NULL}, |
91 | }; | 92 | }; |
92 | 93 | ||
@@ -234,6 +235,15 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
234 | printk(KERN_INFO "btrfs: turning on flush-on-commit\n"); | 235 | printk(KERN_INFO "btrfs: turning on flush-on-commit\n"); |
235 | btrfs_set_opt(info->mount_opt, FLUSHONCOMMIT); | 236 | btrfs_set_opt(info->mount_opt, FLUSHONCOMMIT); |
236 | break; | 237 | break; |
238 | case Opt_ratio: | ||
239 | intarg = 0; | ||
240 | match_int(&args[0], &intarg); | ||
241 | if (intarg) { | ||
242 | info->metadata_ratio = intarg; | ||
243 | printk(KERN_INFO "btrfs: metadata ratio %d\n", | ||
244 | info->metadata_ratio); | ||
245 | } | ||
246 | break; | ||
237 | default: | 247 | default: |
238 | break; | 248 | break; |
239 | } | 249 | } |