Changeset 8160e4c0 in mainline
- Timestamp:
- 2024-11-27T13:08:27Z (5 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)
- Location:
- uspace/srv/bd/hr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/raid4.c
rbf0a791 r8160e4c0 332 332 333 333 /* read all other extents in the stripe */ 334 memset(xorbuf, 0, len);334 bool first = true; 335 335 for (i = 0; i < vol->dev_no; i++) { 336 if (i == bad) {336 if (i == bad) 337 337 continue; 338 339 if (first) { 340 rc = block_read_direct(vol->extents[i].svc_id, block, 341 cnt, xorbuf); 342 if (rc != EOK) 343 goto end; 344 345 first = false; 338 346 } else { 339 347 rc = block_read_direct(vol->extents[i].svc_id, block, … … 341 349 if (rc != EOK) 342 350 goto end; 351 343 352 xor(xorbuf, buf, len); 344 353 } … … 393 402 * write new parity 394 403 */ 395 memset(xorbuf, 0, len);404 bool first = true; 396 405 for (i = 1; i < vol->dev_no; i++) { 397 406 if (i == (size_t)bad) 398 407 continue; 408 409 if (first) { 410 rc = block_read_direct(vol->extents[i].svc_id, 411 ba, cnt, xorbuf); 412 if (rc != EOK) 413 goto end; 414 415 first = false; 399 416 } else { 400 417 rc = block_read_direct(vol->extents[i].svc_id, … … 402 419 if (rc != EOK) 403 420 goto end; 421 404 422 xor(xorbuf, buf, len); 405 423 } … … 467 485 * XXX: subtract method 468 486 */ 469 memset(xorbuf, 0, len);487 bool first = true; 470 488 for (i = 1; i < vol->dev_no; i++) { 471 if (i == extent) { 472 xor(xorbuf, data, len); 489 if (first) { 490 if (i == extent) { 491 memcpy(xorbuf, data, len); 492 } else { 493 rc = block_read_direct(vol->extents[i].svc_id, 494 block, cnt, xorbuf); 495 if (rc != EOK) 496 goto end; 497 } 498 499 first = false; 473 500 } else { 474 rc = block_read_direct(vol->extents[i].svc_id, block, 475 cnt, buf); 476 if (rc != EOK) 477 goto end; 478 xor(xorbuf, buf, len); 501 if (i == extent) { 502 xor(xorbuf, data, len); 503 } else { 504 rc = block_read_direct(vol->extents[i].svc_id, 505 block, cnt, buf); 506 if (rc != EOK) 507 goto end; 508 509 xor(xorbuf, buf, len); 510 } 479 511 } 480 512 } -
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.