Changeset 996d31ac in mainline


Ignore:
Timestamp:
2025-07-02T20:43:58Z (6 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
038a8d0
Parents:
dcdb990
Message:

hr: retire level specific add_hotspare() hr_ops_t

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

Legend:

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

    rdcdb990 r996d31ac  
    407407        }
    408408
    409         if (vol->hr_ops.add_hotspare == NULL) {
    410                 HR_NOTE("hotspare not supported on RAID level = %d, "
    411                     "metadata type = %s\n", vol->level,
     409        if (vol->level == HR_LVL_0) {
     410                HR_NOTE("hotspare not supported on RAID level = %s\n",
     411                    hr_get_level_str(vol->level));
     412                async_answer_0(icall, ENOTSUP);
     413                return;
     414        }
     415
     416        if (!(vol->meta_ops->get_flags() & HR_METADATA_HOTSPARE_SUPPORT)) {
     417                HR_NOTE("hotspare not supported on metadata type = %s\n",
    412418                    hr_get_metadata_type_str(vol->meta_ops->get_type()));
    413419                async_answer_0(icall, ENOTSUP);
     
    415421        }
    416422
    417         rc = vol->hr_ops.add_hotspare(vol, hotspare);
     423        rc = hr_util_add_hotspare(vol, hotspare);
     424
     425        vol->hr_ops.vol_state_eval(vol);
    418426
    419427        async_answer_0(icall, rc);
  • uspace/srv/bd/hr/raid1.c

    rdcdb990 r996d31ac  
    133133}
    134134
    135 errno_t hr_raid1_add_hotspare(hr_volume_t *vol, service_id_t hotspare)
    136 {
    137         HR_DEBUG("%s()", __func__);
    138 
    139         errno_t rc = hr_util_add_hotspare(vol, hotspare);
    140 
    141         hr_raid1_vol_state_eval(vol);
    142 
    143         return rc;
    144 }
    145 
    146135void hr_raid1_vol_state_eval(hr_volume_t *vol)
    147136{
  • uspace/srv/bd/hr/raid5.c

    rdcdb990 r996d31ac  
    155155}
    156156
    157 errno_t hr_raid5_add_hotspare(hr_volume_t *vol, service_id_t hotspare)
    158 {
    159         HR_DEBUG("%s()", __func__);
    160 
    161         errno_t rc = hr_util_add_hotspare(vol, hotspare);
    162 
    163         hr_raid5_vol_state_eval(vol);
    164 
    165         return rc;
    166 }
    167 
    168157void hr_raid5_ext_state_cb(hr_volume_t *vol, size_t extent, errno_t rc)
    169158{
  • uspace/srv/bd/hr/util.c

    rdcdb990 r996d31ac  
    119119        vol->meta_ops = hr_get_meta_type_ops(metadata_type);
    120120
    121         uint8_t meta_flags = vol->meta_ops->get_flags();
    122 
    123121        switch (level) {
    124122        case HR_LVL_0:
     
    133131                vol->hr_ops.vol_state_eval = hr_raid1_vol_state_eval;
    134132                vol->hr_ops.ext_state_cb = hr_raid1_ext_state_cb;
    135                 if (meta_flags & HR_METADATA_HOTSPARE_SUPPORT)
    136                         vol->hr_ops.add_hotspare = hr_raid1_add_hotspare;
    137133                break;
    138134        case HR_LVL_4:
     
    142138                vol->hr_ops.vol_state_eval = hr_raid5_vol_state_eval;
    143139                vol->hr_ops.ext_state_cb = hr_raid5_ext_state_cb;
    144                 if (meta_flags & HR_METADATA_HOTSPARE_SUPPORT)
    145                         vol->hr_ops.add_hotspare = hr_raid5_add_hotspare;
    146140                break;
    147141        default:
  • uspace/srv/bd/hr/var.h

    rdcdb990 r996d31ac  
    6666        errno_t (*create)(hr_volume_t *);
    6767        errno_t (*init)(hr_volume_t *);
    68         errno_t (*add_hotspare)(hr_volume_t *, service_id_t);
    6968        void (*vol_state_eval)(hr_volume_t *);
    7069        void (*ext_state_cb)(hr_volume_t *, size_t, errno_t);
     
    138137extern errno_t hr_raid5_init(hr_volume_t *);
    139138
    140 extern errno_t hr_raid1_add_hotspare(hr_volume_t *, service_id_t);
    141 extern errno_t hr_raid5_add_hotspare(hr_volume_t *, service_id_t);
    142 
    143139extern void hr_raid0_vol_state_eval(hr_volume_t *);
    144140extern void hr_raid1_vol_state_eval(hr_volume_t *);
Note: See TracChangeset for help on using the changeset viewer.