diff options
author | Stefan Behrens <sbehrens@giantdisaster.de> | 2011-11-09 07:44:05 -0500 |
---|---|---|
committer | Stefan Behrens <sbehrens@giantdisaster.de> | 2011-12-21 13:14:17 -0500 |
commit | 21adbd5cbb5344a3fca6bb7ddb2ab6cb03c44546 (patch) | |
tree | 208c3ab6ad8bb35937b21c4d54e45e46d99557ff /fs/btrfs/super.c | |
parent | f11e4d7f533249ddfa110116200c5c3a509f9218 (diff) |
Btrfs: integrate integrity check module into btrfs
This is the last part of the patch series. It modifies the btrfs
code to use the integrity check module if configured to do so
with the define BTRFS_FS_CHECK_INTEGRITY. If this define is not set,
the only effective change is that code is added that handles the
mount option to activate the integrity check. If the mount option is
set and the define BTRFS_FS_CHECK_INTEGRITY is not set, that code
complains in the log and the mount fails with EINVAL.
Add the mount option to activate the usage of the integrity check
code.
Add invocation of btrfs integrity check code init and cleanup
function on mount and umount, respectively.
Add hook to call btrfs integrity check code version of
submit_bh/submit_bio.
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 34a8b6112ea4..22a2015f1d7b 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -165,7 +165,10 @@ enum { | |||
165 | Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, | 165 | Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, |
166 | Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, | 166 | Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, |
167 | Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, | 167 | Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, |
168 | Opt_inode_cache, Opt_no_space_cache, Opt_recovery, Opt_err, | 168 | Opt_inode_cache, Opt_no_space_cache, Opt_recovery, |
169 | Opt_check_integrity, Opt_check_integrity_including_extent_data, | ||
170 | Opt_check_integrity_print_mask, | ||
171 | Opt_err, | ||
169 | }; | 172 | }; |
170 | 173 | ||
171 | static match_table_t tokens = { | 174 | static match_table_t tokens = { |
@@ -200,6 +203,9 @@ static match_table_t tokens = { | |||
200 | {Opt_inode_cache, "inode_cache"}, | 203 | {Opt_inode_cache, "inode_cache"}, |
201 | {Opt_no_space_cache, "nospace_cache"}, | 204 | {Opt_no_space_cache, "nospace_cache"}, |
202 | {Opt_recovery, "recovery"}, | 205 | {Opt_recovery, "recovery"}, |
206 | {Opt_check_integrity, "check_int"}, | ||
207 | {Opt_check_integrity_including_extent_data, "check_int_data"}, | ||
208 | {Opt_check_integrity_print_mask, "check_int_print_mask=%d"}, | ||
203 | {Opt_err, NULL}, | 209 | {Opt_err, NULL}, |
204 | }; | 210 | }; |
205 | 211 | ||
@@ -398,6 +404,37 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
398 | printk(KERN_INFO "btrfs: enabling auto recovery"); | 404 | printk(KERN_INFO "btrfs: enabling auto recovery"); |
399 | btrfs_set_opt(info->mount_opt, RECOVERY); | 405 | btrfs_set_opt(info->mount_opt, RECOVERY); |
400 | break; | 406 | break; |
407 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | ||
408 | case Opt_check_integrity_including_extent_data: | ||
409 | printk(KERN_INFO "btrfs: enabling check integrity" | ||
410 | " including extent data\n"); | ||
411 | btrfs_set_opt(info->mount_opt, | ||
412 | CHECK_INTEGRITY_INCLUDING_EXTENT_DATA); | ||
413 | btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY); | ||
414 | break; | ||
415 | case Opt_check_integrity: | ||
416 | printk(KERN_INFO "btrfs: enabling check integrity\n"); | ||
417 | btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY); | ||
418 | break; | ||
419 | case Opt_check_integrity_print_mask: | ||
420 | intarg = 0; | ||
421 | match_int(&args[0], &intarg); | ||
422 | if (intarg) { | ||
423 | info->check_integrity_print_mask = intarg; | ||
424 | printk(KERN_INFO "btrfs:" | ||
425 | " check_integrity_print_mask 0x%x\n", | ||
426 | info->check_integrity_print_mask); | ||
427 | } | ||
428 | break; | ||
429 | #else | ||
430 | case Opt_check_integrity_including_extent_data: | ||
431 | case Opt_check_integrity: | ||
432 | case Opt_check_integrity_print_mask: | ||
433 | printk(KERN_ERR "btrfs: support for check_integrity*" | ||
434 | " not compiled in!\n"); | ||
435 | ret = -EINVAL; | ||
436 | goto out; | ||
437 | #endif | ||
401 | case Opt_err: | 438 | case Opt_err: |
402 | printk(KERN_INFO "btrfs: unrecognized mount option " | 439 | printk(KERN_INFO "btrfs: unrecognized mount option " |
403 | "'%s'\n", p); | 440 | "'%s'\n", p); |