aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exofs/ios.c87
1 files changed, 38 insertions, 49 deletions
diff --git a/fs/exofs/ios.c b/fs/exofs/ios.c
index 83e54a77b992..4f679317ca54 100644
--- a/fs/exofs/ios.c
+++ b/fs/exofs/ios.c
@@ -356,59 +356,48 @@ out:
356 356
357int exofs_sbi_read(struct exofs_io_state *ios) 357int exofs_sbi_read(struct exofs_io_state *ios)
358{ 358{
359 int i, ret; 359 struct osd_request *or;
360 360 struct exofs_per_dev_state *per_dev = &ios->per_dev[0];
361 for (i = 0; i < 1; i++) { 361 unsigned first_dev = (unsigned)ios->obj.id;
362 struct osd_request *or;
363 unsigned first_dev = (unsigned)ios->obj.id;
364
365 first_dev %= ios->layout->s_numdevs;
366 or = osd_start_request(ios->layout->s_ods[first_dev],
367 GFP_KERNEL);
368 if (unlikely(!or)) {
369 EXOFS_ERR("%s: osd_start_request failed\n", __func__);
370 ret = -ENOMEM;
371 goto out;
372 }
373 ios->per_dev[i].or = or;
374 ios->numdevs++;
375 362
376 if (ios->bio) { 363 first_dev %= ios->layout->s_numdevs;
377 osd_req_read(or, &ios->obj, ios->offset, ios->bio, 364 or = osd_start_request(ios->layout->s_ods[first_dev], GFP_KERNEL);
378 ios->length); 365 if (unlikely(!or)) {
379 EXOFS_DBGMSG("read(0x%llx) offset=0x%llx length=0x%llx" 366 EXOFS_ERR("%s: osd_start_request failed\n", __func__);
380 " dev=%d\n", _LLU(ios->obj.id), 367 return -ENOMEM;
381 _LLU(ios->offset), 368 }
382 _LLU(ios->length), 369 per_dev->or = or;
383 first_dev); 370 ios->numdevs++;
384 } else if (ios->kern_buff) { 371
385 osd_req_read_kern(or, &ios->obj, ios->offset, 372 if (ios->bio) {
386 ios->kern_buff, ios->length); 373 osd_req_read(or, &ios->obj, ios->offset, ios->bio, ios->length);
387 EXOFS_DBGMSG2("read_kern(0x%llx) offset=0x%llx " 374 EXOFS_DBGMSG("read(0x%llx) offset=0x%llx length=0x%llx"
388 "length=0x%llx dev=%d\n", 375 " dev=%d\n", _LLU(ios->obj.id),
389 _LLU(ios->obj.id), 376 _LLU(ios->offset), _LLU(ios->length),
390 _LLU(ios->offset), 377 first_dev);
391 _LLU(ios->length), 378 } else if (ios->kern_buff) {
392 first_dev); 379 int ret = osd_req_read_kern(or, &ios->obj, ios->offset,
393 } else { 380 ios->kern_buff, ios->length);
394 osd_req_get_attributes(or, &ios->obj); 381
395 EXOFS_DBGMSG2("obj(0x%llx) get_attributes=%d dev=%d\n", 382 EXOFS_DBGMSG2("read_kern(0x%llx) offset=0x%llx "
396 _LLU(ios->obj.id), ios->in_attr_len, 383 "length=0x%llx dev=%d ret=>%d\n",
397 first_dev); 384 _LLU(ios->obj.id), _LLU(ios->offset),
398 } 385 _LLU(ios->length), first_dev, ret);
386 if (unlikely(ret))
387 return ret;
388 } else {
389 osd_req_get_attributes(or, &ios->obj);
390 EXOFS_DBGMSG2("obj(0x%llx) get_attributes=%d dev=%d\n",
391 _LLU(ios->obj.id), ios->in_attr_len, first_dev);
392 }
399 393
400 if (ios->out_attr) 394 if (ios->out_attr)
401 osd_req_add_set_attr_list(or, ios->out_attr, 395 osd_req_add_set_attr_list(or, ios->out_attr, ios->out_attr_len);
402 ios->out_attr_len);
403 396
404 if (ios->in_attr) 397 if (ios->in_attr)
405 osd_req_add_get_attr_list(or, ios->in_attr, 398 osd_req_add_get_attr_list(or, ios->in_attr, ios->in_attr_len);
406 ios->in_attr_len);
407 }
408 ret = exofs_io_execute(ios);
409 399
410out: 400 return exofs_io_execute(ios);
411 return ret;
412} 401}
413 402
414int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr) 403int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr)