summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2010-09-21 14:21:34 -0400
committerChris Mason <chris.mason@oracle.com>2010-10-29 09:26:36 -0400
commit88c2ba3b069f1e0f4694124d02985fa7620a19f1 (patch)
treee41859aca299e14e2658d75e2bf1ef2aea9ab077 /fs/btrfs/super.c
parent67377734fd24c32cbdfeb697c2e2bd7fed519e75 (diff)
downloadlinux-88c2ba3b069f1e0f4694124d02985fa7620a19f1.tar.bz2
Btrfs: Add a clear_cache mount option
If something goes wrong with the free space cache we need a way to make sure it's not loaded on mount and that it's cleared for everybody. When you pass the clear_cache option it will make it so all block groups are setup to be cleared, which keeps them from being loaded and then they will be truncated when the transaction is committed. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 5c23eb8d6ba3..5f56213908e7 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -68,7 +68,7 @@ enum {
Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd,
Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress,
Opt_compress_force, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
- Opt_discard, Opt_space_cache, Opt_err,
+ Opt_discard, Opt_space_cache, Opt_clear_cache, Opt_err,
};
static match_table_t tokens = {
@@ -93,6 +93,7 @@ static match_table_t tokens = {
{Opt_ratio, "metadata_ratio=%d"},
{Opt_discard, "discard"},
{Opt_space_cache, "space_cache"},
+ {Opt_clear_cache, "clear_cache"},
{Opt_err, NULL},
};
@@ -239,6 +240,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
case Opt_space_cache:
printk(KERN_INFO "btrfs: enabling disk space caching\n");
btrfs_set_opt(info->mount_opt, SPACE_CACHE);
+ case Opt_clear_cache:
+ printk(KERN_INFO "btrfs: force clearing of disk cache\n");
+ btrfs_set_opt(info->mount_opt, CLEAR_CACHE);
break;
case Opt_err:
printk(KERN_INFO "btrfs: unrecognized mount option "