aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorStefan Behrens <sbehrens@giantdisaster.de>2012-11-05 11:32:20 -0500
committerJosef Bacik <jbacik@fusionio.com>2012-12-12 17:15:38 -0500
commita2bff64025d7a707ac49155bb6678a636e55096e (patch)
tree895fcdd2eeaa8a23ad8aeb328c66c2b924337ab0 /fs/btrfs/ctree.h
parente922e087a35c437acef3bc88ce31e59c699c38bd (diff)
Btrfs: introduce a btrfs_dev_replace_item type
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 0781fd4a5c1a..147406d0f9a9 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -921,6 +921,23 @@ struct btrfs_dev_replace {
921 struct btrfs_scrub_progress scrub_progress; 921 struct btrfs_scrub_progress scrub_progress;
922}; 922};
923 923
924struct btrfs_dev_replace_item {
925 /*
926 * grow this item struct at the end for future enhancements and keep
927 * the existing values unchanged
928 */
929 __le64 src_devid;
930 __le64 cursor_left;
931 __le64 cursor_right;
932 __le64 cont_reading_from_srcdev_mode;
933
934 __le64 replace_state;
935 __le64 time_started;
936 __le64 time_stopped;
937 __le64 num_write_errors;
938 __le64 num_uncorrectable_read_errors;
939} __attribute__ ((__packed__));
940
924/* different types of block groups (and chunks) */ 941/* different types of block groups (and chunks) */
925#define BTRFS_BLOCK_GROUP_DATA (1ULL << 0) 942#define BTRFS_BLOCK_GROUP_DATA (1ULL << 0)
926#define BTRFS_BLOCK_GROUP_SYSTEM (1ULL << 1) 943#define BTRFS_BLOCK_GROUP_SYSTEM (1ULL << 1)
@@ -1763,6 +1780,12 @@ struct btrfs_ioctl_defrag_range_args {
1763#define BTRFS_DEV_STATS_KEY 249 1780#define BTRFS_DEV_STATS_KEY 249
1764 1781
1765/* 1782/*
1783 * Persistantly stores the device replace state in the device tree.
1784 * The key is built like this: (0, BTRFS_DEV_REPLACE_KEY, 0).
1785 */
1786#define BTRFS_DEV_REPLACE_KEY 250
1787
1788/*
1766 * string items are for debugging. They just store a short string of 1789 * string items are for debugging. They just store a short string of
1767 * data in the FS 1790 * data in the FS
1768 */ 1791 */
@@ -2795,6 +2818,49 @@ BTRFS_SETGET_FUNCS(qgroup_limit_rsv_rfer, struct btrfs_qgroup_limit_item,
2795BTRFS_SETGET_FUNCS(qgroup_limit_rsv_excl, struct btrfs_qgroup_limit_item, 2818BTRFS_SETGET_FUNCS(qgroup_limit_rsv_excl, struct btrfs_qgroup_limit_item,
2796 rsv_excl, 64); 2819 rsv_excl, 64);
2797 2820
2821/* btrfs_dev_replace_item */
2822BTRFS_SETGET_FUNCS(dev_replace_src_devid,
2823 struct btrfs_dev_replace_item, src_devid, 64);
2824BTRFS_SETGET_FUNCS(dev_replace_cont_reading_from_srcdev_mode,
2825 struct btrfs_dev_replace_item, cont_reading_from_srcdev_mode,
2826 64);
2827BTRFS_SETGET_FUNCS(dev_replace_replace_state, struct btrfs_dev_replace_item,
2828 replace_state, 64);
2829BTRFS_SETGET_FUNCS(dev_replace_time_started, struct btrfs_dev_replace_item,
2830 time_started, 64);
2831BTRFS_SETGET_FUNCS(dev_replace_time_stopped, struct btrfs_dev_replace_item,
2832 time_stopped, 64);
2833BTRFS_SETGET_FUNCS(dev_replace_num_write_errors, struct btrfs_dev_replace_item,
2834 num_write_errors, 64);
2835BTRFS_SETGET_FUNCS(dev_replace_num_uncorrectable_read_errors,
2836 struct btrfs_dev_replace_item, num_uncorrectable_read_errors,
2837 64);
2838BTRFS_SETGET_FUNCS(dev_replace_cursor_left, struct btrfs_dev_replace_item,
2839 cursor_left, 64);
2840BTRFS_SETGET_FUNCS(dev_replace_cursor_right, struct btrfs_dev_replace_item,
2841 cursor_right, 64);
2842
2843BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_src_devid,
2844 struct btrfs_dev_replace_item, src_devid, 64);
2845BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_cont_reading_from_srcdev_mode,
2846 struct btrfs_dev_replace_item,
2847 cont_reading_from_srcdev_mode, 64);
2848BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_replace_state,
2849 struct btrfs_dev_replace_item, replace_state, 64);
2850BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_time_started,
2851 struct btrfs_dev_replace_item, time_started, 64);
2852BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_time_stopped,
2853 struct btrfs_dev_replace_item, time_stopped, 64);
2854BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_num_write_errors,
2855 struct btrfs_dev_replace_item, num_write_errors, 64);
2856BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_num_uncorrectable_read_errors,
2857 struct btrfs_dev_replace_item,
2858 num_uncorrectable_read_errors, 64);
2859BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_cursor_left,
2860 struct btrfs_dev_replace_item, cursor_left, 64);
2861BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_cursor_right,
2862 struct btrfs_dev_replace_item, cursor_right, 64);
2863
2798static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb) 2864static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb)
2799{ 2865{
2800 return sb->s_fs_info; 2866 return sb->s_fs_info;