Changeset a0c3080 in mainline for uspace/srv/bd/hr/raid0.c


Ignore:
Timestamp:
2024-11-28T17:09:52Z (15 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
586b39d
Parents:
65706f1
Message:

hr: util: hotspare and volume change state functions

File:
1 edited

Legend:

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

    r65706f1 ra0c3080  
    181181        if (vol->status == HR_VOL_ONLINE)
    182182                return EOK;
    183         return EINVAL;
     183        return EIO;
    184184}
    185185
     
    190190static errno_t hr_raid0_update_vol_status(hr_volume_t *vol)
    191191{
     192        hr_vol_status_t old_state = vol->status;
     193
    192194        for (size_t i = 0; i < vol->extent_no; i++) {
    193195                if (vol->extents[i].status != HR_EXT_ONLINE) {
    194                         HR_WARN("RAID 0 needs all extents to be ONLINE, "
    195                             "marking \"%s\" (%lu) as FAULTY",
    196                             vol->devname, vol->svc_id);
    197                         vol->status = HR_VOL_FAULTY;
    198                         return EINVAL;
     196                        if (old_state != HR_VOL_FAULTY)
     197                                hr_update_vol_status(vol, HR_VOL_FAULTY);
     198                        return EIO;
    199199                }
    200200        }
    201201
    202         vol->status = HR_VOL_ONLINE;
     202        if (old_state != HR_VOL_ONLINE)
     203                hr_update_vol_status(vol, HR_VOL_ONLINE);
     204
    203205        return EOK;
    204206}
     
    244246
    245247        left = cnt;
     248
    246249        while (left != 0) {
    247250                phys_block = ext_stripe * strip_size + strip_off;
Note: See TracChangeset for help on using the changeset viewer.