Changeset 8160e4c0 in mainline for uspace/srv/bd/hr/raid5.c
- Timestamp:
- 2024-11-27T13:08:27Z (8 months ago)
- Children:
- 40bf2c6
- Parents:
- bf0a791
- git-author:
- Miroslav Cimerman <mc@…> (2024-11-27 12:58:10)
- git-committer:
- Miroslav Cimerman <mc@…> (2024-11-27 13:08:27)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/raid5.c
rbf0a791 r8160e4c0 329 329 330 330 /* read all other extents in the stripe */ 331 memset(xorbuf, 0, len);331 bool first = true; 332 332 for (i = 0; i < vol->dev_no; i++) { 333 if (i == bad) {333 if (i == bad) 334 334 continue; 335 336 if (first) { 337 rc = block_read_direct(vol->extents[i].svc_id, block, 338 cnt, xorbuf); 339 if (rc != EOK) 340 goto end; 341 342 first = false; 335 343 } else { 336 344 rc = block_read_direct(vol->extents[i].svc_id, block, … … 391 399 * write new parity 392 400 */ 393 memset(xorbuf, 0, len);401 bool first = true; 394 402 for (i = 1; i < vol->dev_no; i++) { 395 403 if (i == (size_t)bad) 396 404 continue; 405 if (first) { 406 rc = block_read_direct(vol->extents[i].svc_id, 407 ba, cnt, xorbuf); 408 if (rc != EOK) 409 goto end; 410 411 first = false; 397 412 } else { 398 413 rc = block_read_direct(vol->extents[i].svc_id, … … 461 476 } 462 477 463 memset(xorbuf, 0, len);478 bool first = true; 464 479 for (i = 0; i < vol->dev_no; i++) { 465 480 if (i == p_extent) 466 481 continue; 467 if (i == extent) { 468 xor(xorbuf, data, len); 482 483 if (first) { 484 if (i == extent) { 485 memcpy(xorbuf, data, len); 486 } else { 487 rc = block_read_direct(vol->extents[i].svc_id, 488 block, cnt, xorbuf); 489 if (rc != EOK) 490 goto end; 491 } 492 493 first = false; 469 494 } else { 470 rc = block_read_direct(vol->extents[i].svc_id, 471 block, cnt, buf); 472 if (rc != EOK) 473 goto end; 474 xor(xorbuf, buf, len); 495 if (i == extent) { 496 xor(xorbuf, data, len); 497 } else { 498 rc = block_read_direct(vol->extents[i].svc_id, 499 block, cnt, buf); 500 if (rc != EOK) 501 goto end; 502 503 xor(xorbuf, buf, len); 504 } 475 505 } 476 506 } … … 690 720 if (i == bad) 691 721 continue; 692 rc = block_read_direct(vol->extents[i].svc_id, ba, cnt, 693 buf); 722 if (first) 723 rc = block_read_direct(vol->extents[i].svc_id, 724 ba, cnt, xorbuf); 725 else 726 rc = block_read_direct(vol->extents[i].svc_id, 727 ba, cnt, buf); 694 728 if (rc != EOK) { 695 729 hr_raid5_handle_extent_error(vol, i, rc); … … 700 734 } 701 735 702 if ( first)703 memcpy(xorbuf, buf, cnt * vol->bsize);736 if (!first) 737 xor(xorbuf, buf, cnt * vol->bsize); 704 738 else 705 xor(xorbuf, buf, cnt * vol->bsize); 706 707 first = false; 739 first = false; 708 740 } 709 741
Note:
See TracChangeset
for help on using the changeset viewer.