diff options
| author | Stefan Behrens <sbehrens@giantdisaster.de> | 2012-11-05 17:32:20 +0100 | 
|---|---|---|
| committer | Josef Bacik <jbacik@fusionio.com> | 2012-12-12 17:15:38 -0500 | 
| commit | a2bff64025d7a707ac49155bb6678a636e55096e (patch) | |
| tree | 895fcdd2eeaa8a23ad8aeb328c66c2b924337ab0 | |
| parent | e922e087a35c437acef3bc88ce31e59c699c38bd (diff) | |
| download | olio-linux-3.10-a2bff64025d7a707ac49155bb6678a636e55096e.tar.xz olio-linux-3.10-a2bff64025d7a707ac49155bb6678a636e55096e.zip  | |
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>
| -rw-r--r-- | fs/btrfs/ctree.h | 66 | ||||
| -rw-r--r-- | fs/btrfs/print-tree.c | 3 | 
2 files changed, 69 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0781fd4a5c1..147406d0f9a 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -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) @@ -1763,6 +1780,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; diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index 5e23684887e..50d95fd190a 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c @@ -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;  		};  	}  }  |