Changeset ca212a51 in mainline


Ignore:
Timestamp:
2025-07-11T20:13:38Z (12 days ago)
Author:
Miroslav Cimerman <mc@…>
Children:
a0abd46
Parents:
b127da2f
Message:

hr: RAID 0, 5: init strip size to closest (down) pow of 2

Location:
uspace/srv/bd/hr
Files:
4 edited

Legend:

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

    rb127da2f rca212a51  
    123123        vol->data_blkno -= vol->meta_ops->get_size() * vol->extent_no;
    124124
    125         vol->strip_size = HR_STRIP_SIZE;
     125        vol->strip_size = hr_closest_pow2(HR_STRIP_SIZE / vol->extent_no);
    126126
    127127        return EOK;
  • uspace/srv/bd/hr/raid5.c

    rb127da2f rca212a51  
    131131        vol->data_blkno = single_sz * (vol->extent_no - 1);
    132132
    133         vol->strip_size = HR_STRIP_SIZE;
     133        vol->strip_size = hr_closest_pow2(HR_STRIP_SIZE / (vol->extent_no - 1));
    134134
    135135        if (vol->level == HR_LVL_4)
  • uspace/srv/bd/hr/util.c

    rb127da2f rca212a51  
    12541254}
    12551255
     1256uint32_t hr_closest_pow2(uint32_t n)
     1257{
     1258        if (n == 0)
     1259                return 0;
     1260
     1261        n |= (n >> 1);
     1262        n |= (n >> 2);
     1263        n |= (n >> 4);
     1264        n |= (n >> 8);
     1265        n |= (n >> 16);
     1266        return n - (n >> 1);
     1267}
     1268
    12561269/** @}
    12571270 */
  • uspace/srv/bd/hr/util.h

    rb127da2f rca212a51  
    111111extern errno_t hr_sync_extents(hr_volume_t *);
    112112extern errno_t hr_init_rebuild(hr_volume_t *, size_t *);
     113extern uint32_t hr_closest_pow2(uint32_t);
    113114
    114115#endif
Note: See TracChangeset for help on using the changeset viewer.