diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 3f9d5551e582..f363c6d9c3de 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 | ||
47 | static struct extent_io_ops btree_extent_io_ops; | 48 | static struct extent_io_ops btree_extent_io_ops; |
48 | static void end_workqueue_fn(struct btrfs_work *work); | 49 | static void end_workqueue_fn(struct btrfs_work *work); |
@@ -2001,6 +2002,9 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
2001 | init_waitqueue_head(&fs_info->scrub_pause_wait); | 2002 | init_waitqueue_head(&fs_info->scrub_pause_wait); |
2002 | init_rwsem(&fs_info->scrub_super_lock); | 2003 | init_rwsem(&fs_info->scrub_super_lock); |
2003 | fs_info->scrub_workers_refcnt = 0; | 2004 | fs_info->scrub_workers_refcnt = 0; |
2005 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | ||
2006 | fs_info->check_integrity_print_mask = 0; | ||
2007 | #endif | ||
2004 | 2008 | ||
2005 | sb->s_blocksize = 4096; | 2009 | sb->s_blocksize = 4096; |
2006 | sb->s_blocksize_bits = blksize_bits(4096); | 2010 | sb->s_blocksize_bits = blksize_bits(4096); |
@@ -2356,6 +2360,19 @@ retry_root_backup: | |||
2356 | btrfs_set_opt(fs_info->mount_opt, SSD); | 2360 | btrfs_set_opt(fs_info->mount_opt, SSD); |
2357 | } | 2361 | } |
2358 | 2362 | ||
2363 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | ||
2364 | if (btrfs_test_opt(tree_root, CHECK_INTEGRITY)) { | ||
2365 | ret = btrfsic_mount(tree_root, fs_devices, | ||
2366 | btrfs_test_opt(tree_root, | ||
2367 | CHECK_INTEGRITY_INCLUDING_EXTENT_DATA) ? | ||
2368 | 1 : 0, | ||
2369 | fs_info->check_integrity_print_mask); | ||
2370 | if (ret) | ||
2371 | printk(KERN_WARNING "btrfs: failed to initialize" | ||
2372 | " integrity check module %s\n", sb->s_id); | ||
2373 | } | ||
2374 | #endif | ||
2375 | |||
2359 | /* do not make disk changes in broken FS */ | 2376 | /* do not make disk changes in broken FS */ |
2360 | if (btrfs_super_log_root(disk_super) != 0 && | 2377 | if (btrfs_super_log_root(disk_super) != 0 && |
2361 | !(fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR)) { | 2378 | !(fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR)) { |
@@ -2634,7 +2651,7 @@ static int write_dev_supers(struct btrfs_device *device, | |||
2634 | * we fua the first super. The others we allow | 2651 | * we fua the first super. The others we allow |
2635 | * to go down lazy. | 2652 | * to go down lazy. |
2636 | */ | 2653 | */ |
2637 | ret = submit_bh(WRITE_FUA, bh); | 2654 | ret = btrfsic_submit_bh(WRITE_FUA, bh); |
2638 | if (ret) | 2655 | if (ret) |
2639 | errors++; | 2656 | errors++; |
2640 | } | 2657 | } |
@@ -2711,7 +2728,7 @@ static int write_dev_flush(struct btrfs_device *device, int wait) | |||
2711 | device->flush_bio = bio; | 2728 | device->flush_bio = bio; |
2712 | 2729 | ||
2713 | bio_get(bio); | 2730 | bio_get(bio); |
2714 | submit_bio(WRITE_FLUSH, bio); | 2731 | btrfsic_submit_bio(WRITE_FLUSH, bio); |
2715 | 2732 | ||
2716 | return 0; | 2733 | return 0; |
2717 | } | 2734 | } |
@@ -3057,6 +3074,11 @@ int close_ctree(struct btrfs_root *root) | |||
3057 | btrfs_stop_workers(&fs_info->caching_workers); | 3074 | btrfs_stop_workers(&fs_info->caching_workers); |
3058 | btrfs_stop_workers(&fs_info->readahead_workers); | 3075 | btrfs_stop_workers(&fs_info->readahead_workers); |
3059 | 3076 | ||
3077 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | ||
3078 | if (btrfs_test_opt(root, CHECK_INTEGRITY)) | ||
3079 | btrfsic_unmount(root, fs_info->fs_devices); | ||
3080 | #endif | ||
3081 | |||
3060 | btrfs_close_devices(fs_info->fs_devices); | 3082 | btrfs_close_devices(fs_info->fs_devices); |
3061 | btrfs_mapping_tree_free(&fs_info->mapping_tree); | 3083 | btrfs_mapping_tree_free(&fs_info->mapping_tree); |
3062 | 3084 | ||