aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/ios.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exofs/ios.c')
-rw-r--r--fs/exofs/ios.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/fs/exofs/ios.c b/fs/exofs/ios.c
index 439c5d097b27..83e54a77b992 100644
--- a/fs/exofs/ios.c
+++ b/fs/exofs/ios.c
@@ -67,23 +67,24 @@ out:
67 return ret; 67 return ret;
68} 68}
69 69
70int exofs_get_io_state(struct exofs_sb_info *sbi, struct exofs_io_state** pios) 70int exofs_get_io_state(struct exofs_layout *layout,
71 struct exofs_io_state **pios)
71{ 72{
72 struct exofs_io_state *ios; 73 struct exofs_io_state *ios;
73 74
74 /*TODO: Maybe use kmem_cach per sbi of size 75 /*TODO: Maybe use kmem_cach per sbi of size
75 * exofs_io_state_size(sbi->s_numdevs) 76 * exofs_io_state_size(layout->s_numdevs)
76 */ 77 */
77 ios = kzalloc(exofs_io_state_size(sbi->s_numdevs), GFP_KERNEL); 78 ios = kzalloc(exofs_io_state_size(layout->s_numdevs), GFP_KERNEL);
78 if (unlikely(!ios)) { 79 if (unlikely(!ios)) {
79 EXOFS_DBGMSG("Faild kzalloc bytes=%d\n", 80 EXOFS_DBGMSG("Faild kzalloc bytes=%d\n",
80 exofs_io_state_size(sbi->s_numdevs)); 81 exofs_io_state_size(layout->s_numdevs));
81 *pios = NULL; 82 *pios = NULL;
82 return -ENOMEM; 83 return -ENOMEM;
83 } 84 }
84 85
85 ios->sbi = sbi; 86 ios->layout = layout;
86 ios->obj.partition = sbi->s_pid; 87 ios->obj.partition = layout->s_pid;
87 *pios = ios; 88 *pios = ios;
88 return 0; 89 return 0;
89} 90}
@@ -238,10 +239,10 @@ int exofs_sbi_create(struct exofs_io_state *ios)
238{ 239{
239 int i, ret; 240 int i, ret;
240 241
241 for (i = 0; i < ios->sbi->s_numdevs; i++) { 242 for (i = 0; i < ios->layout->s_numdevs; i++) {
242 struct osd_request *or; 243 struct osd_request *or;
243 244
244 or = osd_start_request(ios->sbi->s_ods[i], GFP_KERNEL); 245 or = osd_start_request(ios->layout->s_ods[i], GFP_KERNEL);
245 if (unlikely(!or)) { 246 if (unlikely(!or)) {
246 EXOFS_ERR("%s: osd_start_request failed\n", __func__); 247 EXOFS_ERR("%s: osd_start_request failed\n", __func__);
247 ret = -ENOMEM; 248 ret = -ENOMEM;
@@ -262,10 +263,10 @@ int exofs_sbi_remove(struct exofs_io_state *ios)
262{ 263{
263 int i, ret; 264 int i, ret;
264 265
265 for (i = 0; i < ios->sbi->s_numdevs; i++) { 266 for (i = 0; i < ios->layout->s_numdevs; i++) {
266 struct osd_request *or; 267 struct osd_request *or;
267 268
268 or = osd_start_request(ios->sbi->s_ods[i], GFP_KERNEL); 269 or = osd_start_request(ios->layout->s_ods[i], GFP_KERNEL);
269 if (unlikely(!or)) { 270 if (unlikely(!or)) {
270 EXOFS_ERR("%s: osd_start_request failed\n", __func__); 271 EXOFS_ERR("%s: osd_start_request failed\n", __func__);
271 ret = -ENOMEM; 272 ret = -ENOMEM;
@@ -286,10 +287,10 @@ int exofs_sbi_write(struct exofs_io_state *ios)
286{ 287{
287 int i, ret; 288 int i, ret;
288 289
289 for (i = 0; i < ios->sbi->s_numdevs; i++) { 290 for (i = 0; i < ios->layout->s_numdevs; i++) {
290 struct osd_request *or; 291 struct osd_request *or;
291 292
292 or = osd_start_request(ios->sbi->s_ods[i], GFP_KERNEL); 293 or = osd_start_request(ios->layout->s_ods[i], GFP_KERNEL);
293 if (unlikely(!or)) { 294 if (unlikely(!or)) {
294 EXOFS_ERR("%s: osd_start_request failed\n", __func__); 295 EXOFS_ERR("%s: osd_start_request failed\n", __func__);
295 ret = -ENOMEM; 296 ret = -ENOMEM;
@@ -361,8 +362,9 @@ int exofs_sbi_read(struct exofs_io_state *ios)
361 struct osd_request *or; 362 struct osd_request *or;
362 unsigned first_dev = (unsigned)ios->obj.id; 363 unsigned first_dev = (unsigned)ios->obj.id;
363 364
364 first_dev %= ios->sbi->s_numdevs; 365 first_dev %= ios->layout->s_numdevs;
365 or = osd_start_request(ios->sbi->s_ods[first_dev], GFP_KERNEL); 366 or = osd_start_request(ios->layout->s_ods[first_dev],
367 GFP_KERNEL);
366 if (unlikely(!or)) { 368 if (unlikely(!or)) {
367 EXOFS_ERR("%s: osd_start_request failed\n", __func__); 369 EXOFS_ERR("%s: osd_start_request failed\n", __func__);
368 ret = -ENOMEM; 370 ret = -ENOMEM;
@@ -438,7 +440,7 @@ int exofs_oi_truncate(struct exofs_i_info *oi, u64 size)
438 __be64 newsize; 440 __be64 newsize;
439 int i, ret; 441 int i, ret;
440 442
441 if (exofs_get_io_state(sbi, &ios)) 443 if (exofs_get_io_state(&sbi->layout, &ios))
442 return -ENOMEM; 444 return -ENOMEM;
443 445
444 ios->obj.id = exofs_oi_objno(oi); 446 ios->obj.id = exofs_oi_objno(oi);
@@ -448,10 +450,10 @@ int exofs_oi_truncate(struct exofs_i_info *oi, u64 size)
448 attr = g_attr_logical_length; 450 attr = g_attr_logical_length;
449 attr.val_ptr = &newsize; 451 attr.val_ptr = &newsize;
450 452
451 for (i = 0; i < sbi->s_numdevs; i++) { 453 for (i = 0; i < sbi->layout.s_numdevs; i++) {
452 struct osd_request *or; 454 struct osd_request *or;
453 455
454 or = osd_start_request(sbi->s_ods[i], GFP_KERNEL); 456 or = osd_start_request(sbi->layout.s_ods[i], GFP_KERNEL);
455 if (unlikely(!or)) { 457 if (unlikely(!or)) {
456 EXOFS_ERR("%s: osd_start_request failed\n", __func__); 458 EXOFS_ERR("%s: osd_start_request failed\n", __func__);
457 ret = -ENOMEM; 459 ret = -ENOMEM;