History

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

Boaz Harrosh committed 15 years ago

Commit 85e44df1 parent e1042ba4 files · +79 −73Browse files

Unified · Split

4 files
  1. fs/exofs/exofs.h +11 −6
  2. fs/exofs/inode.c +0 −3
  3. fs/exofs/ios.c +3 −61
  4. fs/exofs/super.c +65 −3
fs/exofs/exofs.h+11−6
@@ -205,6 +205,14 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode) · 204 unmodified lines
205205 */
206206 unsigned exofs_layout_od_id(struct exofs_layout *layout,
207207 osd_id obj_no, unsigned layout_index);
208+
209+static inline struct osd_dev *exofs_ios_od(struct exofs_io_state *ios,
210+ unsigned layout_index)
211+{
212+ return ios->layout->s_ods[
213+ exofs_layout_od_id(ios->layout, ios->obj.id, layout_index)];
214+}
215+
208216 /*
209217 * Maximum count of links to a file
210218 */
@@ -215,11 +223,6 @@ unsigned exofs_layout_od_id(struct exofs_layout *layout, · 4 unmodified lines
215223 *************************/
216224
217225 /* ios.c */
218−void exofs_make_credential(u8 cred_a[OSD_CAP_LEN],
219− const struct osd_obj_id *obj);
220−int exofs_read_kern(struct osd_dev *od, u8 *cred, struct osd_obj_id *obj,
221− u64 offset, void *p, unsigned length);
222−
223226 int exofs_get_rw_state(struct exofs_layout *layout, bool is_reading,
224227 u64 offset, u64 length, struct exofs_io_state **ios);
225228 int exofs_get_io_state(struct exofs_layout *layout,
@@ -234,6 +237,7 @@ int exofs_sbi_write(struct exofs_io_state *ios); · 8 unmodified lines
234237 int exofs_sbi_read(struct exofs_io_state *ios);
235238
236239 int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr);
240+extern const struct osd_attr g_attr_logical_length;
237241
238242 int exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
239243 static inline int exofs_oi_write(struct exofs_i_info *oi,
@@ -278,6 +282,8 @@ int exofs_set_link(struct inode *, struct exofs_dir_entry *, struct page *, · 38 unmodified lines
278282 struct inode *);
279283
280284 /* super.c */
285+void exofs_make_credential(u8 cred_a[OSD_CAP_LEN],
286+ const struct osd_obj_id *obj);
281287 int exofs_sbi_write_stats(struct exofs_sb_info *sbi);
282288
283289 /*********************
@@ -292,7 +298,6 @@ extern const struct file_operations exofs_file_operations; · 8 unmodified lines
292298
293299 /* inode.c */
294300 extern const struct address_space_operations exofs_aops;
295−extern const struct osd_attr g_attr_logical_length;
296301
297302 /* namei.c */
298303 extern const struct inode_operations exofs_dir_inode_operations;
fs/exofs/inode.c+0−3
@@ -852,9 +852,6 @@ static inline int exofs_inode_is_fast_symlink(struct inode *inode) · 851 unmodified lines
852852 return S_ISLNK(inode->i_mode) && (oi->i_data[0] != 0);
853853 }
854854
855−const struct osd_attr g_attr_logical_length = ATTR_DEF(
856− OSD_APAGE_OBJECT_INFORMATION, OSD_ATTR_OI_LOGICAL_LENGTH, 8);
857−
858855 static int _do_truncate(struct inode *inode, loff_t newsize)
859856 {
860857 struct exofs_i_info *oi = exofs_i(inode);
fs/exofs/ios.c+3−61
@@ -31,44 +31,6 @@ · 30 unmodified lines
3131 #define EXOFS_DBGMSG2(M...) do {} while (0)
3232 /* #define EXOFS_DBGMSG2 EXOFS_DBGMSG */
3333
34−void exofs_make_credential(u8 cred_a[OSD_CAP_LEN], const struct osd_obj_id *obj)
35−{
36− osd_sec_init_nosec_doall_caps(cred_a, obj, false, true);
37−}
38−
39−int exofs_read_kern(struct osd_dev *od, u8 *cred, struct osd_obj_id *obj,
40− u64 offset, void *p, unsigned length)
41−{
42− struct osd_request *or = osd_start_request(od, GFP_KERNEL);
43−/* struct osd_sense_info osi = {.key = 0};*/
44− int ret;
45−
46− if (unlikely(!or)) {
47− EXOFS_DBGMSG("%s: osd_start_request failed.\n", __func__);
48− return -ENOMEM;
49− }
50− ret = osd_req_read_kern(or, obj, offset, p, length);
51− if (unlikely(ret)) {
52− EXOFS_DBGMSG("%s: osd_req_read_kern failed.\n", __func__);
53− goto out;
54− }
55−
56− ret = osd_finalize_request(or, 0, cred, NULL);
57− if (unlikely(ret)) {
58− EXOFS_DBGMSG("Failed to osd_finalize_request() => %d\n", ret);
59− goto out;
60− }
61−
62− ret = osd_execute_request(or);
63− if (unlikely(ret))
64− EXOFS_DBGMSG("osd_execute_request() => %d\n", ret);
65− /* osd_req_decode_sense(or, ret); */
66−
67−out:
68− osd_end_request(or);
69− return ret;
70−}
71−
7234 int exofs_get_rw_state(struct exofs_layout *layout, bool is_reading,
7335 u64 offset, u64 length, struct exofs_io_state **pios)
7436 {
@@ -119,29 +81,6 @@ void exofs_put_io_state(struct exofs_io_state *ios) · 44 unmodified lines
11981 }
12082 }
12183
122−unsigned exofs_layout_od_id(struct exofs_layout *layout,
123− osd_id obj_no, unsigned layout_index)
124−{
125−/* switch (layout->lay_func) {
126− case LAYOUT_MOVING_WINDOW:
127− {*/
128− unsigned dev_mod = obj_no;
129−
130− return (layout_index + dev_mod * layout->mirrors_p1) %
131− layout->s_numdevs;
132−/* }
133− case LAYOUT_FUNC_IMPLICT:
134− return layout->devs[layout_index];
135− }*/
136−}
137−
138−static inline struct osd_dev *exofs_ios_od(struct exofs_io_state *ios,
139− unsigned layout_index)
140−{
141− return ios->layout->s_ods[
142− exofs_layout_od_id(ios->layout, ios->obj.id, layout_index)];
143−}
144−
14584 static void _sync_done(struct exofs_io_state *ios, void *p)
14685 {
14786 struct completion *waiting = p;
@@ -844,3 +783,6 @@ out: · 696 unmodified lines
844783 exofs_put_io_state(ios);
845784 return ret;
846785 }
786+
787+const struct osd_attr g_attr_logical_length = ATTR_DEF(
788+ OSD_APAGE_OBJECT_INFORMATION, OSD_ATTR_OI_LOGICAL_LENGTH, 8);
fs/exofs/super.c+65−3
@@ -40,6 +40,8 @@ · 39 unmodified lines
4040
4141 #include "exofs.h"
4242
43+#define EXOFS_DBGMSG2(M...) do {} while (0)
44+
4345 /******************************************************************************
4446 * MOUNT OPTIONS
4547 *****************************************************************************/
@@ -208,10 +210,64 @@ static void destroy_inodecache(void) · 162 unmodified lines
208210 }
209211
210212 /******************************************************************************
211− * SUPERBLOCK FUNCTIONS
213+ * Some osd helpers
212214 *****************************************************************************/
213−static const struct super_operations exofs_sops;
214−static const struct export_operations exofs_export_ops;
215+void exofs_make_credential(u8 cred_a[OSD_CAP_LEN], const struct osd_obj_id *obj)
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+}
215271
216272 static const struct osd_attr g_attr_sb_stats = ATTR_DEF(
217273 EXOFS_APAGE_SB_DATA,
@@ -308,6 +364,12 @@ int exofs_sbi_write_stats(struct exofs_sb_info *sbi) · 90 unmodified lines
308364 return ret;
309365 }
310366
367+/******************************************************************************
368+ * SUPERBLOCK FUNCTIONS
369+ *****************************************************************************/
370+static const struct super_operations exofs_sops;
371+static const struct export_operations exofs_export_ops;
372+
311373 /*
312374 * Write the superblock to the OSD
313375 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t