diff options
Diffstat (limited to 'fs/exofs/exofs.h')
-rw-r--r-- | fs/exofs/exofs.h | 159 |
1 files changed, 40 insertions, 119 deletions
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h index c965806c2821..f4e442ec7445 100644 --- a/fs/exofs/exofs.h +++ b/fs/exofs/exofs.h | |||
@@ -36,12 +36,9 @@ | |||
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/time.h> | 37 | #include <linux/time.h> |
38 | #include <linux/backing-dev.h> | 38 | #include <linux/backing-dev.h> |
39 | #include "common.h" | 39 | #include <scsi/osd_ore.h> |
40 | 40 | ||
41 | /* FIXME: Remove once pnfs hits mainline | 41 | #include "common.h" |
42 | * #include <linux/exportfs/pnfs_osd_xdr.h> | ||
43 | */ | ||
44 | #include "pnfs.h" | ||
45 | 42 | ||
46 | #define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a) | 43 | #define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a) |
47 | 44 | ||
@@ -56,27 +53,11 @@ | |||
56 | /* u64 has problems with printk this will cast it to unsigned long long */ | 53 | /* u64 has problems with printk this will cast it to unsigned long long */ |
57 | #define _LLU(x) (unsigned long long)(x) | 54 | #define _LLU(x) (unsigned long long)(x) |
58 | 55 | ||
59 | struct exofs_layout { | ||
60 | osd_id s_pid; /* partition ID of file system*/ | ||
61 | |||
62 | /* Our way of looking at the data_map */ | ||
63 | unsigned stripe_unit; | ||
64 | unsigned mirrors_p1; | ||
65 | |||
66 | unsigned group_width; | ||
67 | u64 group_depth; | ||
68 | unsigned group_count; | ||
69 | |||
70 | enum exofs_inode_layout_gen_functions lay_func; | ||
71 | |||
72 | unsigned s_numdevs; /* Num of devices in array */ | ||
73 | struct osd_dev *s_ods[0]; /* Variable length */ | ||
74 | }; | ||
75 | |||
76 | /* | 56 | /* |
77 | * our extension to the in-memory superblock | 57 | * our extension to the in-memory superblock |
78 | */ | 58 | */ |
79 | struct exofs_sb_info { | 59 | struct exofs_sb_info { |
60 | struct backing_dev_info bdi; /* register our bdi with VFS */ | ||
80 | struct exofs_sb_stats s_ess; /* Written often, pre-allocate*/ | 61 | struct exofs_sb_stats s_ess; /* Written often, pre-allocate*/ |
81 | int s_timeout; /* timeout for OSD operations */ | 62 | int s_timeout; /* timeout for OSD operations */ |
82 | uint64_t s_nextid; /* highest object ID used */ | 63 | uint64_t s_nextid; /* highest object ID used */ |
@@ -84,16 +65,13 @@ struct exofs_sb_info { | |||
84 | spinlock_t s_next_gen_lock; /* spinlock for gen # update */ | 65 | spinlock_t s_next_gen_lock; /* spinlock for gen # update */ |
85 | u32 s_next_generation; /* next gen # to use */ | 66 | u32 s_next_generation; /* next gen # to use */ |
86 | atomic_t s_curr_pending; /* number of pending commands */ | 67 | atomic_t s_curr_pending; /* number of pending commands */ |
87 | uint8_t s_cred[OSD_CAP_LEN]; /* credential for the fscb */ | ||
88 | struct backing_dev_info bdi; /* register our bdi with VFS */ | ||
89 | 68 | ||
90 | struct pnfs_osd_data_map data_map; /* Default raid to use | 69 | struct pnfs_osd_data_map data_map; /* Default raid to use |
91 | * FIXME: Needed ? | 70 | * FIXME: Needed ? |
92 | */ | 71 | */ |
93 | /* struct exofs_layout dir_layout;*/ /* Default dir layout */ | 72 | struct ore_layout layout; /* Default files layout */ |
94 | struct exofs_layout layout; /* Default files layout, | 73 | struct ore_comp one_comp; /* id & cred of partition id=0*/ |
95 | * contains the variable osd_dev | 74 | struct ore_components comps; /* comps for the partition */ |
96 | * array. Keep last */ | ||
97 | struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */ | 75 | struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */ |
98 | }; | 76 | }; |
99 | 77 | ||
@@ -107,7 +85,8 @@ struct exofs_i_info { | |||
107 | uint32_t i_data[EXOFS_IDATA];/*short symlink names and device #s*/ | 85 | uint32_t i_data[EXOFS_IDATA];/*short symlink names and device #s*/ |
108 | uint32_t i_dir_start_lookup; /* which page to start lookup */ | 86 | uint32_t i_dir_start_lookup; /* which page to start lookup */ |
109 | uint64_t i_commit_size; /* the object's written length */ | 87 | uint64_t i_commit_size; /* the object's written length */ |
110 | uint8_t i_cred[OSD_CAP_LEN];/* all-powerful credential */ | 88 | struct ore_comp one_comp; /* same component for all devices */ |
89 | struct ore_components comps; /* inode view of the device table */ | ||
111 | }; | 90 | }; |
112 | 91 | ||
113 | static inline osd_id exofs_oi_objno(struct exofs_i_info *oi) | 92 | static inline osd_id exofs_oi_objno(struct exofs_i_info *oi) |
@@ -115,52 +94,6 @@ static inline osd_id exofs_oi_objno(struct exofs_i_info *oi) | |||
115 | return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF; | 94 | return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF; |
116 | } | 95 | } |
117 | 96 | ||
118 | struct exofs_io_state; | ||
119 | typedef void (*exofs_io_done_fn)(struct exofs_io_state *or, void *private); | ||
120 | |||
121 | struct exofs_io_state { | ||
122 | struct kref kref; | ||
123 | |||
124 | void *private; | ||
125 | exofs_io_done_fn done; | ||
126 | |||
127 | struct exofs_layout *layout; | ||
128 | struct osd_obj_id obj; | ||
129 | u8 *cred; | ||
130 | |||
131 | /* Global read/write IO*/ | ||
132 | loff_t offset; | ||
133 | unsigned long length; | ||
134 | void *kern_buff; | ||
135 | |||
136 | struct page **pages; | ||
137 | unsigned nr_pages; | ||
138 | unsigned pgbase; | ||
139 | unsigned pages_consumed; | ||
140 | |||
141 | /* Attributes */ | ||
142 | unsigned in_attr_len; | ||
143 | struct osd_attr *in_attr; | ||
144 | unsigned out_attr_len; | ||
145 | struct osd_attr *out_attr; | ||
146 | |||
147 | /* Variable array of size numdevs */ | ||
148 | unsigned numdevs; | ||
149 | struct exofs_per_dev_state { | ||
150 | struct osd_request *or; | ||
151 | struct bio *bio; | ||
152 | loff_t offset; | ||
153 | unsigned length; | ||
154 | unsigned dev; | ||
155 | } per_dev[]; | ||
156 | }; | ||
157 | |||
158 | static inline unsigned exofs_io_state_size(unsigned numdevs) | ||
159 | { | ||
160 | return sizeof(struct exofs_io_state) + | ||
161 | sizeof(struct exofs_per_dev_state) * numdevs; | ||
162 | } | ||
163 | |||
164 | /* | 97 | /* |
165 | * our inode flags | 98 | * our inode flags |
166 | */ | 99 | */ |
@@ -205,12 +138,6 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode) | |||
205 | } | 138 | } |
206 | 139 | ||
207 | /* | 140 | /* |
208 | * Given a layout, object_number and stripe_index return the associated global | ||
209 | * dev_index | ||
210 | */ | ||
211 | unsigned exofs_layout_od_id(struct exofs_layout *layout, | ||
212 | osd_id obj_no, unsigned layout_index); | ||
213 | /* | ||
214 | * Maximum count of links to a file | 141 | * Maximum count of links to a file |
215 | */ | 142 | */ |
216 | #define EXOFS_LINK_MAX 32000 | 143 | #define EXOFS_LINK_MAX 32000 |
@@ -219,44 +146,8 @@ unsigned exofs_layout_od_id(struct exofs_layout *layout, | |||
219 | * function declarations * | 146 | * function declarations * |
220 | *************************/ | 147 | *************************/ |
221 | 148 | ||
222 | /* ios.c */ | ||
223 | void exofs_make_credential(u8 cred_a[OSD_CAP_LEN], | ||
224 | const struct osd_obj_id *obj); | ||
225 | int exofs_read_kern(struct osd_dev *od, u8 *cred, struct osd_obj_id *obj, | ||
226 | u64 offset, void *p, unsigned length); | ||
227 | |||
228 | int exofs_get_io_state(struct exofs_layout *layout, | ||
229 | struct exofs_io_state **ios); | ||
230 | void exofs_put_io_state(struct exofs_io_state *ios); | ||
231 | |||
232 | int exofs_check_io(struct exofs_io_state *ios, u64 *resid); | ||
233 | |||
234 | int exofs_sbi_create(struct exofs_io_state *ios); | ||
235 | int exofs_sbi_remove(struct exofs_io_state *ios); | ||
236 | int exofs_sbi_write(struct exofs_io_state *ios); | ||
237 | int exofs_sbi_read(struct exofs_io_state *ios); | ||
238 | |||
239 | int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr); | ||
240 | |||
241 | int exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len); | ||
242 | static inline int exofs_oi_write(struct exofs_i_info *oi, | ||
243 | struct exofs_io_state *ios) | ||
244 | { | ||
245 | ios->obj.id = exofs_oi_objno(oi); | ||
246 | ios->cred = oi->i_cred; | ||
247 | return exofs_sbi_write(ios); | ||
248 | } | ||
249 | |||
250 | static inline int exofs_oi_read(struct exofs_i_info *oi, | ||
251 | struct exofs_io_state *ios) | ||
252 | { | ||
253 | ios->obj.id = exofs_oi_objno(oi); | ||
254 | ios->cred = oi->i_cred; | ||
255 | return exofs_sbi_read(ios); | ||
256 | } | ||
257 | |||
258 | /* inode.c */ | 149 | /* inode.c */ |
259 | unsigned exofs_max_io_pages(struct exofs_layout *layout, | 150 | unsigned exofs_max_io_pages(struct ore_layout *layout, |
260 | unsigned expected_pages); | 151 | unsigned expected_pages); |
261 | int exofs_setattr(struct dentry *, struct iattr *); | 152 | int exofs_setattr(struct dentry *, struct iattr *); |
262 | int exofs_write_begin(struct file *file, struct address_space *mapping, | 153 | int exofs_write_begin(struct file *file, struct address_space *mapping, |
@@ -281,6 +172,8 @@ int exofs_set_link(struct inode *, struct exofs_dir_entry *, struct page *, | |||
281 | struct inode *); | 172 | struct inode *); |
282 | 173 | ||
283 | /* super.c */ | 174 | /* super.c */ |
175 | void exofs_make_credential(u8 cred_a[OSD_CAP_LEN], | ||
176 | const struct osd_obj_id *obj); | ||
284 | int exofs_sbi_write_stats(struct exofs_sb_info *sbi); | 177 | int exofs_sbi_write_stats(struct exofs_sb_info *sbi); |
285 | 178 | ||
286 | /********************* | 179 | /********************* |
@@ -295,7 +188,6 @@ extern const struct file_operations exofs_file_operations; | |||
295 | 188 | ||
296 | /* inode.c */ | 189 | /* inode.c */ |
297 | extern const struct address_space_operations exofs_aops; | 190 | extern const struct address_space_operations exofs_aops; |
298 | extern const struct osd_attr g_attr_logical_length; | ||
299 | 191 | ||
300 | /* namei.c */ | 192 | /* namei.c */ |
301 | extern const struct inode_operations exofs_dir_inode_operations; | 193 | extern const struct inode_operations exofs_dir_inode_operations; |
@@ -305,4 +197,33 @@ extern const struct inode_operations exofs_special_inode_operations; | |||
305 | extern const struct inode_operations exofs_symlink_inode_operations; | 197 | extern const struct inode_operations exofs_symlink_inode_operations; |
306 | extern const struct inode_operations exofs_fast_symlink_inode_operations; | 198 | extern const struct inode_operations exofs_fast_symlink_inode_operations; |
307 | 199 | ||
200 | /* exofs_init_comps will initialize an ore_components device array | ||
201 | * pointing to a single ore_comp struct, and a round-robin view | ||
202 | * of the device table. | ||
203 | * The first device of each inode is the [inode->ino % num_devices] | ||
204 | * and the rest of the devices sequentially following where the | ||
205 | * first device is after the last device. | ||
206 | * It is assumed that the global device array at @sbi is twice | ||
207 | * bigger and that the device table repeats twice. | ||
208 | * See: exofs_read_lookup_dev_table() | ||
209 | */ | ||
210 | static inline void exofs_init_comps(struct ore_components *comps, | ||
211 | struct ore_comp *one_comp, | ||
212 | struct exofs_sb_info *sbi, osd_id oid) | ||
213 | { | ||
214 | unsigned dev_mod = (unsigned)oid, first_dev; | ||
215 | |||
216 | one_comp->obj.partition = sbi->one_comp.obj.partition; | ||
217 | one_comp->obj.id = oid; | ||
218 | exofs_make_credential(one_comp->cred, &one_comp->obj); | ||
219 | |||
220 | comps->numdevs = sbi->comps.numdevs; | ||
221 | comps->single_comp = EC_SINGLE_COMP; | ||
222 | comps->comps = one_comp; | ||
223 | |||
224 | /* Round robin device view of the table */ | ||
225 | first_dev = (dev_mod * sbi->layout.mirrors_p1) % sbi->comps.numdevs; | ||
226 | comps->ods = sbi->comps.ods + first_dev; | ||
227 | } | ||
228 | |||
308 | #endif | 229 | #endif |