Changeset f0360ec in mainline for uspace/srv/bd/hr/raid1.c


Ignore:
Timestamp:
2025-06-17T22:33:02Z (7 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
f0cc1c64
Parents:
3c518fc
Message:

hr: RAID 0, 1: use ENOMEM safe primitives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/hr/raid1.c

    r3c518fc rf0360ec  
    174174
    175175        switch (rc) {
    176         case ENOMEM:
    177                 hr_update_ext_state(vol, extent, HR_EXT_INVALID);
    178                 break;
    179176        case ENOENT:
    180177                hr_update_ext_state(vol, extent, HR_EXT_MISSING);
     
    372369                        }
    373370
    374                         rc = block_read_direct(vol->extents[i].svc_id, ba, cnt,
     371                        rc = hr_read_direct(vol->extents[i].svc_id, ba, cnt,
    375372                            data_read);
    376 
    377                         if (rc == ENOMEM && i + 1 == vol->extent_no)
    378                                 goto end;
    379 
    380                         if (rc == ENOMEM)
    381                                 continue;
    382 
    383373                        if (rc != EOK) {
    384374                                hr_raid1_ext_state_cb(vol, i, rc);
     
    389379                }
    390380                break;
    391         case HR_BD_SYNC:
    392381        case HR_BD_WRITE:
    393                 if (type == HR_BD_WRITE) {
    394                         rl = hr_range_lock_acquire(vol, ba, cnt);
    395                         if (rl == NULL) {
    396                                 rc = ENOMEM;
    397                                 goto end;
    398                         }
    399                 }
     382                rl = hr_range_lock_acquire(vol, ba, cnt);
    400383
    401384                fibril_rwlock_read_lock(&vol->states_lock);
     
    408391
    409392                hr_fgroup_t *group = hr_fgroup_create(vol->fge, good);
    410                 if (group == NULL) {
    411                         if (type == HR_BD_WRITE)
    412                                 hr_range_lock_release(rl);
    413                         rc = ENOMEM;
    414                         fibril_rwlock_read_unlock(&vol->states_lock);
    415                         goto end;
    416                 }
    417393
    418394                for (i = 0; i < vol->extent_no; i++) {
     
    446422                (void)hr_fgroup_wait(group, &successful, NULL);
    447423
    448                 if (type == HR_BD_WRITE)
    449                         hr_range_lock_release(rl);
     424                hr_range_lock_release(rl);
    450425
    451426                break;
    452427        default:
    453                 rc = EINVAL;
    454                 goto end;
     428                assert(0);
    455429        }
    456430
     
    460434                rc = EIO;
    461435
    462 end:
    463436        fibril_rwlock_read_unlock(&vol->extents_lock);
    464437
Note: See TracChangeset for help on using the changeset viewer.