Changeset f0360ec in mainline for uspace/srv/bd/hr/io.c
- Timestamp:
- 2025-06-17T22:33:02Z (8 months ago)
- Children:
- f0cc1c64
- Parents:
- 3c518fc
- File:
-
- 1 edited
-
uspace/srv/bd/hr/io.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/io.c
r3c518fc rf0360ec 48 48 #include "var.h" 49 49 50 static errno_t exec_io_op(hr_io_t *);51 52 50 /** Wrapper for block_write_direct(), never returns ENOMEM */ 53 51 errno_t hr_write_direct(service_id_t service_id, uint64_t ba, size_t cnt, … … 95 93 hr_io_t *io = arg; 96 94 97 errno_t rc = exec_io_op(io);98 99 /*100 * We don't have to invalidate extents who got ENOMEM 101 * on READ/SYNC. But when we get ENOMEM on a WRITE, we have102 * to invalidate it, because there could have been103 * other writes, there is no way to rollback.104 */105 if (rc != EOK && (rc != ENOMEM || io->type == HR_BD_WRITE))106 io->vol->hr_ops.ext_state_cb(io->vol, io->extent, rc);107 108 return rc;109 } 110 111 errno_t hr_io_worker_basic(void *arg) 112 { 113 hr_io_t *io = arg; 114 115 errno_t rc = exec_io_op(io);95 errno_t rc; 96 size_t e = io->extent; 97 hr_extent_t *extents = (hr_extent_t *)&io->vol->extents; 98 99 switch (io->type) { 100 case HR_BD_READ: 101 rc = hr_read_direct(extents[e].svc_id, io->ba, io->cnt, 102 io->data_read); 103 break; 104 case HR_BD_WRITE: 105 rc = hr_write_direct(extents[e].svc_id, io->ba, io->cnt, 106 io->data_write); 107 break; 108 default: 109 assert(0); 110 } 111 112 if (rc != EOK) 113 io->vol->hr_ops.ext_state_cb(io->vol, io->extent, rc); 116 114 117 115 return rc; … … 322 320 } 323 321 324 static errno_t exec_io_op(hr_io_t *io)325 {326 size_t ext_idx = io->extent;327 hr_extent_t *extents = (hr_extent_t *)&io->vol->extents;328 errno_t rc;329 330 const char *debug_type_str = NULL;331 switch (io->type) {332 case HR_BD_SYNC:333 debug_type_str = "SYNC";334 break;335 case HR_BD_READ:336 debug_type_str = "READ";337 break;338 case HR_BD_WRITE:339 debug_type_str = "WRITE";340 break;341 }342 343 HR_DEBUG("%s WORKER (%p) on extent: %zu, ba: %" PRIu64 ", "344 "cnt: %" PRIu64 "\n",345 debug_type_str, io, io->extent, io->ba, io->cnt);346 347 switch (io->type) {348 case HR_BD_SYNC:349 rc = block_sync_cache(extents[ext_idx].svc_id,350 io->ba, io->cnt);351 if (rc == ENOTSUP)352 rc = EOK;353 break;354 case HR_BD_READ:355 rc = block_read_direct(extents[ext_idx].svc_id, io->ba,356 io->cnt, io->data_read);357 break;358 case HR_BD_WRITE:359 rc = block_write_direct(extents[ext_idx].svc_id, io->ba,360 io->cnt, io->data_write);361 break;362 default:363 assert(0);364 }365 366 HR_DEBUG("WORKER (%p) rc: %s\n", io, str_error(rc));367 368 return rc;369 }370 371 322 /** @} 372 323 */
Note:
See TracChangeset
for help on using the changeset viewer.
