| @@ -305,8 +305,6 @@ int exofs_check_io(struct exofs_io_state *ios, u64 *resid) · 304 unmodified lines |
| 305 | 305 | struct _striping_info { |
| 306 | 306 | u64 obj_offset; |
| 307 | 307 | u64 group_length; |
| 308 | | − u64 total_group_length; |
| 309 | | − u64 Major; |
| 310 | 308 | unsigned dev; |
| 311 | 309 | unsigned unit_off; |
| 312 | 310 | }; |
| @@ -343,8 +341,6 @@ static void _calc_stripe_info(struct exofs_io_state *ios, u64 file_offset, · 30 unmodified lines |
| 343 | 341 | (M * group_depth * stripe_unit); |
| 344 | 342 | |
| 345 | 343 | si->group_length = T - H; |
| 346 | | − si->total_group_length = T; |
| 347 | | − si->Major = M; |
| 348 | 344 | } |
| 349 | 345 | |
| 350 | 346 | static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg, |
| @@ -392,20 +388,19 @@ static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg, · 41 unmodified lines |
| 392 | 388 | } |
| 393 | 389 | |
| 394 | 390 | static int _prepare_one_group(struct exofs_io_state *ios, u64 length, |
| 395 | | − struct _striping_info *si, unsigned first_comp) |
| 391 | + struct _striping_info *si) |
| 396 | 392 | { |
| 397 | 393 | unsigned stripe_unit = ios->layout->stripe_unit; |
| 398 | 394 | unsigned mirrors_p1 = ios->layout->mirrors_p1; |
| 399 | 395 | unsigned devs_in_group = ios->layout->group_width * mirrors_p1; |
| 400 | 396 | unsigned dev = si->dev; |
| 401 | 397 | unsigned first_dev = dev - (dev % devs_in_group); |
| 402 | | − unsigned comp = first_comp + (dev - first_dev); |
| 403 | 398 | unsigned max_comp = ios->numdevs ? ios->numdevs - mirrors_p1 : 0; |
| 404 | 399 | unsigned cur_pg = ios->pages_consumed; |
| 405 | 400 | int ret = 0; |
| 406 | 401 | |
| 407 | 402 | while (length) { |
| 408 | | − struct exofs_per_dev_state *per_dev = &ios->per_dev[comp]; |
| 403 | + struct exofs_per_dev_state *per_dev = &ios->per_dev[dev]; |
| 409 | 404 | unsigned cur_len, page_off = 0; |
| 410 | 405 | |
| 411 | 406 | if (!per_dev->length) { |
| @@ -424,11 +419,8 @@ static int _prepare_one_group(struct exofs_io_state *ios, u64 length, · 12 unmodified lines |
| 424 | 419 | cur_len = stripe_unit; |
| 425 | 420 | } |
| 426 | 421 | |
| 427 | | − if (max_comp < comp) |
| 428 | | − max_comp = comp; |
| 429 | | − |
| 430 | | − dev += mirrors_p1; |
| 431 | | − dev = (dev % devs_in_group) + first_dev; |
| 422 | + if (max_comp < dev) |
| 423 | + max_comp = dev; |
| 432 | 424 | } else { |
| 433 | 425 | cur_len = stripe_unit; |
| 434 | 426 | } |
| @@ -440,8 +432,8 @@ static int _prepare_one_group(struct exofs_io_state *ios, u64 length, · 5 unmodified lines |
| 440 | 432 | if (unlikely(ret)) |
| 441 | 433 | goto out; |
| 442 | 434 | |
| 443 | | − comp += mirrors_p1; |
| 444 | | − comp = (comp % devs_in_group) + first_comp; |
| 435 | + dev += mirrors_p1; |
| 436 | + dev = (dev % devs_in_group) + first_dev; |
| 445 | 437 | |
| 446 | 438 | length -= cur_len; |
| 447 | 439 | } |
| @@ -454,18 +446,15 @@ out: · 6 unmodified lines |
| 454 | 446 | static int _prepare_for_striping(struct exofs_io_state *ios) |
| 455 | 447 | { |
| 456 | 448 | u64 length = ios->length; |
| 449 | + u64 offset = ios->offset; |
| 457 | 450 | struct _striping_info si; |
| 458 | | − unsigned devs_in_group = ios->layout->group_width * |
| 459 | | − ios->layout->mirrors_p1; |
| 460 | | − unsigned first_comp = 0; |
| 461 | 451 | int ret = 0; |
| 462 | 452 | |
| 463 | | − _calc_stripe_info(ios, ios->offset, &si); |
| 464 | | − |
| 465 | 453 | if (!ios->pages) { |
| 466 | 454 | if (ios->kern_buff) { |
| 467 | 455 | struct exofs_per_dev_state *per_dev = &ios->per_dev[0]; |
| 468 | 456 | |
| 457 | + _calc_stripe_info(ios, ios->offset, &si); |
| 469 | 458 | per_dev->offset = si.obj_offset; |
| 470 | 459 | per_dev->dev = si.dev; |
| 471 | 460 | |
| @@ -479,26 +468,17 @@ static int _prepare_for_striping(struct exofs_io_state *ios) · 7 unmodified lines |
| 479 | 468 | } |
| 480 | 469 | |
| 481 | 470 | while (length) { |
| 471 | + _calc_stripe_info(ios, offset, &si); |
| 472 | + |
| 482 | 473 | if (length < si.group_length) |
| 483 | 474 | si.group_length = length; |
| 484 | 475 | |
| 485 | | − ret = _prepare_one_group(ios, si.group_length, &si, first_comp); |
| 476 | + ret = _prepare_one_group(ios, si.group_length, &si); |
| 486 | 477 | if (unlikely(ret)) |
| 487 | 478 | goto out; |
| 488 | 479 | |
| 480 | + offset += si.group_length; |
| 489 | 481 | length -= si.group_length; |
| 490 | | − |
| 491 | | − si.group_length = si.total_group_length; |
| 492 | | − si.unit_off = 0; |
| 493 | | − ++si.Major; |
| 494 | | − si.obj_offset = si.Major * ios->layout->stripe_unit * |
| 495 | | − ios->layout->group_depth; |
| 496 | | − |
| 497 | | − si.dev = (si.dev - (si.dev % devs_in_group)) + devs_in_group; |
| 498 | | − si.dev %= ios->layout->s_numdevs; |
| 499 | | − |
| 500 | | − first_comp += devs_in_group; |
| 501 | | − first_comp %= ios->layout->s_numdevs; |
| 502 | 482 | } |
| 503 | 483 | |
| 504 | 484 | out: |