Changeset 56602e0 in mainline for uspace/srv/bd/hr/raid5.c


Ignore:
Timestamp:
2025-05-07T11:27:25Z (5 weeks ago)
Author:
Miroslav Cimerman <mc@…>
Children:
964e897
Parents:
155d34f
git-author:
Miroslav Cimerman <mc@…> (2025-05-07 11:26:23)
git-committer:
Miroslav Cimerman <mc@…> (2025-05-07 11:27:25)
Message:

hr: rename all strings status' -> state'

File:
1 edited

Legend:

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

    r155d34f r56602e0  
    5656static errno_t  hr_raid5_vol_usable(hr_volume_t *);
    5757static ssize_t  hr_raid5_get_bad_ext(hr_volume_t *);
    58 static errno_t  hr_raid5_update_vol_status(hr_volume_t *);
     58static errno_t  hr_raid5_update_vol_state(hr_volume_t *);
    5959static void     hr_raid5_handle_extent_error(hr_volume_t *, size_t, errno_t);
    6060static void     xor(void *, const void *, size_t);
     
    105105        fibril_rwlock_write_lock(&new_volume->states_lock);
    106106
    107         errno_t rc = hr_raid5_update_vol_status(new_volume);
     107        errno_t rc = hr_raid5_update_vol_state(new_volume);
    108108        if (rc != EOK) {
    109109                HR_NOTE("\"%s\": unusable state, not creating\n",
     
    145145}
    146146
    147 void hr_raid5_status_event(hr_volume_t *vol)
     147void hr_raid5_state_event(hr_volume_t *vol)
    148148{
    149149        fibril_mutex_lock(&vol->lock);
    150150        fibril_rwlock_write_lock(&vol->states_lock);
    151         (void)hr_raid5_update_vol_status(vol);
     151        (void)hr_raid5_update_vol_state(vol);
    152152        fibril_rwlock_write_unlock(&vol->states_lock);
    153153        fibril_mutex_unlock(&vol->lock);
     
    167167         * If the volume is degraded, start rebuild right away.
    168168         */
    169         if (vol->status == HR_VOL_DEGRADED) {
     169        if (vol->state == HR_VOL_DEGRADED) {
    170170                HR_DEBUG("hr_raid5_add_hotspare(): volume in DEGRADED state, "
    171171                    "spawning new rebuild fibril\n");
     
    243243static errno_t hr_raid5_vol_usable(hr_volume_t *vol)
    244244{
    245         if (vol->status == HR_VOL_ONLINE ||
    246             vol->status == HR_VOL_DEGRADED ||
    247             vol->status == HR_VOL_REBUILD)
     245        if (vol->state == HR_VOL_ONLINE ||
     246            vol->state == HR_VOL_DEGRADED ||
     247            vol->state == HR_VOL_REBUILD)
    248248                return EOK;
    249249        return EIO;
     
    257257{
    258258        for (size_t i = 0; i < vol->extent_no; i++)
    259                 if (vol->extents[i].status != HR_EXT_ONLINE)
     259                if (vol->extents[i].state != HR_EXT_ONLINE)
    260260                        return i;
    261261        return -1;
    262262}
    263263
    264 static errno_t hr_raid5_update_vol_status(hr_volume_t *vol)
    265 {
    266         hr_vol_status_t old_state = vol->status;
     264static errno_t hr_raid5_update_vol_state(hr_volume_t *vol)
     265{
     266        hr_vol_state_t old_state = vol->state;
    267267        size_t bad = 0;
    268268        for (size_t i = 0; i < vol->extent_no; i++)
    269                 if (vol->extents[i].status != HR_EXT_ONLINE)
     269                if (vol->extents[i].state != HR_EXT_ONLINE)
    270270                        bad++;
    271271
     
    273273        case 0:
    274274                if (old_state != HR_VOL_ONLINE)
    275                         hr_update_vol_status(vol, HR_VOL_ONLINE);
     275                        hr_update_vol_state(vol, HR_VOL_ONLINE);
    276276                return EOK;
    277277        case 1:
     
    279279                    old_state != HR_VOL_REBUILD) {
    280280
    281                         hr_update_vol_status(vol, HR_VOL_DEGRADED);
     281                        hr_update_vol_state(vol, HR_VOL_DEGRADED);
    282282
    283283                        if (vol->hotspare_no > 0) {
     
    293293        default:
    294294                if (old_state != HR_VOL_FAULTY)
    295                         hr_update_vol_status(vol, HR_VOL_FAULTY);
     295                        hr_update_vol_state(vol, HR_VOL_FAULTY);
    296296                return EIO;
    297297        }
     
    302302{
    303303        if (rc == ENOENT)
    304                 hr_update_ext_status(vol, extent, HR_EXT_MISSING);
     304                hr_update_ext_state(vol, extent, HR_EXT_MISSING);
    305305        else if (rc != EOK)
    306                 hr_update_ext_status(vol, extent, HR_EXT_FAILED);
     306                hr_update_ext_state(vol, extent, HR_EXT_FAILED);
    307307}
    308308
     
    537537        if (type == HR_BD_SYNC && ba == 0 && cnt == 0) {
    538538                hr_sync_all_extents(vol);
    539                 rc = hr_raid5_update_vol_status(vol);
     539                rc = hr_raid5_update_vol_state(vol);
    540540                return rc;
    541541        }
     
    611611                switch (type) {
    612612                case HR_BD_SYNC:
    613                         if (vol->extents[extent].status != HR_EXT_ONLINE)
     613                        if (vol->extents[extent].state != HR_EXT_ONLINE)
    614614                                break;
    615615                        rc = block_sync_cache(vol->extents[extent].svc_id,
     
    648648
    649649                if (rc != EOK) {
    650                         rc = hr_raid5_update_vol_status(vol);
     650                        rc = hr_raid5_update_vol_state(vol);
    651651                        if (rc == EOK) {
    652652                                /*
     
    700700
    701701error:
    702         (void)hr_raid5_update_vol_status(vol);
     702        (void)hr_raid5_update_vol_state(vol);
    703703        fibril_rwlock_write_unlock(&vol->states_lock);
    704704        fibril_mutex_unlock(&vol->lock);
     
    727727        size_t bad = vol->extent_no;
    728728        for (size_t i = 0; i < vol->extent_no; i++) {
    729                 if (vol->extents[i].status == HR_EXT_FAILED) {
     729                if (vol->extents[i].state == HR_EXT_FAILED) {
    730730                        bad = i;
    731731                        break;
     
    742742        size_t hotspare_idx = vol->hotspare_no - 1;
    743743
    744         hr_ext_status_t hs_state = vol->hotspares[hotspare_idx].status;
     744        hr_ext_state_t hs_state = vol->hotspares[hotspare_idx].state;
    745745        if (hs_state != HR_EXT_HOTSPARE) {
    746746                HR_ERROR("hr_raid5_rebuild(): invalid hotspare state \"%s\", "
     
    755755
    756756        vol->extents[bad].svc_id = vol->hotspares[hotspare_idx].svc_id;
    757         hr_update_ext_status(vol, bad, HR_EXT_HOTSPARE);
     757        hr_update_ext_state(vol, bad, HR_EXT_HOTSPARE);
    758758
    759759        vol->hotspares[hotspare_idx].svc_id = 0;
    760760        fibril_mutex_lock(&vol->hotspare_lock);
    761         hr_update_hotspare_status(vol, hotspare_idx, HR_EXT_MISSING);
     761        hr_update_hotspare_state(vol, hotspare_idx, HR_EXT_MISSING);
    762762        fibril_mutex_unlock(&vol->hotspare_lock);
    763763
     
    769769            rebuild_ext->svc_id);
    770770
    771         hr_update_ext_status(vol, bad, HR_EXT_REBUILD);
    772         hr_update_vol_status(vol, HR_VOL_REBUILD);
     771        hr_update_ext_state(vol, bad, HR_EXT_REBUILD);
     772        hr_update_vol_state(vol, HR_VOL_REBUILD);
    773773
    774774        uint64_t max_blks = DATA_XFER_LIMIT / vol->bsize;
     
    838838            "extent number %zu\n", vol->devname, vol->svc_id, hotspare_idx);
    839839
    840         hr_update_ext_status(vol, bad, HR_EXT_ONLINE);
     840        hr_update_ext_state(vol, bad, HR_EXT_ONLINE);
    841841
    842842        rc = vol->meta_ops->save(vol, WITH_STATE_CALLBACK);
    843843
    844844end:
    845         (void)hr_raid5_update_vol_status(vol);
     845        (void)hr_raid5_update_vol_state(vol);
    846846
    847847        fibril_rwlock_write_unlock(&vol->states_lock);
Note: See TracChangeset for help on using the changeset viewer.