diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 17:23:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 17:23:12 -0400 |
commit | a525890cb6a2949b644d212ae290b658967d3919 (patch) | |
tree | a2c6c1f6cefff89b235bf6556212527e47a5d50b /fs/btrfs/super.c | |
parent | 3bb66d7f8cc31537a3170c9bb82b38e538b984c5 (diff) | |
parent | b263c2c8bf13c273485bd99dbbeba79c844409dd (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable: (23 commits)
Btrfs: fix extent_buffer leak during tree log replay
Btrfs: fix oops when btrfs_inherit_iflags called with a NULL dir
Btrfs: fix -o nodatasum printk spelling
Btrfs: check duplicate backrefs for both data and metadata
Btrfs: init worker struct fields before kthread-run
Btrfs: pin buffers during write_dev_supers
Btrfs: avoid races between super writeout and device list updates
Fix btrfs when ACLs are configured out
Btrfs: fdatasync should skip metadata writeout
Btrfs: remove crc32c.h and use libcrc32c directly.
Btrfs: implement FS_IOC_GETFLAGS/SETFLAGS/GETVERSION
Btrfs: autodetect SSD devices
Btrfs: add mount -o ssd_spread to spread allocations out
Btrfs: avoid allocation clusters that are too spread out
Btrfs: Add mount -o nossd
Btrfs: avoid IO stalls behind congested devices in a multi-device FS
Btrfs: don't allow WRITE_SYNC bios to starve out regular writes
Btrfs: fix metadata dirty throttling limits
Btrfs: reduce mount -o ssd CPU usage
Btrfs: balance btree more often
...
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 2ff7cd2db25f..708ac06b953b 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 | 358 | ||
351 | btrfs_set_key_type(&bi->location, BTRFS_INODE_ITEM_KEY); | 359 | key.objectid = BTRFS_FIRST_FREE_OBJECTID; |
352 | 360 | key.type = BTRFS_INODE_ITEM_KEY; | |
353 | if (!inode) { | 361 | key.offset = 0; |
354 | err = -ENOMEM; | 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) { |
@@ -433,7 +439,11 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
433 | seq_printf(seq, ",thread_pool=%d", info->thread_pool_size); | 439 | seq_printf(seq, ",thread_pool=%d", info->thread_pool_size); |
434 | if (btrfs_test_opt(root, COMPRESS)) | 440 | if (btrfs_test_opt(root, COMPRESS)) |
435 | seq_puts(seq, ",compress"); | 441 | seq_puts(seq, ",compress"); |
436 | if (btrfs_test_opt(root, SSD)) | 442 | if (btrfs_test_opt(root, NOSSD)) |
443 | seq_puts(seq, ",nossd"); | ||
444 | if (btrfs_test_opt(root, SSD_SPREAD)) | ||
445 | seq_puts(seq, ",ssd_spread"); | ||
446 | else if (btrfs_test_opt(root, SSD)) | ||
437 | seq_puts(seq, ",ssd"); | 447 | seq_puts(seq, ",ssd"); |
438 | if (btrfs_test_opt(root, NOTREELOG)) | 448 | if (btrfs_test_opt(root, NOTREELOG)) |
439 | seq_puts(seq, ",notreelog"); | 449 | seq_puts(seq, ",notreelog"); |
@@ -584,7 +594,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) | 594 | if (btrfs_super_log_root(&root->fs_info->super_copy) != 0) |
585 | return -EINVAL; | 595 | return -EINVAL; |
586 | 596 | ||
587 | ret = btrfs_cleanup_reloc_trees(root); | 597 | /* recover relocation */ |
598 | ret = btrfs_recover_relocation(root); | ||
588 | WARN_ON(ret); | 599 | WARN_ON(ret); |
589 | 600 | ||
590 | ret = btrfs_cleanup_fs_roots(root->fs_info); | 601 | ret = btrfs_cleanup_fs_roots(root->fs_info); |