aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/btrfs/volumes.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r--fs/btrfs/volumes.h43
1 files changed, 36 insertions, 7 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 31b0fabdd2ea..7c12d61ae7ae 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -20,8 +20,11 @@
20#define __BTRFS_VOLUMES_ 20#define __BTRFS_VOLUMES_
21 21
22#include <linux/bio.h> 22#include <linux/bio.h>
23#include <linux/sort.h>
23#include "async-thread.h" 24#include "async-thread.h"
24 25
26#define BTRFS_STRIPE_LEN (64 * 1024)
27
25struct buffer_head; 28struct buffer_head;
26struct btrfs_pending_bios { 29struct btrfs_pending_bios {
27 struct bio *head; 30 struct bio *head;
@@ -42,15 +45,15 @@ struct btrfs_device {
42 int running_pending; 45 int running_pending;
43 u64 generation; 46 u64 generation;
44 47
45 int barriers;
46 int writeable; 48 int writeable;
47 int in_fs_metadata; 49 int in_fs_metadata;
50 int missing;
48 51
49 spinlock_t io_lock; 52 spinlock_t io_lock;
50 53
51 struct block_device *bdev; 54 struct block_device *bdev;
52 55
53 /* the mode sent to open_bdev_exclusive */ 56 /* the mode sent to blkdev_get */
54 fmode_t mode; 57 fmode_t mode;
55 58
56 char *name; 59 char *name;
@@ -82,7 +85,12 @@ struct btrfs_device {
82 /* physical drive uuid (or lvm uuid) */ 85 /* physical drive uuid (or lvm uuid) */
83 u8 uuid[BTRFS_UUID_SIZE]; 86 u8 uuid[BTRFS_UUID_SIZE];
84 87
88 /* per-device scrub information */
89 struct scrub_dev *scrub_device;
90
85 struct btrfs_work work; 91 struct btrfs_work work;
92 struct rcu_head rcu;
93 struct work_struct rcu_work;
86}; 94};
87 95
88struct btrfs_fs_devices { 96struct btrfs_fs_devices {
@@ -94,6 +102,7 @@ struct btrfs_fs_devices {
94 u64 num_devices; 102 u64 num_devices;
95 u64 open_devices; 103 u64 open_devices;
96 u64 rw_devices; 104 u64 rw_devices;
105 u64 missing_devices;
97 u64 total_rw_bytes; 106 u64 total_rw_bytes;
98 struct block_device *latest_bdev; 107 struct block_device *latest_bdev;
99 108
@@ -122,6 +131,7 @@ struct btrfs_fs_devices {
122struct btrfs_bio_stripe { 131struct btrfs_bio_stripe {
123 struct btrfs_device *dev; 132 struct btrfs_device *dev;
124 u64 physical; 133 u64 physical;
134 u64 length; /* only used for discard mappings */
125}; 135};
126 136
127struct btrfs_multi_bio { 137struct btrfs_multi_bio {
@@ -135,6 +145,30 @@ struct btrfs_multi_bio {
135 struct btrfs_bio_stripe stripes[]; 145 struct btrfs_bio_stripe stripes[];
136}; 146};
137 147
148struct btrfs_device_info {
149 struct btrfs_device *dev;
150 u64 dev_offset;
151 u64 max_avail;
152 u64 total_avail;
153};
154
155struct map_lookup {
156 u64 type;
157 int io_align;
158 int io_width;
159 int stripe_len;
160 int sector_size;
161 int num_stripes;
162 int sub_stripes;
163 struct btrfs_bio_stripe stripes[];
164};
165
166#define map_lookup_size(n) (sizeof(struct map_lookup) + \
167 (sizeof(struct btrfs_bio_stripe) * (n)))
168
169int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start,
170 u64 end, u64 *length);
171
138#define btrfs_multi_bio_size(n) (sizeof(struct btrfs_multi_bio) + \ 172#define btrfs_multi_bio_size(n) (sizeof(struct btrfs_multi_bio) + \
139 (sizeof(struct btrfs_bio_stripe) * (n))) 173 (sizeof(struct btrfs_bio_stripe) * (n)))
140 174
@@ -156,7 +190,6 @@ void btrfs_mapping_init(struct btrfs_mapping_tree *tree);
156void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree); 190void btrfs_mapping_tree_free(struct btrfs_mapping_tree *tree);
157int 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,
158 int mirror_num, int async_submit); 192 int mirror_num, int async_submit);
159int btrfs_read_super_device(struct btrfs_root *root, struct extent_buffer *buf);
160int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, 193int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
161 fmode_t flags, void *holder); 194 fmode_t flags, void *holder);
162int 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,
@@ -169,8 +202,6 @@ int btrfs_add_device(struct btrfs_trans_handle *trans,
169int btrfs_rm_device(struct btrfs_root *root, char *device_path); 202int btrfs_rm_device(struct btrfs_root *root, char *device_path);
170int btrfs_cleanup_fs_uuids(void); 203int btrfs_cleanup_fs_uuids(void);
171int 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);
172int btrfs_unplug_page(struct btrfs_mapping_tree *map_tree,
173 u64 logical, struct page *page);
174int btrfs_grow_device(struct btrfs_trans_handle *trans, 205int btrfs_grow_device(struct btrfs_trans_handle *trans,
175 struct btrfs_device *device, u64 new_size); 206 struct btrfs_device *device, u64 new_size);
176struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid, 207struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid,
@@ -178,8 +209,6 @@ struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid,
178int btrfs_shrink_device(struct btrfs_device *device, u64 new_size); 209int btrfs_shrink_device(struct btrfs_device *device, u64 new_size);
179int btrfs_init_new_device(struct btrfs_root *root, char *path); 210int btrfs_init_new_device(struct btrfs_root *root, char *path);
180int btrfs_balance(struct btrfs_root *dev_root); 211int btrfs_balance(struct btrfs_root *dev_root);
181void btrfs_unlock_volumes(void);
182void btrfs_lock_volumes(void);
183int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset); 212int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset);
184int find_free_dev_extent(struct btrfs_trans_handle *trans, 213int find_free_dev_extent(struct btrfs_trans_handle *trans,
185 struct btrfs_device *device, u64 num_bytes, 214 struct btrfs_device *device, u64 num_bytes,