diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2011-05-16 08:26:47 -0400 |
---|---|---|
committer | Boaz Harrosh <bharrosh@panasas.com> | 2011-08-06 22:35:31 -0400 |
commit | 85e44df4748670a1a7d8441b2d75843cdebc478a (patch) | |
tree | c5bc0cdf7dad56cc6f3a38f99c88f62325a1e029 /fs/exofs/super.c | |
parent | e1042ba0991aab80ced34f7dade6ec25f22b4304 (diff) |
exofs: Move exofs specific osd operations out of ios.c
ios.c will be moving to an external library, for use by the
objects-layout-driver. Remove from it some exofs specific functions.
Also g_attr_logical_length is used both by inode.c and ios.c
move definition to the later, to keep it independent
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'fs/exofs/super.c')
-rw-r--r-- | fs/exofs/super.c | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 65fe5debe11c..8783f3d33c4a 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
@@ -40,6 +40,8 @@ | |||
40 | 40 | ||
41 | #include "exofs.h" | 41 | #include "exofs.h" |
42 | 42 | ||
43 | #define EXOFS_DBGMSG2(M...) do {} while (0) | ||
44 | |||
43 | /****************************************************************************** | 45 | /****************************************************************************** |
44 | * MOUNT OPTIONS | 46 | * MOUNT OPTIONS |
45 | *****************************************************************************/ | 47 | *****************************************************************************/ |
@@ -208,10 +210,64 @@ static void destroy_inodecache(void) | |||
208 | } | 210 | } |
209 | 211 | ||
210 | /****************************************************************************** | 212 | /****************************************************************************** |
211 | * SUPERBLOCK FUNCTIONS | 213 | * Some osd helpers |
212 | *****************************************************************************/ | 214 | *****************************************************************************/ |
213 | static const struct super_operations exofs_sops; | 215 | void exofs_make_credential(u8 cred_a[OSD_CAP_LEN], const struct osd_obj_id *obj) |
214 | static const struct export_operations exofs_export_ops; | 216 | { |
217 | osd_sec_init_nosec_doall_caps(cred_a, obj, false, true); | ||
218 | } | ||
219 | |||
220 | static int exofs_read_kern(struct osd_dev *od, u8 *cred, struct osd_obj_id *obj, | ||
221 | u64 offset, void *p, unsigned length) | ||
222 | { | ||
223 | struct osd_request *or = osd_start_request(od, GFP_KERNEL); | ||
224 | /* struct osd_sense_info osi = {.key = 0};*/ | ||
225 | int ret; | ||
226 | |||
227 | if (unlikely(!or)) { | ||
228 | EXOFS_DBGMSG("%s: osd_start_request failed.\n", __func__); | ||
229 | return -ENOMEM; | ||
230 | } | ||
231 | ret = osd_req_read_kern(or, obj, offset, p, length); | ||
232 | if (unlikely(ret)) { | ||
233 | EXOFS_DBGMSG("%s: osd_req_read_kern failed.\n", __func__); | ||
234 | goto out; | ||
235 | } | ||
236 | |||
237 | ret = osd_finalize_request(or, 0, cred, NULL); | ||
238 | if (unlikely(ret)) { | ||
239 | EXOFS_DBGMSG("Failed to osd_finalize_request() => %d\n", ret); | ||
240 | goto out; | ||
241 | } | ||
242 | |||
243 | ret = osd_execute_request(or); | ||
244 | if (unlikely(ret)) | ||
245 | EXOFS_DBGMSG("osd_execute_request() => %d\n", ret); | ||
246 | /* osd_req_decode_sense(or, ret); */ | ||
247 | |||
248 | out: | ||
249 | osd_end_request(or); | ||
250 | EXOFS_DBGMSG2("read_kern(0x%llx) offset=0x%llx " | ||
251 | "length=0x%llx dev=%p ret=>%d\n", | ||
252 | _LLU(obj->id), _LLU(offset), _LLU(length), od, ret); | ||
253 | return ret; | ||
254 | } | ||
255 | |||
256 | unsigned exofs_layout_od_id(struct exofs_layout *layout, | ||
257 | osd_id obj_no, unsigned layout_index) | ||
258 | { | ||
259 | /* switch (layout->lay_func) { | ||
260 | case LAYOUT_MOVING_WINDOW: | ||
261 | {*/ | ||
262 | unsigned dev_mod = obj_no; | ||
263 | |||
264 | return (layout_index + dev_mod * layout->mirrors_p1) % | ||
265 | layout->s_numdevs; | ||
266 | /* } | ||
267 | case LAYOUT_FUNC_IMPLICT: | ||
268 | return layout->devs[layout_index]; | ||
269 | }*/ | ||
270 | } | ||
215 | 271 | ||
216 | static const struct osd_attr g_attr_sb_stats = ATTR_DEF( | 272 | static const struct osd_attr g_attr_sb_stats = ATTR_DEF( |
217 | EXOFS_APAGE_SB_DATA, | 273 | EXOFS_APAGE_SB_DATA, |
@@ -308,6 +364,12 @@ int exofs_sbi_write_stats(struct exofs_sb_info *sbi) | |||
308 | return ret; | 364 | return ret; |
309 | } | 365 | } |
310 | 366 | ||
367 | /****************************************************************************** | ||
368 | * SUPERBLOCK FUNCTIONS | ||
369 | *****************************************************************************/ | ||
370 | static const struct super_operations exofs_sops; | ||
371 | static const struct export_operations exofs_export_ops; | ||
372 | |||
311 | /* | 373 | /* |
312 | * Write the superblock to the OSD | 374 | * Write the superblock to the OSD |
313 | */ | 375 | */ |