mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
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>
This commit is contained in:
parent
e922e087a3
commit
a2bff64025
@ -921,6 +921,23 @@ struct btrfs_dev_replace {
|
||||
struct btrfs_scrub_progress scrub_progress;
|
||||
};
|
||||
|
||||
struct btrfs_dev_replace_item {
|
||||
/*
|
||||
* grow this item struct at the end for future enhancements and keep
|
||||
* the existing values unchanged
|
||||
*/
|
||||
__le64 src_devid;
|
||||
__le64 cursor_left;
|
||||
__le64 cursor_right;
|
||||
__le64 cont_reading_from_srcdev_mode;
|
||||
|
||||
__le64 replace_state;
|
||||
__le64 time_started;
|
||||
__le64 time_stopped;
|
||||
__le64 num_write_errors;
|
||||
__le64 num_uncorrectable_read_errors;
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
/* different types of block groups (and chunks) */
|
||||
#define BTRFS_BLOCK_GROUP_DATA (1ULL << 0)
|
||||
#define BTRFS_BLOCK_GROUP_SYSTEM (1ULL << 1)
|
||||
@ -1762,6 +1779,12 @@ struct btrfs_ioctl_defrag_range_args {
|
||||
*/
|
||||
#define BTRFS_DEV_STATS_KEY 249
|
||||
|
||||
/*
|
||||
* Persistantly stores the device replace state in the device tree.
|
||||
* The key is built like this: (0, BTRFS_DEV_REPLACE_KEY, 0).
|
||||
*/
|
||||
#define BTRFS_DEV_REPLACE_KEY 250
|
||||
|
||||
/*
|
||||
* string items are for debugging. They just store a short string of
|
||||
* data in the FS
|
||||
@ -2795,6 +2818,49 @@ BTRFS_SETGET_FUNCS(qgroup_limit_rsv_rfer, struct btrfs_qgroup_limit_item,
|
||||
BTRFS_SETGET_FUNCS(qgroup_limit_rsv_excl, struct btrfs_qgroup_limit_item,
|
||||
rsv_excl, 64);
|
||||
|
||||
/* btrfs_dev_replace_item */
|
||||
BTRFS_SETGET_FUNCS(dev_replace_src_devid,
|
||||
struct btrfs_dev_replace_item, src_devid, 64);
|
||||
BTRFS_SETGET_FUNCS(dev_replace_cont_reading_from_srcdev_mode,
|
||||
struct btrfs_dev_replace_item, cont_reading_from_srcdev_mode,
|
||||
64);
|
||||
BTRFS_SETGET_FUNCS(dev_replace_replace_state, struct btrfs_dev_replace_item,
|
||||
replace_state, 64);
|
||||
BTRFS_SETGET_FUNCS(dev_replace_time_started, struct btrfs_dev_replace_item,
|
||||
time_started, 64);
|
||||
BTRFS_SETGET_FUNCS(dev_replace_time_stopped, struct btrfs_dev_replace_item,
|
||||
time_stopped, 64);
|
||||
BTRFS_SETGET_FUNCS(dev_replace_num_write_errors, struct btrfs_dev_replace_item,
|
||||
num_write_errors, 64);
|
||||
BTRFS_SETGET_FUNCS(dev_replace_num_uncorrectable_read_errors,
|
||||
struct btrfs_dev_replace_item, num_uncorrectable_read_errors,
|
||||
64);
|
||||
BTRFS_SETGET_FUNCS(dev_replace_cursor_left, struct btrfs_dev_replace_item,
|
||||
cursor_left, 64);
|
||||
BTRFS_SETGET_FUNCS(dev_replace_cursor_right, struct btrfs_dev_replace_item,
|
||||
cursor_right, 64);
|
||||
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_src_devid,
|
||||
struct btrfs_dev_replace_item, src_devid, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_cont_reading_from_srcdev_mode,
|
||||
struct btrfs_dev_replace_item,
|
||||
cont_reading_from_srcdev_mode, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_replace_state,
|
||||
struct btrfs_dev_replace_item, replace_state, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_time_started,
|
||||
struct btrfs_dev_replace_item, time_started, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_time_stopped,
|
||||
struct btrfs_dev_replace_item, time_stopped, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_num_write_errors,
|
||||
struct btrfs_dev_replace_item, num_write_errors, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_num_uncorrectable_read_errors,
|
||||
struct btrfs_dev_replace_item,
|
||||
num_uncorrectable_read_errors, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_cursor_left,
|
||||
struct btrfs_dev_replace_item, cursor_left, 64);
|
||||
BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_cursor_right,
|
||||
struct btrfs_dev_replace_item, cursor_right, 64);
|
||||
|
||||
static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb)
|
||||
{
|
||||
return sb->s_fs_info;
|
||||
|
@ -297,6 +297,9 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
|
||||
case BTRFS_DEV_STATS_KEY:
|
||||
printk(KERN_INFO "\t\tdevice stats\n");
|
||||
break;
|
||||
case BTRFS_DEV_REPLACE_KEY:
|
||||
printk(KERN_INFO "\t\tdev replace\n");
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user