aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2010-07-29 10:08:13 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2010-08-04 06:17:57 -0400
commit6e31609b1dcd595d7e4676ce62323532b29e8999 (patch)
tree1d43b7e9affee41df43db3657b50058da5645732 /fs
parentb2848349296f3428850eb34c3a52d586f48d4b04 (diff)
exofs: Remove useless optimization
We used to compact all used devices in an IO to the beginning of the device array in an io_state. And keep a last device used so in later loops we don't iterate on all device slots. This does not prevent us from checking if slots are empty since in reads we only read from a single mirror and jump to the next mirror-set. This optimization is marginal, and needlessly complicates the code. Specially when we will later want to support raid/456 with same abstract code. So remove the distinction between "dev" and "comp". Only "dev" is used both as the device used and as the index (component) in the device array. [Note that now the io_state->dev member is redundant but I keep it because I might want to optimize by only IOing a single group, though keeping a group_width*mirrors devices in io_state, we now keep num-devices in each io_state] Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/exofs/ios.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/fs/exofs/ios.c b/fs/exofs/ios.c
index 4337cad7777b..5bb47373c7e0 100644
--- a/fs/exofs/ios.c
+++ b/fs/exofs/ios.c
@@ -392,20 +392,19 @@ static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg,
392} 392}
393 393
394static int _prepare_one_group(struct exofs_io_state *ios, u64 length, 394static int _prepare_one_group(struct exofs_io_state *ios, u64 length,
395 struct _striping_info *si, unsigned first_comp) 395 struct _striping_info *si)
396{ 396{
397 unsigned stripe_unit = ios->layout->stripe_unit; 397 unsigned stripe_unit = ios->layout->stripe_unit;
398 unsigned mirrors_p1 = ios->layout->mirrors_p1; 398 unsigned mirrors_p1 = ios->layout->mirrors_p1;
399 unsigned devs_in_group = ios->layout->group_width * mirrors_p1; 399 unsigned devs_in_group = ios->layout->group_width * mirrors_p1;
400 unsigned dev = si->dev; 400 unsigned dev = si->dev;
401 unsigned first_dev = dev - (dev % devs_in_group); 401 unsigned first_dev = dev - (dev % devs_in_group);
402 unsigned comp = first_comp + (dev - first_dev);
403 unsigned max_comp = ios->numdevs ? ios->numdevs - mirrors_p1 : 0; 402 unsigned max_comp = ios->numdevs ? ios->numdevs - mirrors_p1 : 0;
404 unsigned cur_pg = ios->pages_consumed; 403 unsigned cur_pg = ios->pages_consumed;
405 int ret = 0; 404 int ret = 0;
406 405
407 while (length) { 406 while (length) {
408 struct exofs_per_dev_state *per_dev = &ios->per_dev[comp]; 407 struct exofs_per_dev_state *per_dev = &ios->per_dev[dev];
409 unsigned cur_len, page_off = 0; 408 unsigned cur_len, page_off = 0;
410 409
411 if (!per_dev->length) { 410 if (!per_dev->length) {
@@ -424,11 +423,8 @@ static int _prepare_one_group(struct exofs_io_state *ios, u64 length,
424 cur_len = stripe_unit; 423 cur_len = stripe_unit;
425 } 424 }
426 425
427 if (max_comp < comp) 426 if (max_comp < dev)
428 max_comp = comp; 427 max_comp = dev;
429
430 dev += mirrors_p1;
431 dev = (dev % devs_in_group) + first_dev;
432 } else { 428 } else {
433 cur_len = stripe_unit; 429 cur_len = stripe_unit;
434 } 430 }
@@ -440,8 +436,8 @@ static int _prepare_one_group(struct exofs_io_state *ios, u64 length,
440 if (unlikely(ret)) 436 if (unlikely(ret))
441 goto out; 437 goto out;
442 438
443 comp += mirrors_p1; 439 dev += mirrors_p1;
444 comp = (comp % devs_in_group) + first_comp; 440 dev = (dev % devs_in_group) + first_dev;
445 441
446 length -= cur_len; 442 length -= cur_len;
447 } 443 }
@@ -457,7 +453,6 @@ static int _prepare_for_striping(struct exofs_io_state *ios)
457 struct _striping_info si; 453 struct _striping_info si;
458 unsigned devs_in_group = ios->layout->group_width * 454 unsigned devs_in_group = ios->layout->group_width *
459 ios->layout->mirrors_p1; 455 ios->layout->mirrors_p1;
460 unsigned first_comp = 0;
461 int ret = 0; 456 int ret = 0;
462 457
463 _calc_stripe_info(ios, ios->offset, &si); 458 _calc_stripe_info(ios, ios->offset, &si);
@@ -482,7 +477,7 @@ static int _prepare_for_striping(struct exofs_io_state *ios)
482 if (length < si.group_length) 477 if (length < si.group_length)
483 si.group_length = length; 478 si.group_length = length;
484 479
485 ret = _prepare_one_group(ios, si.group_length, &si, first_comp); 480 ret = _prepare_one_group(ios, si.group_length, &si);
486 if (unlikely(ret)) 481 if (unlikely(ret))
487 goto out; 482 goto out;
488 483
@@ -496,9 +491,6 @@ static int _prepare_for_striping(struct exofs_io_state *ios)
496 491
497 si.dev = (si.dev - (si.dev % devs_in_group)) + devs_in_group; 492 si.dev = (si.dev - (si.dev % devs_in_group)) + devs_in_group;
498 si.dev %= ios->layout->s_numdevs; 493 si.dev %= ios->layout->s_numdevs;
499
500 first_comp += devs_in_group;
501 first_comp %= ios->layout->s_numdevs;
502 } 494 }
503 495
504out: 496out: