diff options
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r-- | fs/btrfs/volumes.h | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index cc2eadaf7a27..7c12d61ae7ae 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h | |||
@@ -85,7 +85,12 @@ struct btrfs_device { | |||
85 | /* physical drive uuid (or lvm uuid) */ | 85 | /* physical drive uuid (or lvm uuid) */ |
86 | u8 uuid[BTRFS_UUID_SIZE]; | 86 | u8 uuid[BTRFS_UUID_SIZE]; |
87 | 87 | ||
88 | /* per-device scrub information */ | ||
89 | struct scrub_dev *scrub_device; | ||
90 | |||
88 | struct btrfs_work work; | 91 | struct btrfs_work work; |
92 | struct rcu_head rcu; | ||
93 | struct work_struct rcu_work; | ||
89 | }; | 94 | }; |
90 | 95 | ||
91 | struct btrfs_fs_devices { | 96 | struct btrfs_fs_devices { |
@@ -144,6 +149,7 @@ struct btrfs_device_info { | |||
144 | struct btrfs_device *dev; | 149 | struct btrfs_device *dev; |
145 | u64 dev_offset; | 150 | u64 dev_offset; |
146 | u64 max_avail; | 151 | u64 max_avail; |
152 | u64 total_avail; | ||
147 | }; | 153 | }; |
148 | 154 | ||
149 | struct map_lookup { | 155 | struct map_lookup { |
@@ -157,20 +163,8 @@ struct map_lookup { | |||
157 | struct btrfs_bio_stripe stripes[]; | 163 | struct btrfs_bio_stripe stripes[]; |
158 | }; | 164 | }; |
159 | 165 | ||
160 | /* Used to sort the devices by max_avail(descending sort) */ | 166 | #define map_lookup_size(n) (sizeof(struct map_lookup) + \ |
161 | int btrfs_cmp_device_free_bytes(const void *dev_info1, const void *dev_info2); | 167 | (sizeof(struct btrfs_bio_stripe) * (n))) |
162 | |||
163 | /* | ||
164 | * sort the devices by max_avail, in which max free extent size of each device | ||
165 | * is stored.(Descending Sort) | ||
166 | */ | ||
167 | static inline void btrfs_descending_sort_devices( | ||
168 | struct btrfs_device_info *devices, | ||
169 | size_t nr_devices) | ||
170 | { | ||
171 | sort(devices, nr_devices, sizeof(struct btrfs_device_info), | ||
172 | btrfs_cmp_device_free_bytes, NULL); | ||
173 | } | ||
174 | 168 | ||
175 | int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start, | 169 | int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start, |
176 | u64 end, u64 *length); | 170 | u64 end, u64 *length); |
@@ -196,7 +190,6 @@ void btrfs_mapping_init(struct btrfs_mapping_tree *tree); | |||
196 | void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree); | 190 | void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree); |
197 | int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio, | 191 | int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio, |
198 | int mirror_num, int async_submit); | 192 | int mirror_num, int async_submit); |
199 | int btrfs_read_super_device(struct btrfs_root *root, struct extent_buffer *buf); | ||
200 | int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, | 193 | int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, |
201 | fmode_t flags, void *holder); | 194 | fmode_t flags, void *holder); |
202 | int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, | 195 | int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, |
@@ -209,8 +202,6 @@ int btrfs_add_device(struct btrfs_trans_handle *trans, | |||
209 | int btrfs_rm_device(struct btrfs_root *root, char *device_path); | 202 | int btrfs_rm_device(struct btrfs_root *root, char *device_path); |
210 | int btrfs_cleanup_fs_uuids(void); | 203 | int btrfs_cleanup_fs_uuids(void); |
211 | int btrfs_num_copies(struct btrfs_mapping_tree *map_tree, u64 logical, u64 len); | 204 | int btrfs_num_copies(struct btrfs_mapping_tree *map_tree, u64 logical, u64 len); |
212 | int btrfs_unplug_page(struct btrfs_mapping_tree *map_tree, | ||
213 | u64 logical, struct page *page); | ||
214 | int btrfs_grow_device(struct btrfs_trans_handle *trans, | 205 | int btrfs_grow_device(struct btrfs_trans_handle *trans, |
215 | struct btrfs_device *device, u64 new_size); | 206 | struct btrfs_device *device, u64 new_size); |
216 | struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid, | 207 | struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid, |
@@ -218,8 +209,6 @@ struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid, | |||
218 | int btrfs_shrink_device(struct btrfs_device *device, u64 new_size); | 209 | int btrfs_shrink_device(struct btrfs_device *device, u64 new_size); |
219 | int btrfs_init_new_device(struct btrfs_root *root, char *path); | 210 | int btrfs_init_new_device(struct btrfs_root *root, char *path); |
220 | int btrfs_balance(struct btrfs_root *dev_root); | 211 | int btrfs_balance(struct btrfs_root *dev_root); |
221 | void btrfs_unlock_volumes(void); | ||
222 | void btrfs_lock_volumes(void); | ||
223 | int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); | 212 | int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); |
224 | int find_free_dev_extent(struct btrfs_trans_handle *trans, | 213 | int find_free_dev_extent(struct btrfs_trans_handle *trans, |
225 | struct btrfs_device *device, u64 num_bytes, | 214 | struct btrfs_device *device, u64 num_bytes, |