Changeset b8409b9 in mainline


Ignore:
Timestamp:
2024-11-22T19:01:05Z (6 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
b56d88f
Parents:
d0f0744
Message:

hr: RAID1: fix WRITE to rebuilt extent

When writing to extent that is being rebuilt, allow
writes only to (ba < current rebuild position).

Location:
uspace/srv/bd/hr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/hr/raid1.c

    rd0f0744 rb8409b9  
    331331        case HR_BD_WRITE:
    332332                for (i = 0; i < vol->dev_no; i++) {
    333                         if (vol->extents[i].status != HR_EXT_ONLINE)
     333                        if (vol->extents[i].status != HR_EXT_ONLINE ||
     334                            (vol->extents[i].status == HR_EXT_REBUILD &&
     335                            ba >= vol->rebuild_blk))
     336                                /*
     337                                 * When the extent is being rebuilt,
     338                                 * we only write to the part that is already
     339                                 * rebuilt. If ba is more than vol->rebuild_blk,
     340                                 * the write is going to be replicated later
     341                                 * in the rebuild. TODO: test
     342                                 */
    334343                                continue;
    335344                        rc = block_write_direct(vol->extents[i].svc_id, ba, cnt,
     
    395404        size_t hotspare_idx = vol->hotspare_no - 1;
    396405
     406        vol->rebuild_blk = 0;
    397407        vol->extents[bad].svc_id = vol->hotspares[hotspare_idx].svc_id;
    398408        hr_update_ext_status(vol, bad, HR_EXT_REBUILD);
     
    430440        hr_add_ba_offset(vol, &ba);
    431441        while (left != 0) {
     442                vol->rebuild_blk = ba;
    432443                cnt = min(max_blks, left);
    433444                for (size_t i = 0; i < vol->dev_no; i++) {
  • uspace/srv/bd/hr/var.h

    rd0f0744 rb8409b9  
    7373        uint32_t strip_size;
    7474
     75        uint64_t rebuild_blk;
     76
    7577        service_id_t svc_id;
    7678        hr_vol_status_t status;
Note: See TracChangeset for help on using the changeset viewer.