aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2012-01-16 15:27:58 -0500
committerChris Mason <chris.mason@oracle.com>2012-01-16 15:27:58 -0500
commitc126dea771be1b3c370c0ffc4a09e6a82d492a49 (patch)
tree99fc723ba2e89d767e260244cf8d19467bc68c8b /fs/btrfs/disk-io.c
parent9785dbdf265ddc47d5c88267d89a97648c0dc14b (diff)
parent21adbd5cbb5344a3fca6bb7ddb2ab6cb03c44546 (diff)
Merge branch 'integrity-check-patch-v2' of git://btrfs.giantdisaster.de/git/btrfs into integration
Conflicts: fs/btrfs/ctree.h fs/btrfs/super.c Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 9be97716c5e0..da4457f84d78 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -43,6 +43,7 @@
43#include "tree-log.h" 43#include "tree-log.h"
44#include "free-space-cache.h" 44#include "free-space-cache.h"
45#include "inode-map.h" 45#include "inode-map.h"
46#include "check-integrity.h"
46 47
47static struct extent_io_ops btree_extent_io_ops; 48static struct extent_io_ops btree_extent_io_ops;
48static void end_workqueue_fn(struct btrfs_work *work); 49static void end_workqueue_fn(struct btrfs_work *work);
@@ -2002,6 +2003,9 @@ struct btrfs_root *open_ctree(struct super_block *sb,
2002 init_waitqueue_head(&fs_info->scrub_pause_wait); 2003 init_waitqueue_head(&fs_info->scrub_pause_wait);
2003 init_rwsem(&fs_info->scrub_super_lock); 2004 init_rwsem(&fs_info->scrub_super_lock);
2004 fs_info->scrub_workers_refcnt = 0; 2005 fs_info->scrub_workers_refcnt = 0;
2006#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
2007 fs_info->check_integrity_print_mask = 0;
2008#endif
2005 2009
2006 spin_lock_init(&fs_info->balance_lock); 2010 spin_lock_init(&fs_info->balance_lock);
2007 mutex_init(&fs_info->balance_mutex); 2011 mutex_init(&fs_info->balance_mutex);
@@ -2360,6 +2364,19 @@ retry_root_backup:
2360 btrfs_set_opt(fs_info->mount_opt, SSD); 2364 btrfs_set_opt(fs_info->mount_opt, SSD);
2361 } 2365 }
2362 2366
2367#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
2368 if (btrfs_test_opt(tree_root, CHECK_INTEGRITY)) {
2369 ret = btrfsic_mount(tree_root, fs_devices,
2370 btrfs_test_opt(tree_root,
2371 CHECK_INTEGRITY_INCLUDING_EXTENT_DATA) ?
2372 1 : 0,
2373 fs_info->check_integrity_print_mask);
2374 if (ret)
2375 printk(KERN_WARNING "btrfs: failed to initialize"
2376 " integrity check module %s\n", sb->s_id);
2377 }
2378#endif
2379
2363 /* do not make disk changes in broken FS */ 2380 /* do not make disk changes in broken FS */
2364 if (btrfs_super_log_root(disk_super) != 0 && 2381 if (btrfs_super_log_root(disk_super) != 0 &&
2365 !(fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR)) { 2382 !(fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR)) {
@@ -2642,7 +2659,7 @@ static int write_dev_supers(struct btrfs_device *device,
2642 * we fua the first super. The others we allow 2659 * we fua the first super. The others we allow
2643 * to go down lazy. 2660 * to go down lazy.
2644 */ 2661 */
2645 ret = submit_bh(WRITE_FUA, bh); 2662 ret = btrfsic_submit_bh(WRITE_FUA, bh);
2646 if (ret) 2663 if (ret)
2647 errors++; 2664 errors++;
2648 } 2665 }
@@ -2719,7 +2736,7 @@ static int write_dev_flush(struct btrfs_device *device, int wait)
2719 device->flush_bio = bio; 2736 device->flush_bio = bio;
2720 2737
2721 bio_get(bio); 2738 bio_get(bio);
2722 submit_bio(WRITE_FLUSH, bio); 2739 btrfsic_submit_bio(WRITE_FLUSH, bio);
2723 2740
2724 return 0; 2741 return 0;
2725} 2742}
@@ -3068,6 +3085,11 @@ int close_ctree(struct btrfs_root *root)
3068 btrfs_stop_workers(&fs_info->caching_workers); 3085 btrfs_stop_workers(&fs_info->caching_workers);
3069 btrfs_stop_workers(&fs_info->readahead_workers); 3086 btrfs_stop_workers(&fs_info->readahead_workers);
3070 3087
3088#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
3089 if (btrfs_test_opt(root, CHECK_INTEGRITY))
3090 btrfsic_unmount(root, fs_info->fs_devices);
3091#endif
3092
3071 btrfs_close_devices(fs_info->fs_devices); 3093 btrfs_close_devices(fs_info->fs_devices);
3072 btrfs_mapping_tree_free(&fs_info->mapping_tree); 3094 btrfs_mapping_tree_free(&fs_info->mapping_tree);
3073 3095