Changeset a3486f2 in mainline for uspace/srv/bd/hr/util.c


Ignore:
Timestamp:
2025-06-17T14:17:20Z (6 days ago)
Author:
Miroslav Cimerman <mc@…>
Children:
137f7cf5
Parents:
9d1685b
Message:

hr: parallel RAID 5

File:
1 edited

Legend:

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

    r9d1685b ra3486f2  
    150150        }
    151151
    152         vol->fge = hr_fpool_create(16, 32, sizeof(hr_io_t));
     152        if (level == HR_LVL_4 || level == HR_LVL_5)
     153                vol->fge = hr_fpool_create(16, 32, sizeof(hr_io_raid5_t));
     154        else
     155                vol->fge = hr_fpool_create(16, 32, sizeof(hr_io_t));
     156
    153157        if (vol->fge == NULL) {
    154158                rc = ENOMEM;
     
    164168
    165169        vol->state = HR_VOL_NONE;
    166 
    167         fibril_mutex_initialize(&vol->lock); /* XXX: will remove this */
    168170
    169171        fibril_mutex_initialize(&vol->md_lock);
     
    496498            "(%" PRIun ")\n", vol->devname, hs_idx, old, new);
    497499        vol->hotspares[hs_idx].svc_id = new;
    498 }
    499 
    500 /*
    501  * Do a whole sync (ba = 0, cnt = 0) across all extents,
    502  * and update extent state. *For now*, the caller has to
    503  * update volume state after the syncs.
    504  *
    505  * TODO: add update_vol_state fcn ptr for each raid
    506  */
    507 void hr_sync_all_extents(hr_volume_t *vol)
    508 {
    509         errno_t rc;
    510 
    511         fibril_mutex_lock(&vol->lock);
    512         for (size_t i = 0; i < vol->extent_no; i++) {
    513                 if (vol->extents[i].state != HR_EXT_ONLINE)
    514                         continue;
    515                 rc = block_sync_cache(vol->extents[i].svc_id, 0, 0);
    516                 if (rc == ENOMEM || rc == ENOTSUP)
    517                         continue;
    518                 if (rc != EOK) {
    519                         if (rc == ENOENT)
    520                                 hr_update_ext_state(vol, i, HR_EXT_MISSING);
    521                         else if (rc != EOK)
    522                                 hr_update_ext_state(vol, i, HR_EXT_FAILED);
    523                 }
    524         }
    525         fibril_mutex_unlock(&vol->lock);
    526500}
    527501
     
    11161090}
    11171091
     1092void hr_raid5_xor(void *dst, const void *src, size_t size)
     1093{
     1094        size_t i;
     1095        uint64_t *d = dst;
     1096        const uint64_t *s = src;
     1097
     1098        for (i = 0; i < size / sizeof(uint64_t); ++i)
     1099                *d++ ^= *s++;
     1100}
     1101
    11181102/** @}
    11191103 */
Note: See TracChangeset for help on using the changeset viewer.