diff options
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r-- | fs/btrfs/volumes.h | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index f1b2e4f53fc2..7c12d61ae7ae 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h | |||
@@ -85,6 +85,9 @@ 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; |
89 | struct rcu_head rcu; | 92 | struct rcu_head rcu; |
90 | struct work_struct rcu_work; | 93 | struct work_struct rcu_work; |
@@ -146,6 +149,7 @@ struct btrfs_device_info { | |||
146 | struct btrfs_device *dev; | 149 | struct btrfs_device *dev; |
147 | u64 dev_offset; | 150 | u64 dev_offset; |
148 | u64 max_avail; | 151 | u64 max_avail; |
152 | u64 total_avail; | ||
149 | }; | 153 | }; |
150 | 154 | ||
151 | struct map_lookup { | 155 | struct map_lookup { |
@@ -159,20 +163,8 @@ struct map_lookup { | |||
159 | struct btrfs_bio_stripe stripes[]; | 163 | struct btrfs_bio_stripe stripes[]; |
160 | }; | 164 | }; |
161 | 165 | ||
162 | /* Used to sort the devices by max_avail(descending sort) */ | 166 | #define map_lookup_size(n) (sizeof(struct map_lookup) + \ |
163 | int btrfs_cmp_device_free_bytes(const void *dev_info1, const void *dev_info2); | 167 | (sizeof(struct btrfs_bio_stripe) * (n))) |
164 | |||
165 | /* | ||
166 | * sort the devices by max_avail, in which max free extent size of each device | ||
167 | * is stored.(Descending Sort) | ||
168 | */ | ||
169 | static inline void btrfs_descending_sort_devices( | ||
170 | struct btrfs_device_info *devices, | ||
171 | size_t nr_devices) | ||
172 | { | ||
173 | sort(devices, nr_devices, sizeof(struct btrfs_device_info), | ||
174 | btrfs_cmp_device_free_bytes, NULL); | ||
175 | } | ||
176 | 168 | ||
177 | 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, |
178 | u64 end, u64 *length); | 170 | u64 end, u64 *length); |
@@ -198,7 +190,6 @@ void btrfs_mapping_init(struct btrfs_mapping_tree *tree); | |||
198 | void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree); | 190 | void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree); |
199 | 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, |
200 | int mirror_num, int async_submit); | 192 | int mirror_num, int async_submit); |
201 | int btrfs_read_super_device(struct btrfs_root *root, struct extent_buffer *buf); | ||
202 | int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, | 193 | int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, |
203 | fmode_t flags, void *holder); | 194 | fmode_t flags, void *holder); |
204 | 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, |
@@ -211,8 +202,6 @@ int btrfs_add_device(struct btrfs_trans_handle *trans, | |||
211 | int btrfs_rm_device(struct btrfs_root *root, char *device_path); | 202 | int btrfs_rm_device(struct btrfs_root *root, char *device_path); |
212 | int btrfs_cleanup_fs_uuids(void); | 203 | int btrfs_cleanup_fs_uuids(void); |
213 | 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); |
214 | int btrfs_unplug_page(struct btrfs_mapping_tree *map_tree, | ||
215 | u64 logical, struct page *page); | ||
216 | int btrfs_grow_device(struct btrfs_trans_handle *trans, | 205 | int btrfs_grow_device(struct btrfs_trans_handle *trans, |
217 | struct btrfs_device *device, u64 new_size); | 206 | struct btrfs_device *device, u64 new_size); |
218 | 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, |
@@ -220,8 +209,6 @@ struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid, | |||
220 | int btrfs_shrink_device(struct btrfs_device *device, u64 new_size); | 209 | int btrfs_shrink_device(struct btrfs_device *device, u64 new_size); |
221 | int btrfs_init_new_device(struct btrfs_root *root, char *path); | 210 | int btrfs_init_new_device(struct btrfs_root *root, char *path); |
222 | int btrfs_balance(struct btrfs_root *dev_root); | 211 | int btrfs_balance(struct btrfs_root *dev_root); |
223 | void btrfs_unlock_volumes(void); | ||
224 | void btrfs_lock_volumes(void); | ||
225 | int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); | 212 | int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); |
226 | int find_free_dev_extent(struct btrfs_trans_handle *trans, | 213 | int find_free_dev_extent(struct btrfs_trans_handle *trans, |
227 | struct btrfs_device *device, u64 num_bytes, | 214 | struct btrfs_device *device, u64 num_bytes, |