aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2010-06-21 14:48:16 -0400
committerJosef Bacik <josef@redhat.com>2010-10-28 15:59:09 -0400
commit0af3d00bad38d3bb9912a60928ad0669f17bdb76 (patch)
treeabbf4c773138a33dcde483ac60f016c4b5e55dcc /fs/btrfs/super.c
parentf6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff)
Btrfs: create special free space cache inode
In order to save free space cache, we need an inode to hold the data, and we need a special item to point at the right inode for the right block group. So first, create a special item that will point to the right inode, and the number of extent entries we will have and the number of bitmaps we will have. We truncate and pre-allocate space everytime to make sure it's uptodate. This feature will be turned on as soon as you mount with -o space_cache, however it is safe to boot into old kernels, they will just generate the cache the old fashion way. When you boot back into a newer kernel we will notice that we modified and not the cache and automatically discard the cache. Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 1776dbd8dc98..5c23eb8d6ba3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -68,7 +68,7 @@ enum {
68 Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd, 68 Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd,
69 Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress, 69 Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress,
70 Opt_compress_force, Opt_notreelog, Opt_ratio, Opt_flushoncommit, 70 Opt_compress_force, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
71 Opt_discard, Opt_err, 71 Opt_discard, Opt_space_cache, Opt_err,
72}; 72};
73 73
74static match_table_t tokens = { 74static match_table_t tokens = {
@@ -92,6 +92,7 @@ static match_table_t tokens = {
92 {Opt_flushoncommit, "flushoncommit"}, 92 {Opt_flushoncommit, "flushoncommit"},
93 {Opt_ratio, "metadata_ratio=%d"}, 93 {Opt_ratio, "metadata_ratio=%d"},
94 {Opt_discard, "discard"}, 94 {Opt_discard, "discard"},
95 {Opt_space_cache, "space_cache"},
95 {Opt_err, NULL}, 96 {Opt_err, NULL},
96}; 97};
97 98
@@ -235,6 +236,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
235 case Opt_discard: 236 case Opt_discard:
236 btrfs_set_opt(info->mount_opt, DISCARD); 237 btrfs_set_opt(info->mount_opt, DISCARD);
237 break; 238 break;
239 case Opt_space_cache:
240 printk(KERN_INFO "btrfs: enabling disk space caching\n");
241 btrfs_set_opt(info->mount_opt, SPACE_CACHE);
242 break;
238 case Opt_err: 243 case Opt_err:
239 printk(KERN_INFO "btrfs: unrecognized mount option " 244 printk(KERN_INFO "btrfs: unrecognized mount option "
240 "'%s'\n", p); 245 "'%s'\n", p);