aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exofs/Kbuild2
-rw-r--r--fs/exofs/exofs.h119
-rw-r--r--fs/exofs/inode.c88
-rw-r--r--fs/exofs/ore.c (renamed from fs/exofs/ios.c)160
-rw-r--r--fs/exofs/super.c56
-rw-r--r--include/scsi/osd_ore.h125
6 files changed, 295 insertions, 255 deletions
diff --git a/fs/exofs/Kbuild b/fs/exofs/Kbuild
index 2d0f757fda3e..c1af2217b087 100644
--- a/fs/exofs/Kbuild
+++ b/fs/exofs/Kbuild
@@ -12,5 +12,5 @@
12# Kbuild - Gets included from the Kernels Makefile and build system 12# Kbuild - Gets included from the Kernels Makefile and build system
13# 13#
14 14
15exofs-y := ios.o inode.o file.o symlink.o namei.o dir.o super.o 15exofs-y := ore.o inode.o file.o symlink.o namei.o dir.o super.o
16obj-$(CONFIG_EXOFS_FS) += exofs.o 16obj-$(CONFIG_EXOFS_FS) += exofs.o
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h
index 39ad50165162..f4e442ec7445 100644
--- a/fs/exofs/exofs.h
+++ b/fs/exofs/exofs.h
@@ -36,7 +36,8 @@
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 <linux/pnfs_osd_xdr.h> 39#include <scsi/osd_ore.h>
40
40#include "common.h" 41#include "common.h"
41 42
42#define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a) 43#define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a)
@@ -52,33 +53,6 @@
52/* 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 */
53#define _LLU(x) (unsigned long long)(x) 54#define _LLU(x) (unsigned long long)(x)
54 55
55struct exofs_comp {
56 struct osd_obj_id obj;
57 u8 cred[OSD_CAP_LEN];
58};
59
60struct exofs_layout {
61 /* Our way of looking at the data_map */
62 unsigned stripe_unit;
63 unsigned mirrors_p1;
64
65 unsigned group_width;
66 u64 group_depth;
67 unsigned group_count;
68};
69
70struct exofs_components {
71 unsigned numdevs; /* Num of devices in array */
72 /* If @single_comp == EC_SINGLE_COMP, @comps points to a single
73 * component. else there are @numdevs components
74 */
75 enum EC_COMP_USAGE {
76 EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff
77 } single_comp;
78 struct exofs_comp *comps;
79 struct osd_dev **ods; /* osd_dev array */
80};
81
82/* 56/*
83 * our extension to the in-memory superblock 57 * our extension to the in-memory superblock
84 */ 58 */
@@ -95,9 +69,9 @@ struct exofs_sb_info {
95 struct pnfs_osd_data_map data_map; /* Default raid to use 69 struct pnfs_osd_data_map data_map; /* Default raid to use
96 * FIXME: Needed ? 70 * FIXME: Needed ?
97 */ 71 */
98 struct exofs_layout layout; /* Default files layout */ 72 struct ore_layout layout; /* Default files layout */
99 struct exofs_comp one_comp; /* id & cred of partition id=0*/ 73 struct ore_comp one_comp; /* id & cred of partition id=0*/
100 struct exofs_components comps; /* comps for the partition */ 74 struct ore_components comps; /* comps for the partition */
101 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 */
102}; 76};
103 77
@@ -111,8 +85,8 @@ struct exofs_i_info {
111 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*/
112 uint32_t i_dir_start_lookup; /* which page to start lookup */ 86 uint32_t i_dir_start_lookup; /* which page to start lookup */
113 uint64_t i_commit_size; /* the object's written length */ 87 uint64_t i_commit_size; /* the object's written length */
114 struct exofs_comp one_comp; /* same component for all devices */ 88 struct ore_comp one_comp; /* same component for all devices */
115 struct exofs_components comps; /* inode view of the device table */ 89 struct ore_components comps; /* inode view of the device table */
116}; 90};
117 91
118static inline osd_id exofs_oi_objno(struct exofs_i_info *oi) 92static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
@@ -120,53 +94,6 @@ static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
120 return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF; 94 return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF;
121} 95}
122 96
123struct exofs_io_state;
124typedef void (*exofs_io_done_fn)(struct exofs_io_state *ios, void *private);
125
126struct exofs_io_state {
127 struct kref kref;
128
129 void *private;
130 exofs_io_done_fn done;
131
132 struct exofs_layout *layout;
133 struct exofs_components *comps;
134
135 /* Global read/write IO*/
136 loff_t offset;
137 unsigned long length;
138 void *kern_buff;
139
140 struct page **pages;
141 unsigned nr_pages;
142 unsigned pgbase;
143 unsigned pages_consumed;
144
145 /* Attributes */
146 unsigned in_attr_len;
147 struct osd_attr *in_attr;
148 unsigned out_attr_len;
149 struct osd_attr *out_attr;
150
151 bool reading;
152
153 /* Variable array of size numdevs */
154 unsigned numdevs;
155 struct exofs_per_dev_state {
156 struct osd_request *or;
157 struct bio *bio;
158 loff_t offset;
159 unsigned length;
160 unsigned dev;
161 } per_dev[];
162};
163
164static inline unsigned exofs_io_state_size(unsigned numdevs)
165{
166 return sizeof(struct exofs_io_state) +
167 sizeof(struct exofs_per_dev_state) * numdevs;
168}
169
170/* 97/*
171 * our inode flags 98 * our inode flags
172 */ 99 */
@@ -219,30 +146,8 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode)
219 * function declarations * 146 * function declarations *
220 *************************/ 147 *************************/
221 148
222/* ios.c */
223int exofs_get_rw_state(struct exofs_layout *layout,
224 struct exofs_components *comps,
225 bool is_reading, u64 offset, u64 length,
226 struct exofs_io_state **ios);
227int exofs_get_io_state(struct exofs_layout *layout,
228 struct exofs_components *comps,
229 struct exofs_io_state **ios);
230void exofs_put_io_state(struct exofs_io_state *ios);
231
232int exofs_check_io(struct exofs_io_state *ios, u64 *resid);
233
234int exofs_sbi_create(struct exofs_io_state *ios);
235int exofs_sbi_remove(struct exofs_io_state *ios);
236int exofs_sbi_write(struct exofs_io_state *ios);
237int exofs_sbi_read(struct exofs_io_state *ios);
238int exofs_truncate(struct exofs_layout *layout, struct exofs_components *comps,
239 u64 size);
240
241int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr);
242extern const struct osd_attr g_attr_logical_length;
243
244/* inode.c */ 149/* inode.c */
245unsigned exofs_max_io_pages(struct exofs_layout *layout, 150unsigned exofs_max_io_pages(struct ore_layout *layout,
246 unsigned expected_pages); 151 unsigned expected_pages);
247int exofs_setattr(struct dentry *, struct iattr *); 152int exofs_setattr(struct dentry *, struct iattr *);
248int exofs_write_begin(struct file *file, struct address_space *mapping, 153int exofs_write_begin(struct file *file, struct address_space *mapping,
@@ -292,8 +197,8 @@ extern const struct inode_operations exofs_special_inode_operations;
292extern const struct inode_operations exofs_symlink_inode_operations; 197extern const struct inode_operations exofs_symlink_inode_operations;
293extern const struct inode_operations exofs_fast_symlink_inode_operations; 198extern const struct inode_operations exofs_fast_symlink_inode_operations;
294 199
295/* exofs_init_comps will initialize an exofs_components device array 200/* exofs_init_comps will initialize an ore_components device array
296 * pointing to a single exofs_comp struct, and a round-robin view 201 * pointing to a single ore_comp struct, and a round-robin view
297 * of the device table. 202 * of the device table.
298 * The first device of each inode is the [inode->ino % num_devices] 203 * The first device of each inode is the [inode->ino % num_devices]
299 * and the rest of the devices sequentially following where the 204 * and the rest of the devices sequentially following where the
@@ -302,8 +207,8 @@ extern const struct inode_operations exofs_fast_symlink_inode_operations;
302 * bigger and that the device table repeats twice. 207 * bigger and that the device table repeats twice.
303 * See: exofs_read_lookup_dev_table() 208 * See: exofs_read_lookup_dev_table()
304 */ 209 */
305static inline void exofs_init_comps(struct exofs_components *comps, 210static inline void exofs_init_comps(struct ore_components *comps,
306 struct exofs_comp *one_comp, 211 struct ore_comp *one_comp,
307 struct exofs_sb_info *sbi, osd_id oid) 212 struct exofs_sb_info *sbi, osd_id oid)
308{ 213{
309 unsigned dev_mod = (unsigned)oid, first_dev; 214 unsigned dev_mod = (unsigned)oid, first_dev;
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 3cc24f25844d..f39a38fc2349 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -43,7 +43,7 @@ enum { BIO_MAX_PAGES_KMALLOC =
43 PAGE_SIZE / sizeof(struct page *), 43 PAGE_SIZE / sizeof(struct page *),
44}; 44};
45 45
46unsigned exofs_max_io_pages(struct exofs_layout *layout, 46unsigned exofs_max_io_pages(struct ore_layout *layout,
47 unsigned expected_pages) 47 unsigned expected_pages)
48{ 48{
49 unsigned pages = min_t(unsigned, expected_pages, MAX_PAGES_KMALLOC); 49 unsigned pages = min_t(unsigned, expected_pages, MAX_PAGES_KMALLOC);
@@ -58,7 +58,7 @@ struct page_collect {
58 struct exofs_sb_info *sbi; 58 struct exofs_sb_info *sbi;
59 struct inode *inode; 59 struct inode *inode;
60 unsigned expected_pages; 60 unsigned expected_pages;
61 struct exofs_io_state *ios; 61 struct ore_io_state *ios;
62 62
63 struct page **pages; 63 struct page **pages;
64 unsigned alloc_pages; 64 unsigned alloc_pages;
@@ -133,7 +133,7 @@ static void pcol_free(struct page_collect *pcol)
133 pcol->pages = NULL; 133 pcol->pages = NULL;
134 134
135 if (pcol->ios) { 135 if (pcol->ios) {
136 exofs_put_io_state(pcol->ios); 136 ore_put_io_state(pcol->ios);
137 pcol->ios = NULL; 137 pcol->ios = NULL;
138 } 138 }
139} 139}
@@ -193,7 +193,7 @@ static int __readpages_done(struct page_collect *pcol)
193 u64 resid; 193 u64 resid;
194 u64 good_bytes; 194 u64 good_bytes;
195 u64 length = 0; 195 u64 length = 0;
196 int ret = exofs_check_io(pcol->ios, &resid); 196 int ret = ore_check_io(pcol->ios, &resid);
197 197
198 if (likely(!ret)) 198 if (likely(!ret))
199 good_bytes = pcol->length; 199 good_bytes = pcol->length;
@@ -234,7 +234,7 @@ static int __readpages_done(struct page_collect *pcol)
234} 234}
235 235
236/* callback of async reads */ 236/* callback of async reads */
237static void readpages_done(struct exofs_io_state *ios, void *p) 237static void readpages_done(struct ore_io_state *ios, void *p)
238{ 238{
239 struct page_collect *pcol = p; 239 struct page_collect *pcol = p;
240 240
@@ -262,7 +262,7 @@ static void _unlock_pcol_pages(struct page_collect *pcol, int ret, int rw)
262static int read_exec(struct page_collect *pcol) 262static int read_exec(struct page_collect *pcol)
263{ 263{
264 struct exofs_i_info *oi = exofs_i(pcol->inode); 264 struct exofs_i_info *oi = exofs_i(pcol->inode);
265 struct exofs_io_state *ios; 265 struct ore_io_state *ios;
266 struct page_collect *pcol_copy = NULL; 266 struct page_collect *pcol_copy = NULL;
267 int ret; 267 int ret;
268 268
@@ -270,7 +270,7 @@ static int read_exec(struct page_collect *pcol)
270 return 0; 270 return 0;
271 271
272 if (!pcol->ios) { 272 if (!pcol->ios) {
273 int ret = exofs_get_rw_state(&pcol->sbi->layout, &oi->comps, true, 273 int ret = ore_get_rw_state(&pcol->sbi->layout, &oi->comps, true,
274 pcol->pg_first << PAGE_CACHE_SHIFT, 274 pcol->pg_first << PAGE_CACHE_SHIFT,
275 pcol->length, &pcol->ios); 275 pcol->length, &pcol->ios);
276 276
@@ -283,7 +283,7 @@ static int read_exec(struct page_collect *pcol)
283 ios->nr_pages = pcol->nr_pages; 283 ios->nr_pages = pcol->nr_pages;
284 284
285 if (pcol->read_4_write) { 285 if (pcol->read_4_write) {
286 exofs_sbi_read(pcol->ios); 286 ore_read(pcol->ios);
287 return __readpages_done(pcol); 287 return __readpages_done(pcol);
288 } 288 }
289 289
@@ -296,7 +296,7 @@ static int read_exec(struct page_collect *pcol)
296 *pcol_copy = *pcol; 296 *pcol_copy = *pcol;
297 ios->done = readpages_done; 297 ios->done = readpages_done;
298 ios->private = pcol_copy; 298 ios->private = pcol_copy;
299 ret = exofs_sbi_read(ios); 299 ret = ore_read(ios);
300 if (unlikely(ret)) 300 if (unlikely(ret))
301 goto err; 301 goto err;
302 302
@@ -458,14 +458,14 @@ static int exofs_readpage(struct file *file, struct page *page)
458} 458}
459 459
460/* Callback for osd_write. All writes are asynchronous */ 460/* Callback for osd_write. All writes are asynchronous */
461static void writepages_done(struct exofs_io_state *ios, void *p) 461static void writepages_done(struct ore_io_state *ios, void *p)
462{ 462{
463 struct page_collect *pcol = p; 463 struct page_collect *pcol = p;
464 int i; 464 int i;
465 u64 resid; 465 u64 resid;
466 u64 good_bytes; 466 u64 good_bytes;
467 u64 length = 0; 467 u64 length = 0;
468 int ret = exofs_check_io(ios, &resid); 468 int ret = ore_check_io(ios, &resid);
469 469
470 atomic_dec(&pcol->sbi->s_curr_pending); 470 atomic_dec(&pcol->sbi->s_curr_pending);
471 471
@@ -508,7 +508,7 @@ static void writepages_done(struct exofs_io_state *ios, void *p)
508static int write_exec(struct page_collect *pcol) 508static int write_exec(struct page_collect *pcol)
509{ 509{
510 struct exofs_i_info *oi = exofs_i(pcol->inode); 510 struct exofs_i_info *oi = exofs_i(pcol->inode);
511 struct exofs_io_state *ios; 511 struct ore_io_state *ios;
512 struct page_collect *pcol_copy = NULL; 512 struct page_collect *pcol_copy = NULL;
513 int ret; 513 int ret;
514 514
@@ -516,7 +516,7 @@ static int write_exec(struct page_collect *pcol)
516 return 0; 516 return 0;
517 517
518 BUG_ON(pcol->ios); 518 BUG_ON(pcol->ios);
519 ret = exofs_get_rw_state(&pcol->sbi->layout, &oi->comps, false, 519 ret = ore_get_rw_state(&pcol->sbi->layout, &oi->comps, false,
520 pcol->pg_first << PAGE_CACHE_SHIFT, 520 pcol->pg_first << PAGE_CACHE_SHIFT,
521 pcol->length, &pcol->ios); 521 pcol->length, &pcol->ios);
522 522
@@ -538,9 +538,9 @@ static int write_exec(struct page_collect *pcol)
538 ios->done = writepages_done; 538 ios->done = writepages_done;
539 ios->private = pcol_copy; 539 ios->private = pcol_copy;
540 540
541 ret = exofs_sbi_write(ios); 541 ret = ore_write(ios);
542 if (unlikely(ret)) { 542 if (unlikely(ret)) {
543 EXOFS_ERR("write_exec: exofs_sbi_write() Failed\n"); 543 EXOFS_ERR("write_exec: ore_write() Failed\n");
544 goto err; 544 goto err;
545 } 545 }
546 546
@@ -860,7 +860,7 @@ static int _do_truncate(struct inode *inode, loff_t newsize)
860 860
861 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 861 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
862 862
863 ret = exofs_truncate(&sbi->layout, &oi->comps, (u64)newsize); 863 ret = ore_truncate(&sbi->layout, &oi->comps, (u64)newsize);
864 if (likely(!ret)) 864 if (likely(!ret))
865 truncate_setsize(inode, newsize); 865 truncate_setsize(inode, newsize);
866 866
@@ -923,13 +923,13 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
923 [1] = g_attr_inode_file_layout, 923 [1] = g_attr_inode_file_layout,
924 [2] = g_attr_inode_dir_layout, 924 [2] = g_attr_inode_dir_layout,
925 }; 925 };
926 struct exofs_io_state *ios; 926 struct ore_io_state *ios;
927 struct exofs_on_disk_inode_layout *layout; 927 struct exofs_on_disk_inode_layout *layout;
928 int ret; 928 int ret;
929 929
930 ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); 930 ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
931 if (unlikely(ret)) { 931 if (unlikely(ret)) {
932 EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); 932 EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
933 return ret; 933 return ret;
934 } 934 }
935 935
@@ -939,7 +939,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
939 ios->in_attr = attrs; 939 ios->in_attr = attrs;
940 ios->in_attr_len = ARRAY_SIZE(attrs); 940 ios->in_attr_len = ARRAY_SIZE(attrs);
941 941
942 ret = exofs_sbi_read(ios); 942 ret = ore_read(ios);
943 if (unlikely(ret)) { 943 if (unlikely(ret)) {
944 EXOFS_ERR("object(0x%llx) corrupted, return empty file=>%d\n", 944 EXOFS_ERR("object(0x%llx) corrupted, return empty file=>%d\n",
945 _LLU(oi->one_comp.obj.id), ret); 945 _LLU(oi->one_comp.obj.id), ret);
@@ -992,7 +992,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
992 } 992 }
993 993
994out: 994out:
995 exofs_put_io_state(ios); 995 ore_put_io_state(ios);
996 return ret; 996 return ret;
997} 997}
998 998
@@ -1111,15 +1111,15 @@ int __exofs_wait_obj_created(struct exofs_i_info *oi)
1111 * set the obj_created flag so that other methods know that the object exists on 1111 * set the obj_created flag so that other methods know that the object exists on
1112 * the OSD. 1112 * the OSD.
1113 */ 1113 */
1114static void create_done(struct exofs_io_state *ios, void *p) 1114static void create_done(struct ore_io_state *ios, void *p)
1115{ 1115{
1116 struct inode *inode = p; 1116 struct inode *inode = p;
1117 struct exofs_i_info *oi = exofs_i(inode); 1117 struct exofs_i_info *oi = exofs_i(inode);
1118 struct exofs_sb_info *sbi = inode->i_sb->s_fs_info; 1118 struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
1119 int ret; 1119 int ret;
1120 1120
1121 ret = exofs_check_io(ios, NULL); 1121 ret = ore_check_io(ios, NULL);
1122 exofs_put_io_state(ios); 1122 ore_put_io_state(ios);
1123 1123
1124 atomic_dec(&sbi->s_curr_pending); 1124 atomic_dec(&sbi->s_curr_pending);
1125 1125
@@ -1149,7 +1149,7 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
1149 struct exofs_sb_info *sbi = sb->s_fs_info; 1149 struct exofs_sb_info *sbi = sb->s_fs_info;
1150 struct inode *inode; 1150 struct inode *inode;
1151 struct exofs_i_info *oi; 1151 struct exofs_i_info *oi;
1152 struct exofs_io_state *ios; 1152 struct ore_io_state *ios;
1153 int ret; 1153 int ret;
1154 1154
1155 inode = new_inode(sb); 1155 inode = new_inode(sb);
@@ -1178,18 +1178,18 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
1178 1178
1179 mark_inode_dirty(inode); 1179 mark_inode_dirty(inode);
1180 1180
1181 ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); 1181 ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
1182 if (unlikely(ret)) { 1182 if (unlikely(ret)) {
1183 EXOFS_ERR("exofs_new_inode: exofs_get_io_state failed\n"); 1183 EXOFS_ERR("exofs_new_inode: ore_get_io_state failed\n");
1184 return ERR_PTR(ret); 1184 return ERR_PTR(ret);
1185 } 1185 }
1186 1186
1187 ios->done = create_done; 1187 ios->done = create_done;
1188 ios->private = inode; 1188 ios->private = inode;
1189 1189
1190 ret = exofs_sbi_create(ios); 1190 ret = ore_create(ios);
1191 if (ret) { 1191 if (ret) {
1192 exofs_put_io_state(ios); 1192 ore_put_io_state(ios);
1193 return ERR_PTR(ret); 1193 return ERR_PTR(ret);
1194 } 1194 }
1195 atomic_inc(&sbi->s_curr_pending); 1195 atomic_inc(&sbi->s_curr_pending);
@@ -1208,11 +1208,11 @@ struct updatei_args {
1208/* 1208/*
1209 * Callback function from exofs_update_inode(). 1209 * Callback function from exofs_update_inode().
1210 */ 1210 */
1211static void updatei_done(struct exofs_io_state *ios, void *p) 1211static void updatei_done(struct ore_io_state *ios, void *p)
1212{ 1212{
1213 struct updatei_args *args = p; 1213 struct updatei_args *args = p;
1214 1214
1215 exofs_put_io_state(ios); 1215 ore_put_io_state(ios);
1216 1216
1217 atomic_dec(&args->sbi->s_curr_pending); 1217 atomic_dec(&args->sbi->s_curr_pending);
1218 1218
@@ -1228,7 +1228,7 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
1228 struct exofs_i_info *oi = exofs_i(inode); 1228 struct exofs_i_info *oi = exofs_i(inode);
1229 struct super_block *sb = inode->i_sb; 1229 struct super_block *sb = inode->i_sb;
1230 struct exofs_sb_info *sbi = sb->s_fs_info; 1230 struct exofs_sb_info *sbi = sb->s_fs_info;
1231 struct exofs_io_state *ios; 1231 struct ore_io_state *ios;
1232 struct osd_attr attr; 1232 struct osd_attr attr;
1233 struct exofs_fcb *fcb; 1233 struct exofs_fcb *fcb;
1234 struct updatei_args *args; 1234 struct updatei_args *args;
@@ -1267,9 +1267,9 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
1267 } else 1267 } else
1268 memcpy(fcb->i_data, oi->i_data, sizeof(fcb->i_data)); 1268 memcpy(fcb->i_data, oi->i_data, sizeof(fcb->i_data));
1269 1269
1270 ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); 1270 ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
1271 if (unlikely(ret)) { 1271 if (unlikely(ret)) {
1272 EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); 1272 EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
1273 goto free_args; 1273 goto free_args;
1274 } 1274 }
1275 1275
@@ -1286,13 +1286,13 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
1286 ios->private = args; 1286 ios->private = args;
1287 } 1287 }
1288 1288
1289 ret = exofs_sbi_write(ios); 1289 ret = ore_write(ios);
1290 if (!do_sync && !ret) { 1290 if (!do_sync && !ret) {
1291 atomic_inc(&sbi->s_curr_pending); 1291 atomic_inc(&sbi->s_curr_pending);
1292 goto out; /* deallocation in updatei_done */ 1292 goto out; /* deallocation in updatei_done */
1293 } 1293 }
1294 1294
1295 exofs_put_io_state(ios); 1295 ore_put_io_state(ios);
1296free_args: 1296free_args:
1297 kfree(args); 1297 kfree(args);
1298out: 1298out:
@@ -1311,11 +1311,11 @@ int exofs_write_inode(struct inode *inode, struct writeback_control *wbc)
1311 * Callback function from exofs_delete_inode() - don't have much cleaning up to 1311 * Callback function from exofs_delete_inode() - don't have much cleaning up to
1312 * do. 1312 * do.
1313 */ 1313 */
1314static void delete_done(struct exofs_io_state *ios, void *p) 1314static void delete_done(struct ore_io_state *ios, void *p)
1315{ 1315{
1316 struct exofs_sb_info *sbi = p; 1316 struct exofs_sb_info *sbi = p;
1317 1317
1318 exofs_put_io_state(ios); 1318 ore_put_io_state(ios);
1319 1319
1320 atomic_dec(&sbi->s_curr_pending); 1320 atomic_dec(&sbi->s_curr_pending);
1321} 1321}
@@ -1330,7 +1330,7 @@ void exofs_evict_inode(struct inode *inode)
1330 struct exofs_i_info *oi = exofs_i(inode); 1330 struct exofs_i_info *oi = exofs_i(inode);
1331 struct super_block *sb = inode->i_sb; 1331 struct super_block *sb = inode->i_sb;
1332 struct exofs_sb_info *sbi = sb->s_fs_info; 1332 struct exofs_sb_info *sbi = sb->s_fs_info;
1333 struct exofs_io_state *ios; 1333 struct ore_io_state *ios;
1334 int ret; 1334 int ret;
1335 1335
1336 truncate_inode_pages(&inode->i_data, 0); 1336 truncate_inode_pages(&inode->i_data, 0);
@@ -1350,19 +1350,19 @@ void exofs_evict_inode(struct inode *inode)
1350 /* ignore the error, attempt a remove anyway */ 1350 /* ignore the error, attempt a remove anyway */
1351 1351
1352 /* Now Remove the OSD objects */ 1352 /* Now Remove the OSD objects */
1353 ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); 1353 ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
1354 if (unlikely(ret)) { 1354 if (unlikely(ret)) {
1355 EXOFS_ERR("%s: exofs_get_io_state failed\n", __func__); 1355 EXOFS_ERR("%s: ore_get_io_state failed\n", __func__);
1356 return; 1356 return;
1357 } 1357 }
1358 1358
1359 ios->done = delete_done; 1359 ios->done = delete_done;
1360 ios->private = sbi; 1360 ios->private = sbi;
1361 1361
1362 ret = exofs_sbi_remove(ios); 1362 ret = ore_remove(ios);
1363 if (ret) { 1363 if (ret) {
1364 EXOFS_ERR("%s: exofs_sbi_remove failed\n", __func__); 1364 EXOFS_ERR("%s: ore_remove failed\n", __func__);
1365 exofs_put_io_state(ios); 1365 ore_put_io_state(ios);
1366 return; 1366 return;
1367 } 1367 }
1368 atomic_inc(&sbi->s_curr_pending); 1368 atomic_inc(&sbi->s_curr_pending);
diff --git a/fs/exofs/ios.c b/fs/exofs/ore.c
index f9d5c5a823fb..3a000084cd21 100644
--- a/fs/exofs/ios.c
+++ b/fs/exofs/ore.c
@@ -23,43 +23,54 @@
23 */ 23 */
24 24
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <scsi/scsi_device.h>
27#include <asm/div64.h> 26#include <asm/div64.h>
28 27
29#include "exofs.h" 28#include <scsi/osd_ore.h>
30 29
31#define EXOFS_DBGMSG2(M...) do {} while (0) 30#define ORE_ERR(fmt, a...) printk(KERN_ERR "ore: " fmt, ##a)
32/* #define EXOFS_DBGMSG2 EXOFS_DBGMSG */
33 31
34static u8 *_ios_cred(struct exofs_io_state *ios, unsigned index) 32#ifdef CONFIG_EXOFS_DEBUG
33#define ORE_DBGMSG(fmt, a...) \
34 printk(KERN_NOTICE "ore @%s:%d: " fmt, __func__, __LINE__, ##a)
35#else
36#define ORE_DBGMSG(fmt, a...) \
37 do { if (0) printk(fmt, ##a); } while (0)
38#endif
39
40/* u64 has problems with printk this will cast it to unsigned long long */
41#define _LLU(x) (unsigned long long)(x)
42
43#define ORE_DBGMSG2(M...) do {} while (0)
44/* #define ORE_DBGMSG2 ORE_DBGMSG */
45
46static u8 *_ios_cred(struct ore_io_state *ios, unsigned index)
35{ 47{
36 return ios->comps->comps[index & ios->comps->single_comp].cred; 48 return ios->comps->comps[index & ios->comps->single_comp].cred;
37} 49}
38 50
39static struct osd_obj_id *_ios_obj(struct exofs_io_state *ios, unsigned index) 51static struct osd_obj_id *_ios_obj(struct ore_io_state *ios, unsigned index)
40{ 52{
41 return &ios->comps->comps[index & ios->comps->single_comp].obj; 53 return &ios->comps->comps[index & ios->comps->single_comp].obj;
42} 54}
43 55
44static struct osd_dev *_ios_od(struct exofs_io_state *ios, unsigned index) 56static struct osd_dev *_ios_od(struct ore_io_state *ios, unsigned index)
45{ 57{
46 return ios->comps->ods[index]; 58 return ios->comps->ods[index];
47} 59}
48 60
49int exofs_get_rw_state(struct exofs_layout *layout, 61int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps,
50 struct exofs_components *comps, 62 bool is_reading, u64 offset, u64 length,
51 bool is_reading, u64 offset, u64 length, 63 struct ore_io_state **pios)
52 struct exofs_io_state **pios)
53{ 64{
54 struct exofs_io_state *ios; 65 struct ore_io_state *ios;
55 66
56 /*TODO: Maybe use kmem_cach per sbi of size 67 /*TODO: Maybe use kmem_cach per sbi of size
57 * exofs_io_state_size(layout->s_numdevs) 68 * exofs_io_state_size(layout->s_numdevs)
58 */ 69 */
59 ios = kzalloc(exofs_io_state_size(comps->numdevs), GFP_KERNEL); 70 ios = kzalloc(ore_io_state_size(comps->numdevs), GFP_KERNEL);
60 if (unlikely(!ios)) { 71 if (unlikely(!ios)) {
61 EXOFS_DBGMSG("Failed kzalloc bytes=%d\n", 72 ORE_DBGMSG("Failed kzalloc bytes=%d\n",
62 exofs_io_state_size(comps->numdevs)); 73 ore_io_state_size(comps->numdevs));
63 *pios = NULL; 74 *pios = NULL;
64 return -ENOMEM; 75 return -ENOMEM;
65 } 76 }
@@ -74,20 +85,19 @@ int exofs_get_rw_state(struct exofs_layout *layout,
74 return 0; 85 return 0;
75} 86}
76 87
77int exofs_get_io_state(struct exofs_layout *layout, 88int ore_get_io_state(struct ore_layout *layout, struct ore_components *comps,
78 struct exofs_components *comps, 89 struct ore_io_state **ios)
79 struct exofs_io_state **ios)
80{ 90{
81 return exofs_get_rw_state(layout, comps, true, 0, 0, ios); 91 return ore_get_rw_state(layout, comps, true, 0, 0, ios);
82} 92}
83 93
84void exofs_put_io_state(struct exofs_io_state *ios) 94void ore_put_io_state(struct ore_io_state *ios)
85{ 95{
86 if (ios) { 96 if (ios) {
87 unsigned i; 97 unsigned i;
88 98
89 for (i = 0; i < ios->numdevs; i++) { 99 for (i = 0; i < ios->numdevs; i++) {
90 struct exofs_per_dev_state *per_dev = &ios->per_dev[i]; 100 struct ore_per_dev_state *per_dev = &ios->per_dev[i];
91 101
92 if (per_dev->or) 102 if (per_dev->or)
93 osd_end_request(per_dev->or); 103 osd_end_request(per_dev->or);
@@ -99,7 +109,7 @@ void exofs_put_io_state(struct exofs_io_state *ios)
99 } 109 }
100} 110}
101 111
102static void _sync_done(struct exofs_io_state *ios, void *p) 112static void _sync_done(struct ore_io_state *ios, void *p)
103{ 113{
104 struct completion *waiting = p; 114 struct completion *waiting = p;
105 115
@@ -108,20 +118,20 @@ static void _sync_done(struct exofs_io_state *ios, void *p)
108 118
109static void _last_io(struct kref *kref) 119static void _last_io(struct kref *kref)
110{ 120{
111 struct exofs_io_state *ios = container_of( 121 struct ore_io_state *ios = container_of(
112 kref, struct exofs_io_state, kref); 122 kref, struct ore_io_state, kref);
113 123
114 ios->done(ios, ios->private); 124 ios->done(ios, ios->private);
115} 125}
116 126
117static void _done_io(struct osd_request *or, void *p) 127static void _done_io(struct osd_request *or, void *p)
118{ 128{
119 struct exofs_io_state *ios = p; 129 struct ore_io_state *ios = p;
120 130
121 kref_put(&ios->kref, _last_io); 131 kref_put(&ios->kref, _last_io);
122} 132}
123 133
124static int exofs_io_execute(struct exofs_io_state *ios) 134static int ore_io_execute(struct ore_io_state *ios)
125{ 135{
126 DECLARE_COMPLETION_ONSTACK(wait); 136 DECLARE_COMPLETION_ONSTACK(wait);
127 bool sync = (ios->done == NULL); 137 bool sync = (ios->done == NULL);
@@ -139,7 +149,7 @@ static int exofs_io_execute(struct exofs_io_state *ios)
139 149
140 ret = osd_finalize_request(or, 0, _ios_cred(ios, i), NULL); 150 ret = osd_finalize_request(or, 0, _ios_cred(ios, i), NULL);
141 if (unlikely(ret)) { 151 if (unlikely(ret)) {
142 EXOFS_DBGMSG("Failed to osd_finalize_request() => %d\n", 152 ORE_DBGMSG("Failed to osd_finalize_request() => %d\n",
143 ret); 153 ret);
144 return ret; 154 return ret;
145 } 155 }
@@ -161,7 +171,7 @@ static int exofs_io_execute(struct exofs_io_state *ios)
161 171
162 if (sync) { 172 if (sync) {
163 wait_for_completion(&wait); 173 wait_for_completion(&wait);
164 ret = exofs_check_io(ios, NULL); 174 ret = ore_check_io(ios, NULL);
165 } 175 }
166 return ret; 176 return ret;
167} 177}
@@ -181,7 +191,7 @@ static void _clear_bio(struct bio *bio)
181 } 191 }
182} 192}
183 193
184int exofs_check_io(struct exofs_io_state *ios, u64 *resid) 194int ore_check_io(struct ore_io_state *ios, u64 *resid)
185{ 195{
186 enum osd_err_priority acumulated_osd_err = 0; 196 enum osd_err_priority acumulated_osd_err = 0;
187 int acumulated_lin_err = 0; 197 int acumulated_lin_err = 0;
@@ -202,7 +212,7 @@ int exofs_check_io(struct exofs_io_state *ios, u64 *resid)
202 if (OSD_ERR_PRI_CLEAR_PAGES == osi.osd_err_pri) { 212 if (OSD_ERR_PRI_CLEAR_PAGES == osi.osd_err_pri) {
203 /* start read offset passed endof file */ 213 /* start read offset passed endof file */
204 _clear_bio(ios->per_dev[i].bio); 214 _clear_bio(ios->per_dev[i].bio);
205 EXOFS_DBGMSG("start read offset passed end of file " 215 ORE_DBGMSG("start read offset passed end of file "
206 "offset=0x%llx, length=0x%llx\n", 216 "offset=0x%llx, length=0x%llx\n",
207 _LLU(ios->per_dev[i].offset), 217 _LLU(ios->per_dev[i].offset),
208 _LLU(ios->per_dev[i].length)); 218 _LLU(ios->per_dev[i].length));
@@ -277,7 +287,7 @@ struct _striping_info {
277 unsigned unit_off; 287 unsigned unit_off;
278}; 288};
279 289
280static void _calc_stripe_info(struct exofs_layout *layout, u64 file_offset, 290static void _calc_stripe_info(struct ore_layout *layout, u64 file_offset,
281 struct _striping_info *si) 291 struct _striping_info *si)
282{ 292{
283 u32 stripe_unit = layout->stripe_unit; 293 u32 stripe_unit = layout->stripe_unit;
@@ -312,8 +322,8 @@ static void _calc_stripe_info(struct exofs_layout *layout, u64 file_offset,
312 si->M = M; 322 si->M = M;
313} 323}
314 324
315static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg, 325static int _add_stripe_unit(struct ore_io_state *ios, unsigned *cur_pg,
316 unsigned pgbase, struct exofs_per_dev_state *per_dev, 326 unsigned pgbase, struct ore_per_dev_state *per_dev,
317 int cur_len) 327 int cur_len)
318{ 328{
319 unsigned pg = *cur_pg; 329 unsigned pg = *cur_pg;
@@ -330,7 +340,7 @@ static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg,
330 340
331 per_dev->bio = bio_kmalloc(GFP_KERNEL, bio_size); 341 per_dev->bio = bio_kmalloc(GFP_KERNEL, bio_size);
332 if (unlikely(!per_dev->bio)) { 342 if (unlikely(!per_dev->bio)) {
333 EXOFS_DBGMSG("Failed to allocate BIO size=%u\n", 343 ORE_DBGMSG("Failed to allocate BIO size=%u\n",
334 bio_size); 344 bio_size);
335 return -ENOMEM; 345 return -ENOMEM;
336 } 346 }
@@ -356,7 +366,7 @@ static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg,
356 return 0; 366 return 0;
357} 367}
358 368
359static int _prepare_one_group(struct exofs_io_state *ios, u64 length, 369static int _prepare_one_group(struct ore_io_state *ios, u64 length,
360 struct _striping_info *si) 370 struct _striping_info *si)
361{ 371{
362 unsigned stripe_unit = ios->layout->stripe_unit; 372 unsigned stripe_unit = ios->layout->stripe_unit;
@@ -369,7 +379,7 @@ static int _prepare_one_group(struct exofs_io_state *ios, u64 length,
369 int ret = 0; 379 int ret = 0;
370 380
371 while (length) { 381 while (length) {
372 struct exofs_per_dev_state *per_dev = &ios->per_dev[dev]; 382 struct ore_per_dev_state *per_dev = &ios->per_dev[dev];
373 unsigned cur_len, page_off = 0; 383 unsigned cur_len, page_off = 0;
374 384
375 if (!per_dev->length) { 385 if (!per_dev->length) {
@@ -412,7 +422,7 @@ out:
412 return ret; 422 return ret;
413} 423}
414 424
415static int _prepare_for_striping(struct exofs_io_state *ios) 425static int _prepare_for_striping(struct ore_io_state *ios)
416{ 426{
417 u64 length = ios->length; 427 u64 length = ios->length;
418 u64 offset = ios->offset; 428 u64 offset = ios->offset;
@@ -421,7 +431,7 @@ static int _prepare_for_striping(struct exofs_io_state *ios)
421 431
422 if (!ios->pages) { 432 if (!ios->pages) {
423 if (ios->kern_buff) { 433 if (ios->kern_buff) {
424 struct exofs_per_dev_state *per_dev = &ios->per_dev[0]; 434 struct ore_per_dev_state *per_dev = &ios->per_dev[0];
425 435
426 _calc_stripe_info(ios->layout, ios->offset, &si); 436 _calc_stripe_info(ios->layout, ios->offset, &si);
427 per_dev->offset = si.obj_offset; 437 per_dev->offset = si.obj_offset;
@@ -454,7 +464,7 @@ out:
454 return ret; 464 return ret;
455} 465}
456 466
457int exofs_sbi_create(struct exofs_io_state *ios) 467int ore_create(struct ore_io_state *ios)
458{ 468{
459 int i, ret; 469 int i, ret;
460 470
@@ -463,7 +473,7 @@ int exofs_sbi_create(struct exofs_io_state *ios)
463 473
464 or = osd_start_request(_ios_od(ios, i), GFP_KERNEL); 474 or = osd_start_request(_ios_od(ios, i), GFP_KERNEL);
465 if (unlikely(!or)) { 475 if (unlikely(!or)) {
466 EXOFS_ERR("%s: osd_start_request failed\n", __func__); 476 ORE_ERR("%s: osd_start_request failed\n", __func__);
467 ret = -ENOMEM; 477 ret = -ENOMEM;
468 goto out; 478 goto out;
469 } 479 }
@@ -472,13 +482,13 @@ int exofs_sbi_create(struct exofs_io_state *ios)
472 482
473 osd_req_create_object(or, _ios_obj(ios, i)); 483 osd_req_create_object(or, _ios_obj(ios, i));
474 } 484 }
475 ret = exofs_io_execute(ios); 485 ret = ore_io_execute(ios);
476 486
477out: 487out:
478 return ret; 488 return ret;
479} 489}
480 490
481int exofs_sbi_remove(struct exofs_io_state *ios) 491int ore_remove(struct ore_io_state *ios)
482{ 492{
483 int i, ret; 493 int i, ret;
484 494
@@ -487,7 +497,7 @@ int exofs_sbi_remove(struct exofs_io_state *ios)
487 497
488 or = osd_start_request(_ios_od(ios, i), GFP_KERNEL); 498 or = osd_start_request(_ios_od(ios, i), GFP_KERNEL);
489 if (unlikely(!or)) { 499 if (unlikely(!or)) {
490 EXOFS_ERR("%s: osd_start_request failed\n", __func__); 500 ORE_ERR("%s: osd_start_request failed\n", __func__);
491 ret = -ENOMEM; 501 ret = -ENOMEM;
492 goto out; 502 goto out;
493 } 503 }
@@ -496,15 +506,15 @@ int exofs_sbi_remove(struct exofs_io_state *ios)
496 506
497 osd_req_remove_object(or, _ios_obj(ios, i)); 507 osd_req_remove_object(or, _ios_obj(ios, i));
498 } 508 }
499 ret = exofs_io_execute(ios); 509 ret = ore_io_execute(ios);
500 510
501out: 511out:
502 return ret; 512 return ret;
503} 513}
504 514
505static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp) 515static int _write_mirror(struct ore_io_state *ios, int cur_comp)
506{ 516{
507 struct exofs_per_dev_state *master_dev = &ios->per_dev[cur_comp]; 517 struct ore_per_dev_state *master_dev = &ios->per_dev[cur_comp];
508 unsigned dev = ios->per_dev[cur_comp].dev; 518 unsigned dev = ios->per_dev[cur_comp].dev;
509 unsigned last_comp = cur_comp + ios->layout->mirrors_p1; 519 unsigned last_comp = cur_comp + ios->layout->mirrors_p1;
510 int ret = 0; 520 int ret = 0;
@@ -513,12 +523,12 @@ static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp)
513 return 0; /* Just an empty slot */ 523 return 0; /* Just an empty slot */
514 524
515 for (; cur_comp < last_comp; ++cur_comp, ++dev) { 525 for (; cur_comp < last_comp; ++cur_comp, ++dev) {
516 struct exofs_per_dev_state *per_dev = &ios->per_dev[cur_comp]; 526 struct ore_per_dev_state *per_dev = &ios->per_dev[cur_comp];
517 struct osd_request *or; 527 struct osd_request *or;
518 528
519 or = osd_start_request(_ios_od(ios, dev), GFP_KERNEL); 529 or = osd_start_request(_ios_od(ios, dev), GFP_KERNEL);
520 if (unlikely(!or)) { 530 if (unlikely(!or)) {
521 EXOFS_ERR("%s: osd_start_request failed\n", __func__); 531 ORE_ERR("%s: osd_start_request failed\n", __func__);
522 ret = -ENOMEM; 532 ret = -ENOMEM;
523 goto out; 533 goto out;
524 } 534 }
@@ -532,7 +542,7 @@ static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp)
532 bio = bio_kmalloc(GFP_KERNEL, 542 bio = bio_kmalloc(GFP_KERNEL,
533 master_dev->bio->bi_max_vecs); 543 master_dev->bio->bi_max_vecs);
534 if (unlikely(!bio)) { 544 if (unlikely(!bio)) {
535 EXOFS_DBGMSG( 545 ORE_DBGMSG(
536 "Failed to allocate BIO size=%u\n", 546 "Failed to allocate BIO size=%u\n",
537 master_dev->bio->bi_max_vecs); 547 master_dev->bio->bi_max_vecs);
538 ret = -ENOMEM; 548 ret = -ENOMEM;
@@ -553,7 +563,7 @@ static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp)
553 563
554 osd_req_write(or, _ios_obj(ios, dev), per_dev->offset, 564 osd_req_write(or, _ios_obj(ios, dev), per_dev->offset,
555 bio, per_dev->length); 565 bio, per_dev->length);
556 EXOFS_DBGMSG("write(0x%llx) offset=0x%llx " 566 ORE_DBGMSG("write(0x%llx) offset=0x%llx "
557 "length=0x%llx dev=%d\n", 567 "length=0x%llx dev=%d\n",
558 _LLU(_ios_obj(ios, dev)->id), 568 _LLU(_ios_obj(ios, dev)->id),
559 _LLU(per_dev->offset), 569 _LLU(per_dev->offset),
@@ -564,14 +574,14 @@ static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp)
564 ios->kern_buff, ios->length); 574 ios->kern_buff, ios->length);
565 if (unlikely(ret)) 575 if (unlikely(ret))
566 goto out; 576 goto out;
567 EXOFS_DBGMSG2("write_kern(0x%llx) offset=0x%llx " 577 ORE_DBGMSG2("write_kern(0x%llx) offset=0x%llx "
568 "length=0x%llx dev=%d\n", 578 "length=0x%llx dev=%d\n",
569 _LLU(_ios_obj(ios, dev)->id), 579 _LLU(_ios_obj(ios, dev)->id),
570 _LLU(per_dev->offset), 580 _LLU(per_dev->offset),
571 _LLU(ios->length), dev); 581 _LLU(ios->length), dev);
572 } else { 582 } else {
573 osd_req_set_attributes(or, _ios_obj(ios, dev)); 583 osd_req_set_attributes(or, _ios_obj(ios, dev));
574 EXOFS_DBGMSG2("obj(0x%llx) set_attributes=%d dev=%d\n", 584 ORE_DBGMSG2("obj(0x%llx) set_attributes=%d dev=%d\n",
575 _LLU(_ios_obj(ios, dev)->id), 585 _LLU(_ios_obj(ios, dev)->id),
576 ios->out_attr_len, dev); 586 ios->out_attr_len, dev);
577 } 587 }
@@ -589,7 +599,7 @@ out:
589 return ret; 599 return ret;
590} 600}
591 601
592int exofs_sbi_write(struct exofs_io_state *ios) 602int ore_write(struct ore_io_state *ios)
593{ 603{
594 int i; 604 int i;
595 int ret; 605 int ret;
@@ -599,19 +609,19 @@ int exofs_sbi_write(struct exofs_io_state *ios)
599 return ret; 609 return ret;
600 610
601 for (i = 0; i < ios->numdevs; i += ios->layout->mirrors_p1) { 611 for (i = 0; i < ios->numdevs; i += ios->layout->mirrors_p1) {
602 ret = _sbi_write_mirror(ios, i); 612 ret = _write_mirror(ios, i);
603 if (unlikely(ret)) 613 if (unlikely(ret))
604 return ret; 614 return ret;
605 } 615 }
606 616
607 ret = exofs_io_execute(ios); 617 ret = ore_io_execute(ios);
608 return ret; 618 return ret;
609} 619}
610 620
611static int _sbi_read_mirror(struct exofs_io_state *ios, unsigned cur_comp) 621static int _read_mirror(struct ore_io_state *ios, unsigned cur_comp)
612{ 622{
613 struct osd_request *or; 623 struct osd_request *or;
614 struct exofs_per_dev_state *per_dev = &ios->per_dev[cur_comp]; 624 struct ore_per_dev_state *per_dev = &ios->per_dev[cur_comp];
615 struct osd_obj_id *obj = _ios_obj(ios, cur_comp); 625 struct osd_obj_id *obj = _ios_obj(ios, cur_comp);
616 unsigned first_dev = (unsigned)obj->id; 626 unsigned first_dev = (unsigned)obj->id;
617 627
@@ -621,7 +631,7 @@ static int _sbi_read_mirror(struct exofs_io_state *ios, unsigned cur_comp)
621 first_dev = per_dev->dev + first_dev % ios->layout->mirrors_p1; 631 first_dev = per_dev->dev + first_dev % ios->layout->mirrors_p1;
622 or = osd_start_request(_ios_od(ios, first_dev), GFP_KERNEL); 632 or = osd_start_request(_ios_od(ios, first_dev), GFP_KERNEL);
623 if (unlikely(!or)) { 633 if (unlikely(!or)) {
624 EXOFS_ERR("%s: osd_start_request failed\n", __func__); 634 ORE_ERR("%s: osd_start_request failed\n", __func__);
625 return -ENOMEM; 635 return -ENOMEM;
626 } 636 }
627 per_dev->or = or; 637 per_dev->or = or;
@@ -629,14 +639,14 @@ static int _sbi_read_mirror(struct exofs_io_state *ios, unsigned cur_comp)
629 if (ios->pages) { 639 if (ios->pages) {
630 osd_req_read(or, obj, per_dev->offset, 640 osd_req_read(or, obj, per_dev->offset,
631 per_dev->bio, per_dev->length); 641 per_dev->bio, per_dev->length);
632 EXOFS_DBGMSG("read(0x%llx) offset=0x%llx length=0x%llx" 642 ORE_DBGMSG("read(0x%llx) offset=0x%llx length=0x%llx"
633 " dev=%d\n", _LLU(obj->id), 643 " dev=%d\n", _LLU(obj->id),
634 _LLU(per_dev->offset), _LLU(per_dev->length), 644 _LLU(per_dev->offset), _LLU(per_dev->length),
635 first_dev); 645 first_dev);
636 } else if (ios->kern_buff) { 646 } else if (ios->kern_buff) {
637 int ret = osd_req_read_kern(or, obj, per_dev->offset, 647 int ret = osd_req_read_kern(or, obj, per_dev->offset,
638 ios->kern_buff, ios->length); 648 ios->kern_buff, ios->length);
639 EXOFS_DBGMSG2("read_kern(0x%llx) offset=0x%llx " 649 ORE_DBGMSG2("read_kern(0x%llx) offset=0x%llx "
640 "length=0x%llx dev=%d ret=>%d\n", 650 "length=0x%llx dev=%d ret=>%d\n",
641 _LLU(obj->id), _LLU(per_dev->offset), 651 _LLU(obj->id), _LLU(per_dev->offset),
642 _LLU(ios->length), first_dev, ret); 652 _LLU(ios->length), first_dev, ret);
@@ -644,7 +654,7 @@ static int _sbi_read_mirror(struct exofs_io_state *ios, unsigned cur_comp)
644 return ret; 654 return ret;
645 } else { 655 } else {
646 osd_req_get_attributes(or, obj); 656 osd_req_get_attributes(or, obj);
647 EXOFS_DBGMSG2("obj(0x%llx) get_attributes=%d dev=%d\n", 657 ORE_DBGMSG2("obj(0x%llx) get_attributes=%d dev=%d\n",
648 _LLU(obj->id), 658 _LLU(obj->id),
649 ios->in_attr_len, first_dev); 659 ios->in_attr_len, first_dev);
650 } 660 }
@@ -657,7 +667,7 @@ static int _sbi_read_mirror(struct exofs_io_state *ios, unsigned cur_comp)
657 return 0; 667 return 0;
658} 668}
659 669
660int exofs_sbi_read(struct exofs_io_state *ios) 670int ore_read(struct ore_io_state *ios)
661{ 671{
662 int i; 672 int i;
663 int ret; 673 int ret;
@@ -667,16 +677,16 @@ int exofs_sbi_read(struct exofs_io_state *ios)
667 return ret; 677 return ret;
668 678
669 for (i = 0; i < ios->numdevs; i += ios->layout->mirrors_p1) { 679 for (i = 0; i < ios->numdevs; i += ios->layout->mirrors_p1) {
670 ret = _sbi_read_mirror(ios, i); 680 ret = _read_mirror(ios, i);
671 if (unlikely(ret)) 681 if (unlikely(ret))
672 return ret; 682 return ret;
673 } 683 }
674 684
675 ret = exofs_io_execute(ios); 685 ret = ore_io_execute(ios);
676 return ret; 686 return ret;
677} 687}
678 688
679int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr) 689int extract_attr_from_ios(struct ore_io_state *ios, struct osd_attr *attr)
680{ 690{
681 struct osd_attr cur_attr = {.attr_page = 0}; /* start with zeros */ 691 struct osd_attr cur_attr = {.attr_page = 0}; /* start with zeros */
682 void *iter = NULL; 692 void *iter = NULL;
@@ -697,18 +707,18 @@ int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr)
697 return -EIO; 707 return -EIO;
698} 708}
699 709
700static int _truncate_mirrors(struct exofs_io_state *ios, unsigned cur_comp, 710static int _truncate_mirrors(struct ore_io_state *ios, unsigned cur_comp,
701 struct osd_attr *attr) 711 struct osd_attr *attr)
702{ 712{
703 int last_comp = cur_comp + ios->layout->mirrors_p1; 713 int last_comp = cur_comp + ios->layout->mirrors_p1;
704 714
705 for (; cur_comp < last_comp; ++cur_comp) { 715 for (; cur_comp < last_comp; ++cur_comp) {
706 struct exofs_per_dev_state *per_dev = &ios->per_dev[cur_comp]; 716 struct ore_per_dev_state *per_dev = &ios->per_dev[cur_comp];
707 struct osd_request *or; 717 struct osd_request *or;
708 718
709 or = osd_start_request(_ios_od(ios, cur_comp), GFP_KERNEL); 719 or = osd_start_request(_ios_od(ios, cur_comp), GFP_KERNEL);
710 if (unlikely(!or)) { 720 if (unlikely(!or)) {
711 EXOFS_ERR("%s: osd_start_request failed\n", __func__); 721 ORE_ERR("%s: osd_start_request failed\n", __func__);
712 return -ENOMEM; 722 return -ENOMEM;
713 } 723 }
714 per_dev->or = or; 724 per_dev->or = or;
@@ -730,7 +740,7 @@ struct _trunc_info {
730 unsigned max_devs; 740 unsigned max_devs;
731}; 741};
732 742
733void _calc_trunk_info(struct exofs_layout *layout, u64 file_offset, 743void _calc_trunk_info(struct ore_layout *layout, u64 file_offset,
734 struct _trunc_info *ti) 744 struct _trunc_info *ti)
735{ 745{
736 unsigned stripe_unit = layout->stripe_unit; 746 unsigned stripe_unit = layout->stripe_unit;
@@ -745,10 +755,10 @@ void _calc_trunk_info(struct exofs_layout *layout, u64 file_offset,
745 ti->max_devs = layout->group_width * layout->group_count; 755 ti->max_devs = layout->group_width * layout->group_count;
746} 756}
747 757
748int exofs_truncate(struct exofs_layout *layout, struct exofs_components *comps, 758int ore_truncate(struct ore_layout *layout, struct ore_components *comps,
749 u64 size) 759 u64 size)
750{ 760{
751 struct exofs_io_state *ios; 761 struct ore_io_state *ios;
752 struct exofs_trunc_attr { 762 struct exofs_trunc_attr {
753 struct osd_attr attr; 763 struct osd_attr attr;
754 __be64 newsize; 764 __be64 newsize;
@@ -756,7 +766,7 @@ int exofs_truncate(struct exofs_layout *layout, struct exofs_components *comps,
756 struct _trunc_info ti; 766 struct _trunc_info ti;
757 int i, ret; 767 int i, ret;
758 768
759 ret = exofs_get_io_state(layout, comps, &ios); 769 ret = ore_get_io_state(layout, comps, &ios);
760 if (unlikely(ret)) 770 if (unlikely(ret))
761 return ret; 771 return ret;
762 772
@@ -791,18 +801,18 @@ int exofs_truncate(struct exofs_layout *layout, struct exofs_components *comps,
791 size_attr->attr = g_attr_logical_length; 801 size_attr->attr = g_attr_logical_length;
792 size_attr->attr.val_ptr = &size_attr->newsize; 802 size_attr->attr.val_ptr = &size_attr->newsize;
793 803
794 EXOFS_DBGMSG("trunc(0x%llx) obj_offset=0x%llx dev=%d\n", 804 ORE_DBGMSG("trunc(0x%llx) obj_offset=0x%llx dev=%d\n",
795 _LLU(comps->comps->obj.id), _LLU(obj_size), i); 805 _LLU(comps->comps->obj.id), _LLU(obj_size), i);
796 ret = _truncate_mirrors(ios, i * ios->layout->mirrors_p1, 806 ret = _truncate_mirrors(ios, i * ios->layout->mirrors_p1,
797 &size_attr->attr); 807 &size_attr->attr);
798 if (unlikely(ret)) 808 if (unlikely(ret))
799 goto out; 809 goto out;
800 } 810 }
801 ret = exofs_io_execute(ios); 811 ret = ore_io_execute(ios);
802 812
803out: 813out:
804 kfree(size_attrs); 814 kfree(size_attrs);
805 exofs_put_io_state(ios); 815 ore_put_io_state(ios);
806 return ret; 816 return ret;
807} 817}
808 818
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 4d6877967c87..274894053b02 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -263,19 +263,19 @@ static int __sbi_read_stats(struct exofs_sb_info *sbi)
263 struct osd_attr attrs[] = { 263 struct osd_attr attrs[] = {
264 [0] = g_attr_sb_stats, 264 [0] = g_attr_sb_stats,
265 }; 265 };
266 struct exofs_io_state *ios; 266 struct ore_io_state *ios;
267 int ret; 267 int ret;
268 268
269 ret = exofs_get_io_state(&sbi->layout, &sbi->comps, &ios); 269 ret = ore_get_io_state(&sbi->layout, &sbi->comps, &ios);
270 if (unlikely(ret)) { 270 if (unlikely(ret)) {
271 EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); 271 EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
272 return ret; 272 return ret;
273 } 273 }
274 274
275 ios->in_attr = attrs; 275 ios->in_attr = attrs;
276 ios->in_attr_len = ARRAY_SIZE(attrs); 276 ios->in_attr_len = ARRAY_SIZE(attrs);
277 277
278 ret = exofs_sbi_read(ios); 278 ret = ore_read(ios);
279 if (unlikely(ret)) { 279 if (unlikely(ret)) {
280 EXOFS_ERR("Error reading super_block stats => %d\n", ret); 280 EXOFS_ERR("Error reading super_block stats => %d\n", ret);
281 goto out; 281 goto out;
@@ -302,13 +302,13 @@ static int __sbi_read_stats(struct exofs_sb_info *sbi)
302 } 302 }
303 303
304out: 304out:
305 exofs_put_io_state(ios); 305 ore_put_io_state(ios);
306 return ret; 306 return ret;
307} 307}
308 308
309static void stats_done(struct exofs_io_state *ios, void *p) 309static void stats_done(struct ore_io_state *ios, void *p)
310{ 310{
311 exofs_put_io_state(ios); 311 ore_put_io_state(ios);
312 /* Good thanks nothing to do anymore */ 312 /* Good thanks nothing to do anymore */
313} 313}
314 314
@@ -318,12 +318,12 @@ int exofs_sbi_write_stats(struct exofs_sb_info *sbi)
318 struct osd_attr attrs[] = { 318 struct osd_attr attrs[] = {
319 [0] = g_attr_sb_stats, 319 [0] = g_attr_sb_stats,
320 }; 320 };
321 struct exofs_io_state *ios; 321 struct ore_io_state *ios;
322 int ret; 322 int ret;
323 323
324 ret = exofs_get_io_state(&sbi->layout, &sbi->comps, &ios); 324 ret = ore_get_io_state(&sbi->layout, &sbi->comps, &ios);
325 if (unlikely(ret)) { 325 if (unlikely(ret)) {
326 EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); 326 EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
327 return ret; 327 return ret;
328 } 328 }
329 329
@@ -337,10 +337,10 @@ int exofs_sbi_write_stats(struct exofs_sb_info *sbi)
337 ios->out_attr = attrs; 337 ios->out_attr = attrs;
338 ios->out_attr_len = ARRAY_SIZE(attrs); 338 ios->out_attr_len = ARRAY_SIZE(attrs);
339 339
340 ret = exofs_sbi_write(ios); 340 ret = ore_write(ios);
341 if (unlikely(ret)) { 341 if (unlikely(ret)) {
342 EXOFS_ERR("%s: exofs_sbi_write failed.\n", __func__); 342 EXOFS_ERR("%s: ore_write failed.\n", __func__);
343 exofs_put_io_state(ios); 343 ore_put_io_state(ios);
344 } 344 }
345 345
346 return ret; 346 return ret;
@@ -359,9 +359,9 @@ int exofs_sync_fs(struct super_block *sb, int wait)
359{ 359{
360 struct exofs_sb_info *sbi; 360 struct exofs_sb_info *sbi;
361 struct exofs_fscb *fscb; 361 struct exofs_fscb *fscb;
362 struct exofs_comp one_comp; 362 struct ore_comp one_comp;
363 struct exofs_components comps; 363 struct ore_components comps;
364 struct exofs_io_state *ios; 364 struct ore_io_state *ios;
365 int ret = -ENOMEM; 365 int ret = -ENOMEM;
366 366
367 fscb = kmalloc(sizeof(*fscb), GFP_KERNEL); 367 fscb = kmalloc(sizeof(*fscb), GFP_KERNEL);
@@ -380,7 +380,7 @@ int exofs_sync_fs(struct super_block *sb, int wait)
380 380
381 exofs_init_comps(&comps, &one_comp, sbi, EXOFS_SUPER_ID); 381 exofs_init_comps(&comps, &one_comp, sbi, EXOFS_SUPER_ID);
382 382
383 ret = exofs_get_io_state(&sbi->layout, &comps, &ios); 383 ret = ore_get_io_state(&sbi->layout, &comps, &ios);
384 if (unlikely(ret)) 384 if (unlikely(ret))
385 goto out; 385 goto out;
386 386
@@ -397,9 +397,9 @@ int exofs_sync_fs(struct super_block *sb, int wait)
397 ios->offset = 0; 397 ios->offset = 0;
398 ios->kern_buff = fscb; 398 ios->kern_buff = fscb;
399 399
400 ret = exofs_sbi_write(ios); 400 ret = ore_write(ios);
401 if (unlikely(ret)) 401 if (unlikely(ret))
402 EXOFS_ERR("%s: exofs_sbi_write failed.\n", __func__); 402 EXOFS_ERR("%s: ore_write failed.\n", __func__);
403 else 403 else
404 sb->s_dirt = 0; 404 sb->s_dirt = 0;
405 405
@@ -407,7 +407,7 @@ int exofs_sync_fs(struct super_block *sb, int wait)
407 unlock_super(sb); 407 unlock_super(sb);
408out: 408out:
409 EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret); 409 EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret);
410 exofs_put_io_state(ios); 410 ore_put_io_state(ios);
411 kfree(fscb); 411 kfree(fscb);
412 return ret; 412 return ret;
413} 413}
@@ -562,7 +562,7 @@ static int _read_and_match_data_map(struct exofs_sb_info *sbi, unsigned numdevs,
562 return 0; 562 return 0;
563} 563}
564 564
565static unsigned __ra_pages(struct exofs_layout *layout) 565static unsigned __ra_pages(struct ore_layout *layout)
566{ 566{
567 const unsigned _MIN_RA = 32; /* min 128K read-ahead */ 567 const unsigned _MIN_RA = 32; /* min 128K read-ahead */
568 unsigned ra_pages = layout->group_width * layout->stripe_unit / 568 unsigned ra_pages = layout->group_width * layout->stripe_unit /
@@ -609,7 +609,7 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info *sbi,
609 struct osd_dev *fscb_od, 609 struct osd_dev *fscb_od,
610 unsigned table_count) 610 unsigned table_count)
611{ 611{
612 struct exofs_comp comp; 612 struct ore_comp comp;
613 struct exofs_device_table *dt; 613 struct exofs_device_table *dt;
614 unsigned table_bytes = table_count * sizeof(dt->dt_dev_table[0]) + 614 unsigned table_bytes = table_count * sizeof(dt->dt_dev_table[0]) +
615 sizeof(*dt); 615 sizeof(*dt);
@@ -747,7 +747,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
747 struct exofs_sb_info *sbi; /*extended info */ 747 struct exofs_sb_info *sbi; /*extended info */
748 struct osd_dev *od; /* Master device */ 748 struct osd_dev *od; /* Master device */
749 struct exofs_fscb fscb; /*on-disk superblock info */ 749 struct exofs_fscb fscb; /*on-disk superblock info */
750 struct exofs_comp comp; 750 struct ore_comp comp;
751 unsigned table_count; 751 unsigned table_count;
752 int ret; 752 int ret;
753 753
@@ -913,7 +913,7 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
913{ 913{
914 struct super_block *sb = dentry->d_sb; 914 struct super_block *sb = dentry->d_sb;
915 struct exofs_sb_info *sbi = sb->s_fs_info; 915 struct exofs_sb_info *sbi = sb->s_fs_info;
916 struct exofs_io_state *ios; 916 struct ore_io_state *ios;
917 struct osd_attr attrs[] = { 917 struct osd_attr attrs[] = {
918 ATTR_DEF(OSD_APAGE_PARTITION_QUOTAS, 918 ATTR_DEF(OSD_APAGE_PARTITION_QUOTAS,
919 OSD_ATTR_PQ_CAPACITY_QUOTA, sizeof(__be64)), 919 OSD_ATTR_PQ_CAPACITY_QUOTA, sizeof(__be64)),
@@ -924,16 +924,16 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
924 uint64_t used = ULLONG_MAX; 924 uint64_t used = ULLONG_MAX;
925 int ret; 925 int ret;
926 926
927 ret = exofs_get_io_state(&sbi->layout, &sbi->comps, &ios); 927 ret = ore_get_io_state(&sbi->layout, &sbi->comps, &ios);
928 if (ret) { 928 if (ret) {
929 EXOFS_DBGMSG("exofs_get_io_state failed.\n"); 929 EXOFS_DBGMSG("ore_get_io_state failed.\n");
930 return ret; 930 return ret;
931 } 931 }
932 932
933 ios->in_attr = attrs; 933 ios->in_attr = attrs;
934 ios->in_attr_len = ARRAY_SIZE(attrs); 934 ios->in_attr_len = ARRAY_SIZE(attrs);
935 935
936 ret = exofs_sbi_read(ios); 936 ret = ore_read(ios);
937 if (unlikely(ret)) 937 if (unlikely(ret))
938 goto out; 938 goto out;
939 939
@@ -962,7 +962,7 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
962 buf->f_namelen = EXOFS_NAME_LEN; 962 buf->f_namelen = EXOFS_NAME_LEN;
963 963
964out: 964out:
965 exofs_put_io_state(ios); 965 ore_put_io_state(ios);
966 return ret; 966 return ret;
967} 967}
968 968
diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h
new file mode 100644
index 000000000000..c5c5e008e6de
--- /dev/null
+++ b/include/scsi/osd_ore.h
@@ -0,0 +1,125 @@
1/*
2 * Copyright (C) 2011
3 * Boaz Harrosh <bharrosh@panasas.com>
4 *
5 * Public Declarations of the ORE API
6 *
7 * This file is part of the ORE (Object Raid Engine) library.
8 *
9 * ORE is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation. (GPL v2)
12 *
13 * ORE is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with the ORE; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22#ifndef __ORE_H__
23#define __ORE_H__
24
25#include <scsi/osd_initiator.h>
26#include <scsi/osd_attributes.h>
27#include <scsi/osd_sec.h>
28#include <linux/pnfs_osd_xdr.h>
29
30struct ore_comp {
31 struct osd_obj_id obj;
32 u8 cred[OSD_CAP_LEN];
33};
34
35struct ore_layout {
36 /* Our way of looking at the data_map */
37 unsigned stripe_unit;
38 unsigned mirrors_p1;
39
40 unsigned group_width;
41 u64 group_depth;
42 unsigned group_count;
43};
44
45struct ore_components {
46 unsigned numdevs; /* Num of devices in array */
47 /* If @single_comp == EC_SINGLE_COMP, @comps points to a single
48 * component. else there are @numdevs components
49 */
50 enum EC_COMP_USAGE {
51 EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff
52 } single_comp;
53 struct ore_comp *comps;
54 struct osd_dev **ods; /* osd_dev array */
55};
56
57struct ore_io_state;
58typedef void (*ore_io_done_fn)(struct ore_io_state *ios, void *private);
59
60struct ore_io_state {
61 struct kref kref;
62
63 void *private;
64 ore_io_done_fn done;
65
66 struct ore_layout *layout;
67 struct ore_components *comps;
68
69 /* Global read/write IO*/
70 loff_t offset;
71 unsigned long length;
72 void *kern_buff;
73
74 struct page **pages;
75 unsigned nr_pages;
76 unsigned pgbase;
77 unsigned pages_consumed;
78
79 /* Attributes */
80 unsigned in_attr_len;
81 struct osd_attr *in_attr;
82 unsigned out_attr_len;
83 struct osd_attr *out_attr;
84
85 bool reading;
86
87 /* Variable array of size numdevs */
88 unsigned numdevs;
89 struct ore_per_dev_state {
90 struct osd_request *or;
91 struct bio *bio;
92 loff_t offset;
93 unsigned length;
94 unsigned dev;
95 } per_dev[];
96};
97
98static inline unsigned ore_io_state_size(unsigned numdevs)
99{
100 return sizeof(struct ore_io_state) +
101 sizeof(struct ore_per_dev_state) * numdevs;
102}
103
104/* ore.c */
105int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps,
106 bool is_reading, u64 offset, u64 length,
107 struct ore_io_state **ios);
108int ore_get_io_state(struct ore_layout *layout, struct ore_components *comps,
109 struct ore_io_state **ios);
110void ore_put_io_state(struct ore_io_state *ios);
111
112int ore_check_io(struct ore_io_state *ios, u64 *resid);
113
114int ore_create(struct ore_io_state *ios);
115int ore_remove(struct ore_io_state *ios);
116int ore_write(struct ore_io_state *ios);
117int ore_read(struct ore_io_state *ios);
118int ore_truncate(struct ore_layout *layout, struct ore_components *comps,
119 u64 size);
120
121int extract_attr_from_ios(struct ore_io_state *ios, struct osd_attr *attr);
122
123extern const struct osd_attr g_attr_logical_length;
124
125#endif