Changeset d199a6f in mainline
- Timestamp:
- 2024-11-15T21:32:20Z (6 months ago)
- Children:
- 7b359f5
- Parents:
- dfa2313
- Location:
- uspace/srv/bd/hr
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/hr.c
rdfa2313 rd199a6f 62 62 static hr_volume_t *hr_get_volume(service_id_t svc_id) 63 63 { 64 DPRINTF("hr_get_volume(): (%" PRIun ")\n", svc_id);64 HR_DEBUG("hr_get_volume(): (%" PRIun ")\n", svc_id); 65 65 66 66 fibril_mutex_lock(&hr_volumes_lock); … … 78 78 static errno_t hr_remove_volume(service_id_t svc_id) 79 79 { 80 DPRINTF("hr_remove_volume(): (%" PRIun ")\n", svc_id);80 HR_DEBUG("hr_remove_volume(): (%" PRIun ")\n", svc_id); 81 81 82 82 fibril_mutex_lock(&hr_volumes_lock); … … 97 97 static void hr_create_srv(ipc_call_t *icall, bool assemble) 98 98 { 99 DPRINTF("hr_create_srv()\n");99 HR_DEBUG("hr_create_srv()\n"); 100 100 101 101 errno_t rc; … … 139 139 for (i = 0; i < cfg->dev_no; i++) { 140 140 if (cfg->devs[i] == 0) { 141 ERR_PRINTF("missing device provided for array "141 HR_ERROR("missing device provided for array " 142 142 "creation, aborting"); 143 143 free(cfg); … … 163 163 if (assemble) { 164 164 if (cfg->level != HR_LVL_UNKNOWN) 165 log_msg(LOG_DEFAULT, LVL_WARN, 166 "level manually set when assembling, ingoring"); 165 HR_WARN("level manually set when assembling, ingoring"); 167 166 new_volume->level = HR_LVL_UNKNOWN; 168 167 } … … 205 204 break; 206 205 default: 207 ERR_PRINTF("unkown level: %d, aborting\n", new_volume->level);206 HR_ERROR("unkown level: %d, aborting\n", new_volume->level); 208 207 rc = EINVAL; 209 208 goto error; … … 231 230 232 231 if (assemble) { 233 DPRINTF("assembled volume \"%s\" (%" PRIun ")\n",232 HR_DEBUG("assembled volume \"%s\" (%" PRIun ")\n", 234 233 new_volume->devname, new_volume->svc_id); 235 234 } else { 236 DPRINTF("created volume \"%s\" (%" PRIun ")\n",235 HR_DEBUG("created volume \"%s\" (%" PRIun ")\n", 237 236 new_volume->devname, new_volume->svc_id); 238 237 } … … 250 249 static void hr_stop_srv(ipc_call_t *icall) 251 250 { 252 DPRINTF("hr_stop_srv()\n");251 HR_DEBUG("hr_stop_srv()\n"); 253 252 254 253 errno_t rc = EOK; … … 284 283 static void hr_print_status_srv(ipc_call_t *icall) 285 284 { 286 DPRINTF("hr_status_srv()\n");285 HR_DEBUG("hr_status_srv()\n"); 287 286 288 287 errno_t rc; … … 348 347 static void hr_ctl_conn(ipc_call_t *icall, void *arg) 349 348 { 350 DPRINTF("hr_ctl_conn()\n");349 HR_DEBUG("hr_ctl_conn()\n"); 351 350 352 351 async_accept_0(icall); … … 383 382 static void hr_client_conn(ipc_call_t *icall, void *arg) 384 383 { 385 DPRINTF("hr_client_conn()\n");384 HR_DEBUG("hr_client_conn()\n"); 386 385 387 386 hr_volume_t *vol; … … 392 391 hr_ctl_conn(icall, arg); 393 392 } else { 394 DPRINTF("bd_conn()\n");393 HR_DEBUG("bd_conn()\n"); 395 394 vol = hr_get_volume(svc_id); 396 395 if (vol == NULL) … … 419 418 rc = loc_server_register(NAME, &hr_srv); 420 419 if (rc != EOK) { 421 ERR_PRINTF("failed registering server: %s", str_error(rc));420 HR_ERROR("failed registering server: %s", str_error(rc)); 422 421 return EEXIST; 423 422 } … … 425 424 rc = loc_service_register(hr_srv, SERVICE_NAME_HR, &ctl_sid); 426 425 if (rc != EOK) { 427 ERR_PRINTF("failed registering service: %s", str_error(rc));426 HR_ERROR("failed registering service: %s", str_error(rc)); 428 427 return EEXIST; 429 428 } -
uspace/srv/bd/hr/raid0.c
rdfa2313 rd199a6f 87 87 88 88 if (new_volume->dev_no < 2) { 89 ERR_PRINTF("RAID 0 array needs at least 2 devices");89 HR_ERROR("RAID 0 array needs at least 2 devices\n"); 90 90 return EINVAL; 91 91 } … … 127 127 static errno_t hr_raid0_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 128 128 { 129 DPRINTF("hr_bd_open()\n");129 HR_DEBUG("hr_bd_open()\n"); 130 130 return EOK; 131 131 } … … 133 133 static errno_t hr_raid0_bd_close(bd_srv_t *bd) 134 134 { 135 DPRINTF("hr_bd_close()\n");135 HR_DEBUG("hr_bd_close()\n"); 136 136 return EOK; 137 137 } … … 185 185 for (size_t i = 0; i < vol->dev_no; i++) { 186 186 if (vol->extents[i].status != HR_EXT_ONLINE) { 187 ERR_PRINTF("RAID 0 needs all extents to be ONLINE, "187 HR_WARN("RAID 0 needs all extents to be ONLINE, " 188 188 "marking \"%s\" (%lu) as FAULTY", 189 189 vol->devname, vol->svc_id); -
uspace/srv/bd/hr/raid1.c
rdfa2313 rd199a6f 87 87 88 88 if (new_volume->dev_no < 2) { 89 ERR_PRINTF("RAID 1 array needs at least 2 devices\n");89 HR_ERROR("RAID 1 array needs at least 2 devices\n"); 90 90 return EINVAL; 91 91 } … … 127 127 static errno_t hr_raid1_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 128 128 { 129 DPRINTF("hr_bd_open()\n");129 HR_DEBUG("hr_bd_open()\n"); 130 130 return EOK; 131 131 } … … 133 133 static errno_t hr_raid1_bd_close(bd_srv_t *bd) 134 134 { 135 DPRINTF("hr_bd_close()\n");135 HR_DEBUG("hr_bd_close()\n"); 136 136 return EOK; 137 137 } … … 192 192 if (healthy == 0) { 193 193 if (old_state != HR_VOL_FAULTY) { 194 ERR_PRINTF("RAID 1 needs at least 1 extent to be"194 HR_WARN("RAID 1 needs at least 1 extent to be" 195 195 "ONLINE, marking \"%s\" (%lu) volume as FAULTY", 196 196 vol->devname, vol->svc_id); … … 200 200 } else if (healthy < vol->dev_no) { 201 201 if (old_state != HR_VOL_DEGRADED) { 202 ERR_PRINTF("RAID 1 array \"%s\" (%lu) has some "202 HR_WARN("RAID 1 array \"%s\" (%lu) has some " 203 203 "inactive extent(s), marking volume as DEGRADED", 204 204 vol->devname, vol->svc_id); … … 208 208 } else { 209 209 if (old_state != HR_VOL_ONLINE) { 210 DPRINTF("RAID 1 array \"%s\" (%lu) has all extents "210 HR_WARN("RAID 1 array \"%s\" (%lu) has all extents " 211 211 "active, marking volume as ONLINE", 212 212 vol->devname, vol->svc_id); -
uspace/srv/bd/hr/raid4.c
rdfa2313 rd199a6f 99 99 100 100 if (new_volume->dev_no < 3) { 101 ERR_PRINTF("RAID 4 array needs at least 3 devices");101 HR_ERROR("RAID 4 array needs at least 3 devices\n"); 102 102 return EINVAL; 103 103 } … … 140 140 static errno_t hr_raid4_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 141 141 { 142 DPRINTF("hr_bd_open()\n");142 HR_DEBUG("hr_bd_open()\n"); 143 143 return EOK; 144 144 } … … 146 146 static errno_t hr_raid4_bd_close(bd_srv_t *bd) 147 147 { 148 DPRINTF("hr_bd_close()\n");148 HR_DEBUG("hr_bd_close()\n"); 149 149 return EOK; 150 150 } … … 214 214 case 0: 215 215 if (old_state != HR_VOL_ONLINE) { 216 DPRINTF("RAID 4 has all extents online, "216 HR_WARN("RAID 4 has all extents online, " 217 217 "marking \"%s\" (%lu) as ONLINE", 218 218 vol->devname, vol->svc_id); … … 222 222 case 1: 223 223 if (old_state != HR_VOL_DEGRADED) { 224 ERR_PRINTF("RAID 4 array \"%s\" (%lu) has 1 extent "224 HR_WARN("RAID 4 array \"%s\" (%lu) has 1 extent " 225 225 "inactive, marking as DEGRADED", 226 226 vol->devname, vol->svc_id); … … 230 230 default: 231 231 if (old_state != HR_VOL_FAULTY) { 232 ERR_PRINTF("RAID 4 array \"%s\" (%lu) has more "232 HR_WARN("RAID 4 array \"%s\" (%lu) has more " 233 233 "than one 1 extent inactive, marking as FAULTY", 234 234 vol->devname, vol->svc_id); -
uspace/srv/bd/hr/raid5.c
rdfa2313 rd199a6f 96 96 97 97 if (new_volume->dev_no < 3) { 98 ERR_PRINTF("RAID 5 array needs at least 3 devices");98 HR_ERROR("RAID 5 array needs at least 3 devices\n"); 99 99 return EINVAL; 100 100 } … … 137 137 static errno_t hr_raid5_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 138 138 { 139 DPRINTF("hr_bd_open()\n");139 HR_DEBUG("hr_bd_open()\n"); 140 140 return EOK; 141 141 } … … 143 143 static errno_t hr_raid5_bd_close(bd_srv_t *bd) 144 144 { 145 DPRINTF("hr_bd_close()\n");145 HR_DEBUG("hr_bd_close()\n"); 146 146 return EOK; 147 147 } … … 211 211 case 0: 212 212 if (old_state != HR_VOL_ONLINE) { 213 DPRINTF("RAID 5 has all extents online, "213 HR_WARN("RAID 5 has all extents online, " 214 214 "marking \"%s\" (%lu) as ONLINE", 215 215 vol->devname, vol->svc_id); … … 219 219 case 1: 220 220 if (old_state != HR_VOL_DEGRADED) { 221 ERR_PRINTF("RAID 5 array \"%s\" (%lu) has 1 extent "221 HR_WARN("RAID 5 array \"%s\" (%lu) has 1 extent " 222 222 "inactive, marking as DEGRADED", 223 223 vol->devname, vol->svc_id); … … 227 227 default: 228 228 if (old_state != HR_VOL_FAULTY) { 229 ERR_PRINTF("RAID 5 array \"%s\" (%lu) has more "229 HR_WARN("RAID 5 array \"%s\" (%lu) has more " 230 230 "than one 1 extent inactive, marking as FAULTY", 231 231 vol->devname, vol->svc_id); -
uspace/srv/bd/hr/superblock.c
rdfa2313 rd199a6f 54 54 errno_t hr_write_meta_to_vol(hr_volume_t *vol) 55 55 { 56 DPRINTF("hr_write_meta_to_vol()\n");56 HR_DEBUG("hr_write_meta_to_vol()\n"); 57 57 58 58 errno_t rc; … … 71 71 72 72 if (vol->nblocks < meta_blkno) { 73 ERR_PRINTF("not enough blocks to write metadat\n");73 HR_ERROR("not enough blocks to write metadat\n"); 74 74 rc = EINVAL; 75 75 goto error; 76 76 } else if (vol->nblocks == meta_blkno) { 77 ERR_PRINTF("there would be zero data blocks after writing "77 HR_ERROR("there would be zero data blocks after writing " 78 78 "metadata, aborting"); 79 79 rc = EINVAL; … … 114 114 { 115 115 if (uint64_t_le2host(md->magic) != HR_MAGIC) { 116 ERR_PRINTF("invalid magic\n");116 HR_ERROR("invalid magic\n"); 117 117 return EINVAL; 118 118 } … … 122 122 errno_t hr_fill_vol_from_meta(hr_volume_t *vol) 123 123 { 124 DPRINTF("hr_get_vol_from_meta()\n");124 HR_DEBUG("hr_get_vol_from_meta()\n"); 125 125 126 126 errno_t rc; … … 170 170 171 171 if (vol->dev_no != uint32_t_le2host(metadata->extent_no)) { 172 ERR_PRINTF("number of divices in array differ: specified %zu, "172 HR_ERROR("number of divices in array differ: specified %zu, " 173 173 "metadata states %u", 174 174 vol->dev_no, uint32_t_le2host(metadata->extent_no)); … … 184 184 185 185 if (str_cmp(metadata->devname, vol->devname) != 0) { 186 log_msg(LOG_DEFAULT, LVL_WARN, 187 "devname on metadata (%s) and config (%s) differ, " 186 HR_WARN("devname on metadata (%s) and config (%s) differ, " 188 187 "using config", metadata->devname, vol->devname); 189 188 } -
uspace/srv/bd/hr/util.c
rdfa2313 rd199a6f 50 50 errno_t hr_init_devs(hr_volume_t *vol) 51 51 { 52 DPRINTF("hr_init_devs()\n");52 HR_DEBUG("hr_init_devs()\n"); 53 53 54 54 errno_t rc; … … 63 63 } 64 64 65 DPRINTF("hr_init_devs(): block_init() on (%lu)\n",65 HR_DEBUG("hr_init_devs(): block_init() on (%lu)\n", 66 66 extent->svc_id); 67 67 rc = block_init(extent->svc_id); … … 69 69 70 70 if (rc != EOK) { 71 ERR_PRINTF("hr_init_devs(): initing (%lu) failed, "71 HR_ERROR("hr_init_devs(): initing (%lu) failed, " 72 72 "aborting\n", extent->svc_id); 73 73 break; … … 80 80 void hr_fini_devs(hr_volume_t *vol) 81 81 { 82 DPRINTF("hr_fini_devs()\n");82 HR_DEBUG("hr_fini_devs()\n"); 83 83 84 84 size_t i; … … 86 86 for (i = 0; i < vol->dev_no; i++) { 87 87 if (vol->extents[i].status != HR_EXT_MISSING) { 88 DPRINTF("hr_fini_devs(): block_fini() on (%lu)\n",88 HR_DEBUG("hr_fini_devs(): block_fini() on (%lu)\n", 89 89 vol->extents[i].svc_id); 90 90 block_fini(vol->extents[i].svc_id); … … 95 95 errno_t hr_register_volume(hr_volume_t *vol) 96 96 { 97 DPRINTF("hr_register_volume()\n");97 HR_DEBUG("hr_register_volume()\n"); 98 98 99 99 errno_t rc; … … 108 108 rc = loc_service_register(hr_srv, fullname, &new_id); 109 109 if (rc != EOK) { 110 ERR_PRINTF("unable to register device \"%s\": %s\n",110 HR_ERROR("unable to register device \"%s\": %s\n", 111 111 fullname, str_error(rc)); 112 112 goto error; … … 115 115 rc = loc_category_get_id("raid", &cat_id, IPC_FLAG_BLOCKING); 116 116 if (rc != EOK) { 117 ERR_PRINTF("failed resolving category \"raid\": %s\n",117 HR_ERROR("failed resolving category \"raid\": %s\n", 118 118 str_error(rc)); 119 119 goto error; … … 122 122 rc = loc_service_add_to_cat(hr_srv, new_id, cat_id); 123 123 if (rc != EOK) { 124 ERR_PRINTF("failed adding \"%s\" to category \"raid\": %s\n",124 HR_ERROR("failed adding \"%s\" to category \"raid\": %s\n", 125 125 fullname, str_error(rc)); 126 126 goto error; … … 136 136 errno_t hr_check_devs(hr_volume_t *vol, uint64_t *rblkno, size_t *rbsize) 137 137 { 138 DPRINTF("hr_check_devs()\n");138 HR_DEBUG("hr_check_devs()\n"); 139 139 140 140 errno_t rc; … … 154 154 goto error; 155 155 if (last_nblocks != 0 && nblocks != last_nblocks) { 156 ERR_PRINTF("number of blocks differs\n");156 HR_ERROR("number of blocks differs\n"); 157 157 rc = EINVAL; 158 158 goto error; … … 171 171 goto error; 172 172 if (last_bsize != 0 && bsize != last_bsize) { 173 ERR_PRINTF("block sizes differ\n");173 HR_ERROR("block sizes differ\n"); 174 174 rc = EINVAL; 175 175 goto error; … … 180 180 181 181 if ((bsize % 512) != 0) { 182 ERR_PRINTF("block size not multiple of 512\n");182 HR_ERROR("block size not multiple of 512\n"); 183 183 return EINVAL; 184 184 } … … 206 206 void hr_update_ext_status(hr_volume_t *vol, uint64_t extent, hr_ext_status_t s) 207 207 { 208 log_msg(LOG_DEFAULT, LVL_WARN, 209 "vol %s, changing extent: %lu, to status: %s", 208 HR_WARN("vol %s, changing extent: %lu, to status: %s", 210 209 vol->devname, extent, hr_get_ext_status_msg(s)); 211 210 vol->extents[extent].status = s; -
uspace/srv/bd/hr/util.h
rdfa2313 rd199a6f 41 41 #include "var.h" 42 42 43 #define DPRINTF(format, ...) \43 #define HR_DEBUG(format, ...) \ 44 44 log_msg(LOG_DEFAULT, LVL_DEBUG, format, ##__VA_ARGS__) 45 45 46 #define ERR_PRINTF(format, ...) \ 46 #define HR_WARN(format, ...) \ 47 log_msg(LOG_DEFAULT, LVL_WARN, format, ##__VA_ARGS__) 48 49 #define HR_ERROR(format, ...) \ 47 50 log_msg(LOG_DEFAULT, LVL_ERROR, format, ##__VA_ARGS__) 48 51
Note:
See TracChangeset
for help on using the changeset viewer.