Changeset 9fc1d36d in mainline
- Timestamp:
- 2024-10-28T20:03:53Z (7 months ago)
- Children:
- 1903d77
- Parents:
- e47a032
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/raid0.c
re47a032 r9fc1d36d 74 74 }; 75 75 76 static errno_t hr_raid0_check_vol_status(hr_volume_t *vol) 77 { 78 if (vol->status == HR_VOL_ONLINE) 79 return EOK; 80 return EINVAL; 81 } 82 83 /* 84 * Update vol->status and return EOK if volume 85 * is usable 86 */ 87 static errno_t hr_raid0_update_vol_status(hr_volume_t *vol) 88 { 89 for (size_t i = 0; i < vol->dev_no; i++) { 90 if (vol->extents[i].status != HR_EXT_ONLINE) { 91 log_msg(LOG_DEFAULT, LVL_ERROR, 92 "RAID 0 needs all disks to be ONLINE, marking " 93 "\"%s\" (%lu) as FAULTY", 94 vol->devname, vol->svc_id); 95 vol->status = HR_VOL_FAULTY; 96 return EINVAL; 97 } 98 } 99 100 vol->status = HR_VOL_ONLINE; 101 return EOK; 102 } 103 76 104 static errno_t hr_raid0_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 77 105 { … … 109 137 110 138 fibril_mutex_lock(&vol->lock); 139 140 rc = hr_raid0_check_vol_status(vol); 141 if (rc != EOK) { 142 fibril_mutex_unlock(&vol->lock); 143 return EIO; 144 } 111 145 112 146 left = cnt; … … 135 169 rc = EINVAL; 136 170 } 137 if (rc != EOK) 171 172 if (rc == ENOENT) { 173 hr_update_ext_status(vol, extent, HR_EXT_MISSING); 174 rc = EIO; 138 175 goto error; 176 } else if (rc != EOK) { 177 hr_update_ext_status(vol, extent, HR_EXT_FAILED); 178 rc = EIO; 179 goto error; 180 } 139 181 140 182 left -= cnt; … … 148 190 149 191 error: 192 (void) hr_raid0_update_vol_status(vol); 150 193 fibril_mutex_unlock(&vol->lock); 151 194 return rc; … … 196 239 return EINVAL; 197 240 } 241 242 rc = hr_raid0_update_vol_status(new_volume); 243 if (rc != EOK) 244 return rc; 198 245 199 246 bd_srvs_init(&new_volume->hr_bds);
Note:
See TracChangeset
for help on using the changeset viewer.