Commit 46f4d973f6874c06b7a41a3bf8f4c1717d90f97a

Authored by Boaz Harrosh
1 parent 45d3abcb1a

exofs: unindent exofs_sbi_read

The original idea was that a mirror read can be sub-divided
to multiple devices. But this has very little gain and only
at very large IOes so it's not going to be implemented soon.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>

Showing 1 changed file with 38 additions and 49 deletions Side-by-side Diff

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