diff options
Diffstat (limited to 'fs/exofs/ios.c')
| -rw-r--r-- | fs/exofs/ios.c | 22 |
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 | ||
| 394 | static int _prepare_one_group(struct exofs_io_state *ios, u64 length, | 394 | static 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 | ||
| 504 | out: | 496 | out: |
