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


Ignore:
Timestamp:
2024-10-05T13:11:11Z (8 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
dceb6e7
Parents:
dbd91da
git-author:
Miroslav Cimerman <mc@…> (2024-10-05 12:39:13)
git-committer:
Miroslav Cimerman <mc@…> (2024-10-05 13:11:11)
Message:

hr: init fuction for each RAID level

Compute total blocks, data blocks and set block size, data offset, strip
size there.

File:
1 edited

Legend:

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

    rdbd91da r6b8e89b0  
    4747#include <str_error.h>
    4848
     49#include "superblock.h"
    4950#include "util.h"
    5051#include "var.h"
     
    201202}
    202203
     204errno_t hr_raid1_init(hr_volume_t *vol)
     205{
     206        errno_t rc;
     207        size_t bsize;
     208        uint64_t total_blkno;
     209
     210        assert(vol->level == hr_l_1);
     211
     212        rc = hr_check_devs(vol, &total_blkno, &bsize);
     213        if (rc != EOK)
     214                return rc;
     215
     216        vol->nblocks = total_blkno / vol->dev_no;
     217        vol->bsize = bsize;
     218        vol->data_offset = HR_DATA_OFF;
     219        vol->data_blkno = vol->nblocks - vol->data_offset;
     220        vol->strip_size = 0;
     221
     222        return EOK;
     223}
     224
    203225/** @}
    204226 */
Note: See TracChangeset for help on using the changeset viewer.