aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2011-05-24 15:35:30 -0400
committerChris Mason <chris.mason@oracle.com>2011-05-26 17:52:15 -0400
commit4cb5300bc839b8a943eb19c9f27f25470e22d0ca (patch)
treeac0f2fb481c7aa6af08a624d276fa6d580c94c9b /fs/btrfs/super.c
parentd6c0cb379c5198487e4ac124728cbb2346d63b1f (diff)
Btrfs: add mount -o auto_defrag
This will detect small random writes into files and queue the up for an auto defrag process. It isn't well suited to database workloads yet, but works for smaller files such as rpm, sqlite or bdb databases. Signed-off-by: Chris Mason <chris.mason@oracle.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 cd0c7cd2c8fb..28e3cb2607ff 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -160,7 +160,7 @@ enum {
160 Opt_compress_type, Opt_compress_force, Opt_compress_force_type, 160 Opt_compress_type, Opt_compress_force, Opt_compress_force_type,
161 Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, 161 Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard,
162 Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, 162 Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed,
163 Opt_enospc_debug, Opt_subvolrootid, Opt_err, 163 Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, Opt_err,
164}; 164};
165 165
166static match_table_t tokens = { 166static match_table_t tokens = {
@@ -191,6 +191,7 @@ static match_table_t tokens = {
191 {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"}, 191 {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"},
192 {Opt_enospc_debug, "enospc_debug"}, 192 {Opt_enospc_debug, "enospc_debug"},
193 {Opt_subvolrootid, "subvolrootid=%d"}, 193 {Opt_subvolrootid, "subvolrootid=%d"},
194 {Opt_defrag, "autodefrag"},
194 {Opt_err, NULL}, 195 {Opt_err, NULL},
195}; 196};
196 197
@@ -369,6 +370,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
369 case Opt_enospc_debug: 370 case Opt_enospc_debug:
370 btrfs_set_opt(info->mount_opt, ENOSPC_DEBUG); 371 btrfs_set_opt(info->mount_opt, ENOSPC_DEBUG);
371 break; 372 break;
373 case Opt_defrag:
374 printk(KERN_INFO "btrfs: enabling auto defrag");
375 btrfs_set_opt(info->mount_opt, AUTO_DEFRAG);
376 break;
372 case Opt_err: 377 case Opt_err:
373 printk(KERN_INFO "btrfs: unrecognized mount option " 378 printk(KERN_INFO "btrfs: unrecognized mount option "
374 "'%s'\n", p); 379 "'%s'\n", p);