diff options
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 2ff7cd2db25f..9f179d4832d5 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -52,7 +52,6 @@ | |||
52 | #include "export.h" | 52 | #include "export.h" |
53 | #include "compression.h" | 53 | #include "compression.h" |
54 | 54 | ||
55 | |||
56 | static struct super_operations btrfs_super_ops; | 55 | static struct super_operations btrfs_super_ops; |
57 | 56 | ||
58 | static void btrfs_put_super(struct super_block *sb) | 57 | static void btrfs_put_super(struct super_block *sb) |
@@ -67,8 +66,8 @@ static void btrfs_put_super(struct super_block *sb) | |||
67 | enum { | 66 | enum { |
68 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, | 67 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, |
69 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, | 68 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, |
70 | Opt_ssd, Opt_thread_pool, Opt_noacl, Opt_compress, Opt_notreelog, | 69 | Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, |
71 | Opt_ratio, Opt_flushoncommit, Opt_err, | 70 | Opt_compress, Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_err, |
72 | }; | 71 | }; |
73 | 72 | ||
74 | static match_table_t tokens = { | 73 | static match_table_t tokens = { |
@@ -84,6 +83,8 @@ static match_table_t tokens = { | |||
84 | {Opt_thread_pool, "thread_pool=%d"}, | 83 | {Opt_thread_pool, "thread_pool=%d"}, |
85 | {Opt_compress, "compress"}, | 84 | {Opt_compress, "compress"}, |
86 | {Opt_ssd, "ssd"}, | 85 | {Opt_ssd, "ssd"}, |
86 | {Opt_ssd_spread, "ssd_spread"}, | ||
87 | {Opt_nossd, "nossd"}, | ||
87 | {Opt_noacl, "noacl"}, | 88 | {Opt_noacl, "noacl"}, |
88 | {Opt_notreelog, "notreelog"}, | 89 | {Opt_notreelog, "notreelog"}, |
89 | {Opt_flushoncommit, "flushoncommit"}, | 90 | {Opt_flushoncommit, "flushoncommit"}, |
@@ -158,7 +159,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
158 | */ | 159 | */ |
159 | break; | 160 | break; |
160 | case Opt_nodatasum: | 161 | case Opt_nodatasum: |
161 | printk(KERN_INFO "btrfs: setting nodatacsum\n"); | 162 | printk(KERN_INFO "btrfs: setting nodatasum\n"); |
162 | btrfs_set_opt(info->mount_opt, NODATASUM); | 163 | btrfs_set_opt(info->mount_opt, NODATASUM); |
163 | break; | 164 | break; |
164 | case Opt_nodatacow: | 165 | case Opt_nodatacow: |
@@ -174,6 +175,19 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
174 | printk(KERN_INFO "btrfs: use ssd allocation scheme\n"); | 175 | printk(KERN_INFO "btrfs: use ssd allocation scheme\n"); |
175 | btrfs_set_opt(info->mount_opt, SSD); | 176 | btrfs_set_opt(info->mount_opt, SSD); |
176 | break; | 177 | break; |
178 | case Opt_ssd_spread: | ||
179 | printk(KERN_INFO "btrfs: use spread ssd " | ||
180 | "allocation scheme\n"); | ||
181 | btrfs_set_opt(info->mount_opt, SSD); | ||
182 | btrfs_set_opt(info->mount_opt, SSD_SPREAD); | ||
183 | break; | ||
184 | case Opt_nossd: | ||
185 | printk(KERN_INFO "btrfs: not using ssd allocation " | ||
186 | "scheme\n"); | ||
187 | btrfs_set_opt(info->mount_opt, NOSSD); | ||
188 | btrfs_clear_opt(info->mount_opt, SSD); | ||
189 | btrfs_clear_opt(info->mount_opt, SSD_SPREAD); | ||
190 | break; | ||
177 | case Opt_nobarrier: | 191 | case Opt_nobarrier: |
178 | printk(KERN_INFO "btrfs: turning off barriers\n"); | 192 | printk(KERN_INFO "btrfs: turning off barriers\n"); |
179 | btrfs_set_opt(info->mount_opt, NOBARRIER); | 193 | btrfs_set_opt(info->mount_opt, NOBARRIER); |
@@ -322,7 +336,7 @@ static int btrfs_fill_super(struct super_block *sb, | |||
322 | struct dentry *root_dentry; | 336 | struct dentry *root_dentry; |
323 | struct btrfs_super_block *disk_super; | 337 | struct btrfs_super_block *disk_super; |
324 | struct btrfs_root *tree_root; | 338 | struct btrfs_root *tree_root; |
325 | struct btrfs_inode *bi; | 339 | struct btrfs_key key; |
326 | int err; | 340 | int err; |
327 | 341 | ||
328 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 342 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
@@ -341,23 +355,15 @@ static int btrfs_fill_super(struct super_block *sb, | |||
341 | } | 355 | } |
342 | sb->s_fs_info = tree_root; | 356 | sb->s_fs_info = tree_root; |
343 | disk_super = &tree_root->fs_info->super_copy; | 357 | disk_super = &tree_root->fs_info->super_copy; |
344 | inode = btrfs_iget_locked(sb, BTRFS_FIRST_FREE_OBJECTID, | ||
345 | tree_root->fs_info->fs_root); | ||
346 | bi = BTRFS_I(inode); | ||
347 | bi->location.objectid = inode->i_ino; | ||
348 | bi->location.offset = 0; | ||
349 | bi->root = tree_root->fs_info->fs_root; | ||
350 | |||
351 | btrfs_set_key_type(&bi->location, BTRFS_INODE_ITEM_KEY); | ||
352 | 358 | ||
353 | if (!inode) { | 359 | key.objectid = BTRFS_FIRST_FREE_OBJECTID; |
354 | err = -ENOMEM; | 360 | key.type = BTRFS_INODE_ITEM_KEY; |
361 | key.offset = 0; | ||
362 | inode = btrfs_iget(sb, &key, tree_root->fs_info->fs_root); | ||
363 | if (IS_ERR(inode)) { | ||
364 | err = PTR_ERR(inode); | ||
355 | goto fail_close; | 365 | goto fail_close; |
356 | } | 366 | } |
357 | if (inode->i_state & I_NEW) { | ||
358 | btrfs_read_locked_inode(inode); | ||
359 | unlock_new_inode(inode); | ||
360 | } | ||
361 | 367 | ||
362 | root_dentry = d_alloc_root(inode); | 368 | root_dentry = d_alloc_root(inode); |
363 | if (!root_dentry) { | 369 | if (!root_dentry) { |
@@ -388,10 +394,6 @@ int btrfs_sync_fs(struct super_block *sb, int wait) | |||
388 | struct btrfs_root *root = btrfs_sb(sb); | 394 | struct btrfs_root *root = btrfs_sb(sb); |
389 | int ret; | 395 | int ret; |
390 | 396 | ||
391 | if (sb->s_flags & MS_RDONLY) | ||
392 | return 0; | ||
393 | |||
394 | sb->s_dirt = 0; | ||
395 | if (!wait) { | 397 | if (!wait) { |
396 | filemap_flush(root->fs_info->btree_inode->i_mapping); | 398 | filemap_flush(root->fs_info->btree_inode->i_mapping); |
397 | return 0; | 399 | return 0; |
@@ -402,7 +404,6 @@ int btrfs_sync_fs(struct super_block *sb, int wait) | |||
402 | 404 | ||
403 | trans = btrfs_start_transaction(root, 1); | 405 | trans = btrfs_start_transaction(root, 1); |
404 | ret = btrfs_commit_transaction(trans, root); | 406 | ret = btrfs_commit_transaction(trans, root); |
405 | sb->s_dirt = 0; | ||
406 | return ret; | 407 | return ret; |
407 | } | 408 | } |
408 | 409 | ||
@@ -433,7 +434,11 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
433 | seq_printf(seq, ",thread_pool=%d", info->thread_pool_size); | 434 | seq_printf(seq, ",thread_pool=%d", info->thread_pool_size); |
434 | if (btrfs_test_opt(root, COMPRESS)) | 435 | if (btrfs_test_opt(root, COMPRESS)) |
435 | seq_puts(seq, ",compress"); | 436 | seq_puts(seq, ",compress"); |
436 | if (btrfs_test_opt(root, SSD)) | 437 | if (btrfs_test_opt(root, NOSSD)) |
438 | seq_puts(seq, ",nossd"); | ||
439 | if (btrfs_test_opt(root, SSD_SPREAD)) | ||
440 | seq_puts(seq, ",ssd_spread"); | ||
441 | else if (btrfs_test_opt(root, SSD)) | ||
437 | seq_puts(seq, ",ssd"); | 442 | seq_puts(seq, ",ssd"); |
438 | if (btrfs_test_opt(root, NOTREELOG)) | 443 | if (btrfs_test_opt(root, NOTREELOG)) |
439 | seq_puts(seq, ",notreelog"); | 444 | seq_puts(seq, ",notreelog"); |
@@ -444,11 +449,6 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
444 | return 0; | 449 | return 0; |
445 | } | 450 | } |
446 | 451 | ||
447 | static void btrfs_write_super(struct super_block *sb) | ||
448 | { | ||
449 | sb->s_dirt = 0; | ||
450 | } | ||
451 | |||
452 | static int btrfs_test_super(struct super_block *s, void *data) | 452 | static int btrfs_test_super(struct super_block *s, void *data) |
453 | { | 453 | { |
454 | struct btrfs_fs_devices *test_fs_devices = data; | 454 | struct btrfs_fs_devices *test_fs_devices = data; |
@@ -584,7 +584,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
584 | if (btrfs_super_log_root(&root->fs_info->super_copy) != 0) | 584 | if (btrfs_super_log_root(&root->fs_info->super_copy) != 0) |
585 | return -EINVAL; | 585 | return -EINVAL; |
586 | 586 | ||
587 | ret = btrfs_cleanup_reloc_trees(root); | 587 | /* recover relocation */ |
588 | ret = btrfs_recover_relocation(root); | ||
588 | WARN_ON(ret); | 589 | WARN_ON(ret); |
589 | 590 | ||
590 | ret = btrfs_cleanup_fs_roots(root->fs_info); | 591 | ret = btrfs_cleanup_fs_roots(root->fs_info); |
@@ -678,7 +679,6 @@ static int btrfs_unfreeze(struct super_block *sb) | |||
678 | static struct super_operations btrfs_super_ops = { | 679 | static struct super_operations btrfs_super_ops = { |
679 | .delete_inode = btrfs_delete_inode, | 680 | .delete_inode = btrfs_delete_inode, |
680 | .put_super = btrfs_put_super, | 681 | .put_super = btrfs_put_super, |
681 | .write_super = btrfs_write_super, | ||
682 | .sync_fs = btrfs_sync_fs, | 682 | .sync_fs = btrfs_sync_fs, |
683 | .show_options = btrfs_show_options, | 683 | .show_options = btrfs_show_options, |
684 | .write_inode = btrfs_write_inode, | 684 | .write_inode = btrfs_write_inode, |