36
36
#include <linux/fs.h>
37
37
#include <linux/time.h>
38
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
42
- * #include <linux/exportfs/pnfs_osd_xdr.h>
43
- */
44
- #include "pnfs.h"
41
+ #include "common.h"
45
42
46
43
#define EXOFS_ERR (fmt , a ...) printk(KERN_ERR "exofs: " fmt, ##a)
47
44
56
53
/* u64 has problems with printk this will cast it to unsigned long long */
57
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
57
* our extension to the in-memory superblock
78
58
*/
79
59
struct exofs_sb_info {
60
+ struct backing_dev_info bdi ; /* register our bdi with VFS */
80
61
struct exofs_sb_stats s_ess ; /* Written often, pre-allocate*/
81
62
int s_timeout ; /* timeout for OSD operations */
82
63
uint64_t s_nextid ; /* highest object ID used */
83
64
uint32_t s_numfiles ; /* number of files on fs */
84
65
spinlock_t s_next_gen_lock ; /* spinlock for gen # update */
85
66
u32 s_next_generation ; /* next gen # to use */
86
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
69
struct pnfs_osd_data_map data_map ; /* Default raid to use
91
70
* FIXME: Needed ?
92
71
*/
93
- /* struct exofs_layout dir_layout;*/ /* Default dir layout */
94
- struct exofs_layout layout ; /* Default files layout,
95
- * contains the variable osd_dev
96
- * array. Keep last */
72
+ struct ore_layout layout ; /* Default files layout */
73
+ struct ore_comp one_comp ; /* id & cred of partition id=0*/
74
+ struct ore_components comps ; /* comps for the partition */
97
75
struct osd_dev * _min_one_dev [1 ]; /* Place holder for one dev */
98
76
};
99
77
@@ -107,60 +85,15 @@ struct exofs_i_info {
107
85
uint32_t i_data [EXOFS_IDATA ];/*short symlink names and device #s*/
108
86
uint32_t i_dir_start_lookup ; /* which page to start lookup */
109
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
92
static inline osd_id exofs_oi_objno (struct exofs_i_info * oi )
114
93
{
115
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
98
* our inode flags
166
99
*/
@@ -204,12 +137,6 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode)
204
137
return container_of (inode , struct exofs_i_info , vfs_inode );
205
138
}
206
139
207
- /*
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
140
/*
214
141
* Maximum count of links to a file
215
142
*/
@@ -219,44 +146,8 @@ unsigned exofs_layout_od_id(struct exofs_layout *layout,
219
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
149
/* inode.c */
259
- unsigned exofs_max_io_pages (struct exofs_layout * layout ,
150
+ unsigned exofs_max_io_pages (struct ore_layout * layout ,
260
151
unsigned expected_pages );
261
152
int exofs_setattr (struct dentry * , struct iattr * );
262
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
172
struct inode * );
282
173
283
174
/* super.c */
175
+ void exofs_make_credential (u8 cred_a [OSD_CAP_LEN ],
176
+ const struct osd_obj_id * obj );
284
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
189
/* inode.c */
297
190
extern const struct address_space_operations exofs_aops ;
298
- extern const struct osd_attr g_attr_logical_length ;
299
191
300
192
/* namei.c */
301
193
extern const struct inode_operations exofs_dir_inode_operations ;
@@ -305,4 +197,33 @@ extern const struct inode_operations exofs_special_inode_operations;
305
197
extern const struct inode_operations exofs_symlink_inode_operations ;
306
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
229
#endif
0 commit comments