From: Chris Mason Date: Mon, 16 Jan 2012 20:27:58 +0000 (-0500) Subject: Merge branch 'integrity-check-patch-v2' of git://btrfs.giantdisaster.de/git/btrfs... X-Git-Tag: v4.13~12729^2~9 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c126dea771be1b3c370c0ffc4a09e6a82d492a49;p=mirror_ubuntu-bionic-kernel.git 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 --- c126dea771be1b3c370c0ffc4a09e6a82d492a49 diff --cc fs/btrfs/Makefile index 70798407b9a2,bc5b3556cee6..0c4fa2befae7 --- a/fs/btrfs/Makefile +++ b/fs/btrfs/Makefile @@@ -8,6 -8,7 +8,7 @@@ btrfs-y += super.o ctree.o extent-tree. extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o \ export.o tree-log.o free-space-cache.o zlib.o lzo.o \ compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \ - reada.o backref.o + reada.o backref.o ulist.o btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o + btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o diff --cc fs/btrfs/ctree.h index b6d1020c4571,39f6188688e6..3c2cbf7b6663 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@@ -1496,7 -1417,8 +1500,9 @@@ struct btrfs_ioctl_defrag_range_args #define BTRFS_MOUNT_AUTO_DEFRAG (1 << 16) #define BTRFS_MOUNT_INODE_MAP_CACHE (1 << 17) #define BTRFS_MOUNT_RECOVERY (1 << 18) -#define BTRFS_MOUNT_CHECK_INTEGRITY (1 << 19) -#define BTRFS_MOUNT_CHECK_INTEGRITY_INCLUDING_EXTENT_DATA (1 << 20) +#define BTRFS_MOUNT_SKIP_BALANCE (1 << 19) ++#define BTRFS_MOUNT_CHECK_INTEGRITY (1 << 20) ++#define BTRFS_MOUNT_CHECK_INTEGRITY_INCLUDING_EXTENT_DATA (1 << 21) #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) diff --cc fs/btrfs/disk-io.c index 9be97716c5e0,f363c6d9c3de..da4457f84d78 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@@ -2002,15 -2002,10 +2003,18 @@@ struct btrfs_root *open_ctree(struct su init_waitqueue_head(&fs_info->scrub_pause_wait); init_rwsem(&fs_info->scrub_super_lock); fs_info->scrub_workers_refcnt = 0; + #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY + fs_info->check_integrity_print_mask = 0; + #endif + spin_lock_init(&fs_info->balance_lock); + mutex_init(&fs_info->balance_mutex); + atomic_set(&fs_info->balance_running, 0); + atomic_set(&fs_info->balance_pause_req, 0); + atomic_set(&fs_info->balance_cancel_req, 0); + fs_info->balance_ctl = NULL; + init_waitqueue_head(&fs_info->balance_wait_q); + sb->s_blocksize = 4096; sb->s_blocksize_bits = blksize_bits(4096); sb->s_bdi = &fs_info->bdi; diff --cc fs/btrfs/super.c index 5a7227fa9380,22a2015f1d7b..61717a4eb14f --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@@ -164,8 -164,10 +164,10 @@@ enum Opt_compress_type, Opt_compress_force, Opt_compress_force_type, Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, - Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, - Opt_inode_cache, Opt_no_space_cache, Opt_recovery, + Opt_enospc_debug, Opt_subvolrootid, Opt_defrag, Opt_inode_cache, + Opt_no_space_cache, Opt_recovery, Opt_skip_balance, + Opt_check_integrity, Opt_check_integrity_including_extent_data, + Opt_check_integrity_print_mask, Opt_err, }; @@@ -201,7 -203,9 +203,10 @@@ static match_table_t tokens = {Opt_inode_cache, "inode_cache"}, {Opt_no_space_cache, "nospace_cache"}, {Opt_recovery, "recovery"}, + {Opt_skip_balance, "skip_balance"}, + {Opt_check_integrity, "check_int"}, + {Opt_check_integrity_including_extent_data, "check_int_data"}, + {Opt_check_integrity_print_mask, "check_int_print_mask=%d"}, {Opt_err, NULL}, }; @@@ -400,9 -404,37 +405,40 @@@ int btrfs_parse_options(struct btrfs_ro printk(KERN_INFO "btrfs: enabling auto recovery"); btrfs_set_opt(info->mount_opt, RECOVERY); break; + case Opt_skip_balance: + btrfs_set_opt(info->mount_opt, SKIP_BALANCE); + break; + #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY + case Opt_check_integrity_including_extent_data: + printk(KERN_INFO "btrfs: enabling check integrity" + " including extent data\n"); + btrfs_set_opt(info->mount_opt, + CHECK_INTEGRITY_INCLUDING_EXTENT_DATA); + btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY); + break; + case Opt_check_integrity: + printk(KERN_INFO "btrfs: enabling check integrity\n"); + btrfs_set_opt(info->mount_opt, CHECK_INTEGRITY); + break; + case Opt_check_integrity_print_mask: + intarg = 0; + match_int(&args[0], &intarg); + if (intarg) { + info->check_integrity_print_mask = intarg; + printk(KERN_INFO "btrfs:" + " check_integrity_print_mask 0x%x\n", + info->check_integrity_print_mask); + } + break; + #else + case Opt_check_integrity_including_extent_data: + case Opt_check_integrity: + case Opt_check_integrity_print_mask: + printk(KERN_ERR "btrfs: support for check_integrity*" + " not compiled in!\n"); + ret = -EINVAL; + goto out; + #endif case Opt_err: printk(KERN_INFO "btrfs: unrecognized mount option " "'%s'\n", p);