aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r--fs/btrfs/volumes.h25
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
151struct map_lookup { 155struct 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) + \
163int 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 */
169static 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
177int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start, 169int 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);
198void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree); 190void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree);
199int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio, 191int 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);
201int btrfs_read_super_device(struct btrfs_root *root, struct extent_buffer *buf);
202int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, 193int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
203 fmode_t flags, void *holder); 194 fmode_t flags, void *holder);
204int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, 195int 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,
211int btrfs_rm_device(struct btrfs_root *root, char *device_path); 202int btrfs_rm_device(struct btrfs_root *root, char *device_path);
212int btrfs_cleanup_fs_uuids(void); 203int btrfs_cleanup_fs_uuids(void);
213int btrfs_num_copies(struct btrfs_mapping_tree *map_tree, u64 logical, u64 len); 204int btrfs_num_copies(struct btrfs_mapping_tree *map_tree, u64 logical, u64 len);
214int btrfs_unplug_page(struct btrfs_mapping_tree *map_tree,
215 u64 logical, struct page *page);
216int btrfs_grow_device(struct btrfs_trans_handle *trans, 205int btrfs_grow_device(struct btrfs_trans_handle *trans,
217 struct btrfs_device *device, u64 new_size); 206 struct btrfs_device *device, u64 new_size);
218struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid, 207struct 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,
220int btrfs_shrink_device(struct btrfs_device *device, u64 new_size); 209int btrfs_shrink_device(struct btrfs_device *device, u64 new_size);
221int btrfs_init_new_device(struct btrfs_root *root, char *path); 210int btrfs_init_new_device(struct btrfs_root *root, char *path);
222int btrfs_balance(struct btrfs_root *dev_root); 211int btrfs_balance(struct btrfs_root *dev_root);
223void btrfs_unlock_volumes(void);
224void btrfs_lock_volumes(void);
225int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); 212int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset);
226int find_free_dev_extent(struct btrfs_trans_handle *trans, 213int 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,