Changeset d1d355f in mainline for uspace/srv/bd/hr/hr.c
- Timestamp:
- 2025-05-06T21:30:30Z (5 weeks ago)
- Children:
- c2f0160
- Parents:
- 40f56a4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/hr.c
r40f56a4 rd1d355f 61 61 static void hr_auto_assemble_srv(ipc_call_t *); 62 62 static void hr_stop_srv(ipc_call_t *); 63 static void hr_stop_all_srv(ipc_call_t *); 63 64 static void hr_add_hotspare_srv(ipc_call_t *); 64 65 static void hr_print_status_srv(ipc_call_t *); … … 163 164 fibril_rwlock_write_unlock(&hr_volumes_lock); 164 165 165 HR_DEBUG("created volume \"%s\" (%" PRIun ")\n", vol->devname, 166 vol->svc_id); 166 HR_NOTE("created volume \"%s\"\n", vol->devname); 167 167 168 168 free(cfg); … … 275 275 errno_t rc = EOK; 276 276 service_id_t svc_id; 277 long fail_extent;278 277 hr_volume_t *vol; 279 278 280 279 svc_id = ipc_get_arg1(icall); 281 fail_extent = (long)ipc_get_arg2(icall);282 280 283 281 vol = hr_get_volume(svc_id); … … 287 285 } 288 286 289 if (fail_extent == -1) { 290 rc = hr_remove_volume(svc_id); 291 if (rc != EOK) { 292 async_answer_0(icall, rc); 293 return; 287 rc = hr_remove_volume(vol); 288 289 async_answer_0(icall, rc); 290 } 291 292 static void hr_stop_all_srv(ipc_call_t *icall) 293 { 294 HR_DEBUG("%s()", __func__); 295 296 hr_volume_t *vol; 297 errno_t rc = EOK; 298 299 while (true) { 300 fibril_rwlock_write_lock(&hr_volumes_lock); 301 if (list_empty(&hr_volumes)) { 302 fibril_rwlock_write_unlock(&hr_volumes_lock); 303 break; 294 304 } 295 } else { 296 fibril_rwlock_write_lock(&vol->states_lock); 297 fibril_rwlock_read_lock(&vol->extents_lock); 298 299 /* TODO: maybe expose extent state callbacks */ 300 hr_update_ext_status(vol, fail_extent, HR_EXT_FAILED); 301 hr_mark_vol_state_dirty(vol); 302 303 fibril_rwlock_read_unlock(&vol->extents_lock); 304 fibril_rwlock_write_unlock(&vol->states_lock); 305 306 vol->hr_ops.status_event(vol); 307 } 308 async_answer_0(icall, rc); 305 306 vol = list_pop(&hr_volumes, hr_volume_t, lvolumes); 307 308 fibril_rwlock_write_unlock(&hr_volumes_lock); 309 310 rc = hr_remove_volume(vol); 311 if (rc != EOK) 312 break; 313 } 314 315 async_answer_0(icall, rc); 316 } 317 318 static void hr_fail_extent_srv(ipc_call_t *icall) 319 { 320 HR_DEBUG("%s()", __func__); 321 322 service_id_t svc_id; 323 size_t fail_extent; 324 hr_volume_t *vol; 325 326 svc_id = (service_id_t)ipc_get_arg1(icall); 327 fail_extent = (size_t)ipc_get_arg2(icall); 328 329 vol = hr_get_volume(svc_id); 330 if (vol == NULL) { 331 async_answer_0(icall, ENOENT); 332 return; 333 } 334 335 fibril_rwlock_write_lock(&vol->states_lock); 336 fibril_rwlock_read_lock(&vol->extents_lock); 337 338 hr_update_ext_status(vol, fail_extent, HR_EXT_FAILED); 339 hr_mark_vol_state_dirty(vol); 340 341 fibril_rwlock_read_unlock(&vol->extents_lock); 342 fibril_rwlock_write_unlock(&vol->states_lock); 343 344 vol->hr_ops.status_event(vol); 345 346 async_answer_0(icall, EOK); 309 347 } 310 348 … … 438 476 hr_stop_srv(&call); 439 477 break; 478 case HR_STOP_ALL: 479 hr_stop_all_srv(&call); 480 break; 481 case HR_FAIL_EXTENT: 482 hr_fail_extent_srv(&call); 483 break; 440 484 case HR_ADD_HOTSPARE: 441 485 hr_add_hotspare_srv(&call);
Note:
See TracChangeset
for help on using the changeset viewer.