Changeset 56214383 in mainline for uspace/srv/bd/hr/raid1.c


Ignore:
Timestamp:
2025-03-29T12:09:58Z (11 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
49de61c
Parents:
8a65373
Message:

hr: util: hr_util_add_hotspare()

File:
1 edited

Legend:

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

    r8a65373 r56214383  
    145145        HR_DEBUG("%s()", __func__);
    146146
    147         errno_t rc = EOK;
    148 
    149         fibril_mutex_lock(&vol->hotspare_lock);
    150 
    151         if (vol->hotspare_no >= HR_MAX_HOTSPARES) {
    152                 HR_ERROR("hr_raid1_add_hotspare(): cannot add more hotspares "
    153                     "to \"%s\"\n", vol->devname);
    154                 rc = ELIMIT;
    155                 goto error;
    156         }
    157 
    158         size_t hs_idx = vol->hotspare_no;
    159 
    160         vol->hotspare_no++;
    161 
    162         hr_update_hotspare_svc_id(vol, hs_idx, hotspare);
    163         hr_update_hotspare_status(vol, hs_idx, HR_EXT_HOTSPARE);
    164 
    165         hr_mark_vol_state_dirty(vol);
    166 error:
    167         fibril_mutex_unlock(&vol->hotspare_lock);
     147        errno_t rc = hr_util_add_hotspare(vol, hotspare);
    168148
    169149        hr_raid1_update_vol_status(vol);
     
    656636        service_id_t hs_svc_id = vol->hotspares[hs].svc_id;
    657637
    658         /* TODO: if rc != EOK, try next hotspare */
    659         errno_t rc = block_init(hs_svc_id);
    660         if (rc != EOK) {
    661                 HR_ERROR("hr_raid1_rebuild(): initing hotspare (%lu) failed\n",
    662                     hs_svc_id);
    663                 return rc;
    664         }
    665 
    666638        hr_update_ext_svc_id(vol, bad, hs_svc_id);
    667639        hr_update_ext_status(vol, bad, HR_EXT_HOTSPARE);
Note: See TracChangeset for help on using the changeset viewer.