Changeset ca7fa5b in mainline for uspace/srv/bd/hr/util.c
- Timestamp:
- 2025-04-02T18:24:11Z (4 months ago)
- Children:
- 800d188
- Parents:
- bbcd06e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/util.c
rbbcd06e rca7fa5b 39 39 #include <fibril_synch.h> 40 40 #include <hr.h> 41 #include <inttypes.h> 41 42 #include <io/log.h> 42 43 #include <loc.h> … … 234 235 235 236 errno_t rc; 236 size_t i, blkno, bsize; 237 uint64_t blkno; 238 size_t i, bsize; 237 239 size_t last_bsize = 0; 238 240 … … 244 246 } 245 247 246 HR_DEBUG("%s(): block_init() on (%lu)\n", __func__, svc_id); 248 HR_DEBUG("%s(): block_init() on (%" PRIun ")\n", __func__, 249 svc_id); 247 250 rc = block_init(svc_id); 248 251 if (rc != EOK) { 249 HR_DEBUG("%s(): initing (% lu) failed, aborting\n",252 HR_DEBUG("%s(): initing (%" PRIun ") failed, aborting\n", 250 253 __func__, svc_id); 251 254 goto error; … … 298 301 for (i = 0; i < vol->extent_no; i++) { 299 302 if (vol->extents[i].svc_id != 0) { 300 HR_DEBUG("hr_fini_devs(): block_fini() on (% lu)\n",303 HR_DEBUG("hr_fini_devs(): block_fini() on (%" PRIun ")\n", 301 304 vol->extents[i].svc_id); 302 305 block_fini(vol->extents[i].svc_id); … … 306 309 for (i = 0; i < vol->hotspare_no; i++) { 307 310 if (vol->hotspares[i].svc_id != 0) { 308 HR_DEBUG("hr_fini_devs(): block_fini() on (% lu)\n",311 HR_DEBUG("hr_fini_devs(): block_fini() on (%" PRIun ")\n", 309 312 vol->hotspares[i].svc_id); 310 313 block_fini(vol->hotspares[i].svc_id); … … 370 373 } 371 374 372 void hr_update_ext_status(hr_volume_t *vol, size_t ext ent, hr_ext_status_t s)375 void hr_update_ext_status(hr_volume_t *vol, size_t ext_idx, hr_ext_status_t s) 373 376 { 374 377 if (vol->level != HR_LVL_0) … … 377 380 assert(fibril_rwlock_is_write_locked(&vol->states_lock)); 378 381 379 assert(ext ent< vol->extent_no);380 381 hr_ext_status_t old = vol->extents[ext ent].status;382 HR_WARN("\"%s\": changing extent % lu state: %s -> %s\n",383 vol->devname, ext ent, hr_get_ext_status_msg(old),382 assert(ext_idx < vol->extent_no); 383 384 hr_ext_status_t old = vol->extents[ext_idx].status; 385 HR_WARN("\"%s\": changing extent %zu state: %s -> %s\n", 386 vol->devname, ext_idx, hr_get_ext_status_msg(old), 384 387 hr_get_ext_status_msg(s)); 385 vol->extents[extent].status = s; 386 } 387 388 void hr_update_hotspare_status(hr_volume_t *vol, size_t hs, hr_ext_status_t s) 388 vol->extents[ext_idx].status = s; 389 } 390 391 void hr_update_hotspare_status(hr_volume_t *vol, size_t hs_idx, 392 hr_ext_status_t s) 389 393 { 390 394 assert(fibril_mutex_is_locked(&vol->hotspare_lock)); 391 395 392 assert(hs < vol->hotspare_no);393 394 hr_ext_status_t old = vol->hotspares[hs ].status;395 HR_WARN("\"%s\": changing hotspare % lu state: %s -> %s\n",396 vol->devname, hs , hr_get_ext_status_msg(old),396 assert(hs_idx < vol->hotspare_no); 397 398 hr_ext_status_t old = vol->hotspares[hs_idx].status; 399 HR_WARN("\"%s\": changing hotspare %zu state: %s -> %s\n", 400 vol->devname, hs_idx, hr_get_ext_status_msg(old), 397 401 hr_get_ext_status_msg(s)); 398 vol->hotspares[hs ].status = s;402 vol->hotspares[hs_idx].status = s; 399 403 } 400 404 … … 408 412 } 409 413 410 void hr_update_ext_svc_id(hr_volume_t *vol, size_t ext ent, service_id_t new)414 void hr_update_ext_svc_id(hr_volume_t *vol, size_t ext_idx, service_id_t new) 411 415 { 412 416 if (vol->level != HR_LVL_0) 413 417 assert(fibril_rwlock_is_write_locked(&vol->extents_lock)); 414 418 415 assert(extent < vol->extent_no); 416 417 service_id_t old = vol->extents[extent].svc_id; 418 HR_WARN("\"%s\": changing extent no. %lu svc_id: (%lu) -> (%lu)\n", 419 vol->devname, extent, old, new); 420 vol->extents[extent].svc_id = new; 421 } 422 423 void hr_update_hotspare_svc_id(hr_volume_t *vol, size_t hs, service_id_t new) 419 assert(ext_idx < vol->extent_no); 420 421 service_id_t old = vol->extents[ext_idx].svc_id; 422 HR_WARN("\"%s\": changing extent no. %zu svc_id: (%" PRIun ") -> " 423 "(%" PRIun ")\n", vol->devname, ext_idx, old, new); 424 vol->extents[ext_idx].svc_id = new; 425 } 426 427 void hr_update_hotspare_svc_id(hr_volume_t *vol, size_t hs_idx, 428 service_id_t new) 424 429 { 425 430 assert(fibril_mutex_is_locked(&vol->hotspare_lock)); 426 431 427 assert(hs < vol->hotspare_no);428 429 service_id_t old = vol->hotspares[hs ].svc_id;430 HR_WARN("\"%s\": changing hotspare no. % lu svc_id: (%lu) -> (%lu)\n",431 vol->devname, hs, old, new);432 vol->hotspares[hs ].svc_id = new;432 assert(hs_idx < vol->hotspare_no); 433 434 service_id_t old = vol->hotspares[hs_idx].svc_id; 435 HR_WARN("\"%s\": changing hotspare no. %zu svc_id: (%" PRIun ") -> " 436 "(%" PRIun ")\n", vol->devname, hs_idx, old, new); 437 vol->hotspares[hs_idx].svc_id = new; 433 438 } 434 439 … … 805 810 vol->extents[iter->md->index].svc_id = iter->svc_id; 806 811 807 size_t blkno;812 uint64_t blkno; 808 813 rc = block_get_nblocks(iter->svc_id, &blkno); 809 814 if (rc != EOK) … … 1049 1054 goto error; 1050 1055 1051 size_t hs_blkno;1056 uint64_t hs_blkno; 1052 1057 rc = block_get_nblocks(hotspare, &hs_blkno); 1053 1058 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.