diff options
author | Jeff Mahoney <jeffm@suse.com> | 2011-10-03 23:22:31 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2012-03-21 20:45:29 -0400 |
commit | 8c3429300181be44b30f9f017d53dc717da56caa (patch) | |
tree | 76d2b3155bfff43ac4c96df7d6ccb723849c6e9f /fs/btrfs/ctree.h | |
parent | c16fa4f2ad19908a47c63d8fa436a1178438c7e7 (diff) |
btrfs: Add btrfs_panic()
As part of the effort to eliminate BUG_ON as an error handling
technique, we need to determine which errors are actual logic errors,
which are on-disk corruption, and which are normal runtime errors
e.g. -ENOMEM.
Annotating these error cases is helpful to understand and report them.
This patch adds a btrfs_panic() routine that will either panic
or BUG depending on the new -ofatal_errors={panic,bug} mount option.
Since there are still so many BUG_ONs, it defaults to BUG for now but I
expect that to change once the error handling effort has made
significant progress.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 80b6486fd5e6..a97a67089755 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1503,6 +1503,7 @@ struct btrfs_ioctl_defrag_range_args { | |||
1503 | #define BTRFS_MOUNT_SKIP_BALANCE (1 << 19) | 1503 | #define BTRFS_MOUNT_SKIP_BALANCE (1 << 19) |
1504 | #define BTRFS_MOUNT_CHECK_INTEGRITY (1 << 20) | 1504 | #define BTRFS_MOUNT_CHECK_INTEGRITY (1 << 20) |
1505 | #define BTRFS_MOUNT_CHECK_INTEGRITY_INCLUDING_EXTENT_DATA (1 << 21) | 1505 | #define BTRFS_MOUNT_CHECK_INTEGRITY_INCLUDING_EXTENT_DATA (1 << 21) |
1506 | #define BTRFS_MOUNT_PANIC_ON_FATAL_ERROR (1 << 22) | ||
1506 | 1507 | ||
1507 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) | 1508 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) |
1508 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) | 1509 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) |
@@ -2970,6 +2971,16 @@ do { \ | |||
2970 | __btrfs_std_error((fs_info), __func__, __LINE__, (errno));\ | 2971 | __btrfs_std_error((fs_info), __func__, __LINE__, (errno));\ |
2971 | } while (0) | 2972 | } while (0) |
2972 | 2973 | ||
2974 | void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, | ||
2975 | unsigned int line, int errno, const char *fmt, ...); | ||
2976 | |||
2977 | #define btrfs_panic(fs_info, errno, fmt, args...) \ | ||
2978 | do { \ | ||
2979 | struct btrfs_fs_info *_i = (fs_info); \ | ||
2980 | __btrfs_panic(_i, __func__, __LINE__, errno, fmt, ##args); \ | ||
2981 | BUG_ON(!(_i->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)); \ | ||
2982 | } while (0) | ||
2983 | |||
2973 | /* acl.c */ | 2984 | /* acl.c */ |
2974 | #ifdef CONFIG_BTRFS_FS_POSIX_ACL | 2985 | #ifdef CONFIG_BTRFS_FS_POSIX_ACL |
2975 | struct posix_acl *btrfs_get_acl(struct inode *inode, int type); | 2986 | struct posix_acl *btrfs_get_acl(struct inode *inode, int type); |