Changeset 6d0fc11 in mainline


Ignore:
Timestamp:
2025-03-30T19:38:58Z (2 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
baa4929
Parents:
746e636
Message:

hr: style: align structures, function prototypes

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

Legend:

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

    r746e636 r6d0fc11  
    5353#include "fge.h"
    5454
     55/* forward declarations */
    5556struct fge_fibril_data;
    5657typedef struct fge_fibril_data fge_fibril_data_t;
     
    5859typedef struct wu_queue wu_queue_t;
    5960
    60 static void *hr_fpool_make_storage(hr_fpool_t *, ssize_t *);
    61 static void hr_fpool_group_epilogue(hr_fpool_t *);
    62 static errno_t fge_fibril(void *);
    63 static errno_t wu_queue_init(wu_queue_t *, size_t);
    64 static void wu_queue_push(wu_queue_t *, fge_fibril_data_t *);
    65 static void wu_queue_pop(wu_queue_t *, fge_fibril_data_t *);
    66 static ssize_t hr_fpool_get_free_slot(hr_fpool_t *);
    67 
    68 typedef struct fge_fibril_data {
    69         hr_wu_t wu; /* user-provided work unit fcn pointer */
    70         void *arg;
    71         hr_fgroup_t *group;
    72         ssize_t memslot; /* index to pool bitmap slot */
    73 } fge_fibril_data_t;
    74 
    75 typedef struct wu_queue {
    76         fibril_mutex_t lock;
    77         fibril_condvar_t not_empty;
    78         fibril_condvar_t not_full;
    79         fge_fibril_data_t *fexecs;
     61static void     *hr_fpool_make_storage(hr_fpool_t *, ssize_t *);
     62static void      hr_fpool_group_epilogue(hr_fpool_t *);
     63static errno_t  fge_fibril(void *);
     64static errno_t  wu_queue_init(wu_queue_t *, size_t);
     65static void      wu_queue_push(wu_queue_t *, fge_fibril_data_t *);
     66static void      wu_queue_pop(wu_queue_t *, fge_fibril_data_t *);
     67static ssize_t  hr_fpool_get_free_slot(hr_fpool_t *);
     68
     69struct fge_fibril_data {
     70        hr_wu_t          wu;            /* work unit function pointer */
     71        void            *arg;           /* work unit function argument */
     72        hr_fgroup_t     *group;         /* back-pointer to group */
     73        ssize_t          memslot;       /* index to pool bitmap slot */
     74};
     75
     76struct wu_queue {
     77        fibril_mutex_t          lock;
     78        fibril_condvar_t        not_empty;
     79        fibril_condvar_t        not_full;
     80        fge_fibril_data_t       *fexecs;        /* circ-buf memory */
    8081        circ_buf_t cbuf;
    81 } wu_queue_t;
     82};
    8283
    8384struct hr_fpool {
    84         fibril_mutex_t lock;
     85        fibril_mutex_t   lock;
     86        bitmap_t         bitmap;        /* memory slot bitmap */
     87        wu_queue_t       queue;
     88        fid_t           *fibrils;
     89        uint8_t         *wu_storage;    /* pre-allocated pool storage */
     90        size_t           fibril_cnt;
     91        size_t           max_wus;
     92        size_t           active_groups;
     93        bool             stop;
     94        size_t           wu_size;
     95        size_t           wu_storage_free_count;
    8596        fibril_condvar_t all_wus_done;
    86         bitmap_t bitmap;
    87         wu_queue_t queue;
    88         fid_t *fibrils;
    89         uint8_t *wu_storage;
    90         size_t fibril_cnt;
    91         size_t max_wus;
    92         size_t active_groups;
    93         bool stop;
    94         size_t wu_size;
    95         size_t wu_storage_free_count;
    9697};
    9798
    9899struct hr_fgroup {
    99         hr_fpool_t *pool;
    100         size_t wu_cnt;          /* total wu count */
    101         size_t submitted;
    102         size_t reserved_cnt;    /* no. of reserved wu storage slots */
    103         size_t reserved_avail;
    104         size_t *memslots;       /* indices to pool bitmap */
    105         void *own_mem;
    106         size_t own_used;
    107         errno_t final_errno;
    108         size_t finished_okay;
    109         size_t finished_fail;
    110         fibril_mutex_t lock;
     100        hr_fpool_t      *pool;          /* back-pointer to pool */
     101        size_t           wu_cnt;        /* upper bound of work units */
     102        size_t           submitted;     /* number of submitted jobs */
     103        size_t          reserved_cnt;  /* no. of reserved wu storage slots */
     104        size_t          reserved_avail;
     105        size_t          *memslots;      /* indices to pool bitmap */
     106        void            *own_mem;       /* own allocated memory */
     107        size_t           own_used;      /* own memory slots used counter */
     108        errno_t          final_errno;   /* agreggated errno */
     109        size_t           finished_okay; /* no. of wus that ended with EOK */
     110        size_t           finished_fail; /* no. of wus that ended with != EOK */
     111        fibril_mutex_t  lock;
    111112        fibril_condvar_t all_done;
    112113};
  • uspace/srv/bd/hr/fge.h

    r746e636 r6d0fc11  
    11/*
    2  * Copyright (c) 2024 Miroslav Cimerman
     2 * Copyright (c) 2025 Miroslav Cimerman
    33 * Copyright (c) 2024 Vojtech Horky
    44 * All rights reserved.
     
    4848typedef errno_t (*hr_wu_t)(void *);
    4949
    50 extern hr_fpool_t *hr_fpool_create(size_t, size_t, size_t);
    51 extern void hr_fpool_destroy(hr_fpool_t *);
    52 extern hr_fgroup_t *hr_fgroup_create(hr_fpool_t *, size_t);
    53 extern void *hr_fgroup_alloc(hr_fgroup_t *);
    54 extern void hr_fgroup_submit(hr_fgroup_t *, hr_wu_t, void *);
    55 extern errno_t hr_fgroup_wait(hr_fgroup_t *, size_t *, size_t *);
     50extern hr_fpool_t       *hr_fpool_create(size_t, size_t, size_t);
     51extern void              hr_fpool_destroy(hr_fpool_t *);
     52extern hr_fgroup_t      *hr_fgroup_create(hr_fpool_t *, size_t);
     53extern void             *hr_fgroup_alloc(hr_fgroup_t *);
     54extern void              hr_fgroup_submit(hr_fgroup_t *, hr_wu_t, void *);
     55extern errno_t          hr_fgroup_wait(hr_fgroup_t *, size_t *, size_t *);
    5656
    5757#endif
  • uspace/srv/bd/hr/hr.c

    r746e636 r6d0fc11  
    5858#include "var.h"
    5959
     60static void hr_assemble_srv(ipc_call_t *);
     61static void hr_auto_assemble_srv(ipc_call_t *);
     62static void hr_stop_srv(ipc_call_t *);
     63static void hr_add_hotspare_srv(ipc_call_t *);
     64static void hr_print_status_srv(ipc_call_t *);
     65static void hr_ctl_conn(ipc_call_t *, void *);
     66static void hr_client_conn(ipc_call_t *, void *);
     67
    6068loc_srv_t *hr_srv;
    6169list_t hr_volumes;
     
    6371
    6472static service_id_t ctl_sid;
    65 
    66 static void hr_auto_assemble_srv(ipc_call_t *icall)
    67 {
    68         HR_DEBUG("%s()", __func__);
    69 
    70         errno_t rc;
    71         size_t size;
    72         size_t assembled_cnt = 0;
    73         ipc_call_t call;
    74 
    75         if (!async_data_read_receive(&call, &size)) {
    76                 async_answer_0(icall, EREFUSED);
    77                 return;
    78         }
    79 
    80         if (size != sizeof(size_t)) {
    81                 async_answer_0(&call, EINVAL);
    82                 async_answer_0(icall, EINVAL);
    83                 return;
    84         }
    85 
    86         rc = hr_util_try_assemble(NULL, &assembled_cnt);
    87         if (rc != EOK)
    88                 goto error;
    89 
    90         rc = async_data_read_finalize(&call, &assembled_cnt, size);
    91         if (rc != EOK)
    92                 goto error;
    93 
    94         async_answer_0(icall, EOK);
    95         return;
    96 error:
    97         async_answer_0(&call, rc);
    98         async_answer_0(icall, rc);
    99 }
    100 
    101 static void hr_assemble_srv(ipc_call_t *icall)
    102 {
    103         HR_DEBUG("%s()", __func__);
    104 
    105         errno_t rc;
    106         size_t size, assembled_cnt;
    107         hr_config_t *cfg;
    108         ipc_call_t call;
    109 
    110         if (!async_data_write_receive(&call, &size)) {
    111                 async_answer_0(&call, EREFUSED);
    112                 async_answer_0(icall, EREFUSED);
    113                 return;
    114         }
    115 
    116         if (size != sizeof(hr_config_t)) {
    117                 async_answer_0(&call, EINVAL);
    118                 async_answer_0(icall, EINVAL);
    119                 return;
    120         }
    121 
    122         cfg = calloc(1, sizeof(hr_config_t));
    123         if (cfg == NULL) {
    124                 async_answer_0(&call, ENOMEM);
    125                 async_answer_0(icall, ENOMEM);
    126                 return;
    127         }
    128 
    129         rc = async_data_write_finalize(&call, cfg, size);
    130         if (rc != EOK)
    131                 goto error;
    132 
    133         if (!async_data_read_receive(&call, &size)) {
    134                 async_answer_0(icall, EREFUSED);
    135                 return;
    136         }
    137 
    138         if (size != sizeof(size_t)) {
    139                 async_answer_0(icall, EINVAL);
    140                 return;
    141         }
    142 
    143         rc = hr_util_try_assemble(cfg, &assembled_cnt);
    144         if (rc != EOK)
    145                 goto error;
    146 
    147         rc = async_data_read_finalize(&call, &assembled_cnt, size);
    148         if (rc != EOK)
    149                 goto error;
    150 
    151         free(cfg);
    152         async_answer_0(icall, EOK);
    153         return;
    154 error:
    155         free(cfg);
    156         async_answer_0(&call, rc);
    157         async_answer_0(icall, rc);
    158 }
    15973
    16074static void hr_create_srv(ipc_call_t *icall)
     
    264178        free(cfg);
    265179        hr_destroy_vol_struct(new_volume);
     180        async_answer_0(icall, rc);
     181}
     182
     183static void hr_assemble_srv(ipc_call_t *icall)
     184{
     185        HR_DEBUG("%s()", __func__);
     186
     187        errno_t rc;
     188        size_t size, assembled_cnt;
     189        hr_config_t *cfg;
     190        ipc_call_t call;
     191
     192        if (!async_data_write_receive(&call, &size)) {
     193                async_answer_0(&call, EREFUSED);
     194                async_answer_0(icall, EREFUSED);
     195                return;
     196        }
     197
     198        if (size != sizeof(hr_config_t)) {
     199                async_answer_0(&call, EINVAL);
     200                async_answer_0(icall, EINVAL);
     201                return;
     202        }
     203
     204        cfg = calloc(1, sizeof(hr_config_t));
     205        if (cfg == NULL) {
     206                async_answer_0(&call, ENOMEM);
     207                async_answer_0(icall, ENOMEM);
     208                return;
     209        }
     210
     211        rc = async_data_write_finalize(&call, cfg, size);
     212        if (rc != EOK)
     213                goto error;
     214
     215        if (!async_data_read_receive(&call, &size)) {
     216                async_answer_0(icall, EREFUSED);
     217                return;
     218        }
     219
     220        if (size != sizeof(size_t)) {
     221                async_answer_0(icall, EINVAL);
     222                return;
     223        }
     224
     225        rc = hr_util_try_assemble(cfg, &assembled_cnt);
     226        if (rc != EOK)
     227                goto error;
     228
     229        rc = async_data_read_finalize(&call, &assembled_cnt, size);
     230        if (rc != EOK)
     231                goto error;
     232
     233        free(cfg);
     234        async_answer_0(icall, EOK);
     235        return;
     236error:
     237        free(cfg);
     238        async_answer_0(&call, rc);
     239        async_answer_0(icall, rc);
     240}
     241
     242static void hr_auto_assemble_srv(ipc_call_t *icall)
     243{
     244        HR_DEBUG("%s()", __func__);
     245
     246        errno_t rc;
     247        size_t size;
     248        size_t assembled_cnt = 0;
     249        ipc_call_t call;
     250
     251        if (!async_data_read_receive(&call, &size)) {
     252                async_answer_0(icall, EREFUSED);
     253                return;
     254        }
     255
     256        if (size != sizeof(size_t)) {
     257                async_answer_0(&call, EINVAL);
     258                async_answer_0(icall, EINVAL);
     259                return;
     260        }
     261
     262        rc = hr_util_try_assemble(NULL, &assembled_cnt);
     263        if (rc != EOK)
     264                goto error;
     265
     266        rc = async_data_read_finalize(&call, &assembled_cnt, size);
     267        if (rc != EOK)
     268                goto error;
     269
     270        async_answer_0(icall, EOK);
     271        return;
     272error:
     273        async_answer_0(&call, rc);
    266274        async_answer_0(icall, rc);
    267275}
  • uspace/srv/bd/hr/io.h

    r746e636 r6d0fc11  
    4040
    4141typedef struct hr_io {
    42         hr_bd_op_type_t type;
    43         uint64_t ba;
    44         uint64_t cnt;
    45         size_t extent;
    46         void *data_read;
    47         const void *data_write;
    48         hr_volume_t *vol;
    49         void (*state_callback)(hr_volume_t *, size_t, errno_t);
     42        hr_bd_op_type_t  type;
     43        uint64_t        ba;
     44        uint64_t        cnt;
     45        size_t          extent;
     46        void            *data_read;
     47        const void      *data_write;
     48        hr_volume_t     *vol;
     49        void            (*state_callback)(hr_volume_t *, size_t, errno_t);
    5050} hr_io_t;
    5151
  • uspace/srv/bd/hr/raid0.c

    r746e636 r6d0fc11  
    5353#include "var.h"
    5454
     55static void     hr_raid0_update_vol_status(hr_volume_t *);
     56static void     raid0_state_callback(hr_volume_t *, size_t, errno_t);
     57static errno_t  hr_raid0_bd_op(hr_bd_op_type_t, bd_srv_t *, aoff64_t, size_t,
     58    void *, const void *, size_t);
     59
     60/* bdops */
     61static errno_t  hr_raid0_bd_open(bd_srvs_t *, bd_srv_t *);
     62static errno_t  hr_raid0_bd_close(bd_srv_t *);
     63static errno_t  hr_raid0_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *,
     64    size_t);
     65static errno_t  hr_raid0_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
     66static errno_t  hr_raid0_bd_write_blocks(bd_srv_t *, aoff64_t, size_t,
     67    const void *, size_t);
     68static errno_t  hr_raid0_bd_get_block_size(bd_srv_t *, size_t *);
     69static errno_t  hr_raid0_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
     70
     71static bd_ops_t hr_raid0_bd_ops = {
     72        .open           = hr_raid0_bd_open,
     73        .close          = hr_raid0_bd_close,
     74        .sync_cache     = hr_raid0_bd_sync_cache,
     75        .read_blocks    = hr_raid0_bd_read_blocks,
     76        .write_blocks   = hr_raid0_bd_write_blocks,
     77        .get_block_size = hr_raid0_bd_get_block_size,
     78        .get_num_blocks = hr_raid0_bd_get_num_blocks
     79};
     80
    5581extern loc_srv_t *hr_srv;
    56 
    57 static void hr_raid0_update_vol_status(hr_volume_t *);
    58 static errno_t hr_raid0_bd_op(hr_bd_op_type_t, bd_srv_t *, aoff64_t, size_t,
    59     void *, const void *, size_t);
    60 
    61 /* bdops */
    62 static errno_t hr_raid0_bd_open(bd_srvs_t *, bd_srv_t *);
    63 static errno_t hr_raid0_bd_close(bd_srv_t *);
    64 static errno_t hr_raid0_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *,
    65     size_t);
    66 static errno_t hr_raid0_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
    67 static errno_t hr_raid0_bd_write_blocks(bd_srv_t *, aoff64_t, size_t,
    68     const void *, size_t);
    69 static errno_t hr_raid0_bd_get_block_size(bd_srv_t *, size_t *);
    70 static errno_t hr_raid0_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
    71 
    72 static bd_ops_t hr_raid0_bd_ops = {
    73         .open = hr_raid0_bd_open,
    74         .close = hr_raid0_bd_close,
    75         .sync_cache = hr_raid0_bd_sync_cache,
    76         .read_blocks = hr_raid0_bd_read_blocks,
    77         .write_blocks = hr_raid0_bd_write_blocks,
    78         .get_block_size = hr_raid0_bd_get_block_size,
    79         .get_num_blocks = hr_raid0_bd_get_num_blocks
    80 };
    8182
    8283errno_t hr_raid0_create(hr_volume_t *new_volume)
  • uspace/srv/bd/hr/raid1.c

    r746e636 r6d0fc11  
    5454#include "var.h"
    5555
     56static void     hr_raid1_update_vol_status(hr_volume_t *);
     57static void     hr_raid1_ext_state_callback(hr_volume_t *, size_t, errno_t);
     58static size_t   hr_raid1_count_good_extents(hr_volume_t *, uint64_t, size_t,
     59    uint64_t);
     60static errno_t  hr_raid1_bd_op(hr_bd_op_type_t, bd_srv_t *, aoff64_t, size_t,
     61    void *, const void *, size_t);
     62static errno_t  hr_raid1_rebuild(void *);
     63static errno_t  init_rebuild(hr_volume_t *, size_t *);
     64static errno_t  swap_hs(hr_volume_t *, size_t, size_t);
     65static errno_t  hr_raid1_restore_blocks(hr_volume_t *, size_t, uint64_t, size_t,
     66    void *);
     67
     68/* bdops */
     69static errno_t  hr_raid1_bd_open(bd_srvs_t *, bd_srv_t *);
     70static errno_t  hr_raid1_bd_close(bd_srv_t *);
     71static errno_t  hr_raid1_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *,
     72    size_t);
     73static errno_t  hr_raid1_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
     74static errno_t  hr_raid1_bd_write_blocks(bd_srv_t *, aoff64_t, size_t,
     75    const void *, size_t);
     76static errno_t  hr_raid1_bd_get_block_size(bd_srv_t *, size_t *);
     77static errno_t  hr_raid1_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
     78
     79static bd_ops_t hr_raid1_bd_ops = {
     80        .open           = hr_raid1_bd_open,
     81        .close          = hr_raid1_bd_close,
     82        .sync_cache     = hr_raid1_bd_sync_cache,
     83        .read_blocks    = hr_raid1_bd_read_blocks,
     84        .write_blocks   = hr_raid1_bd_write_blocks,
     85        .get_block_size = hr_raid1_bd_get_block_size,
     86        .get_num_blocks = hr_raid1_bd_get_num_blocks
     87};
     88
    5689extern loc_srv_t *hr_srv;
    57 
    58 static void hr_raid1_update_vol_status(hr_volume_t *);
    59 static void hr_raid1_ext_state_callback(hr_volume_t *, size_t, errno_t);
    60 static size_t hr_raid1_count_good_extents(hr_volume_t *, uint64_t, size_t,
    61     uint64_t);
    62 static errno_t hr_raid1_bd_op(hr_bd_op_type_t, bd_srv_t *, aoff64_t, size_t,
    63     void *, const void *, size_t);
    64 static errno_t hr_raid1_rebuild(void *);
    65 static errno_t init_rebuild(hr_volume_t *, size_t *);
    66 static errno_t swap_hs(hr_volume_t *, size_t, size_t);
    67 static errno_t hr_raid1_restore_blocks(hr_volume_t *, size_t, uint64_t, size_t,
    68     void *);
    69 
    70 /* bdops */
    71 static errno_t hr_raid1_bd_open(bd_srvs_t *, bd_srv_t *);
    72 static errno_t hr_raid1_bd_close(bd_srv_t *);
    73 static errno_t hr_raid1_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *,
    74     size_t);
    75 static errno_t hr_raid1_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
    76 static errno_t hr_raid1_bd_write_blocks(bd_srv_t *, aoff64_t, size_t,
    77     const void *, size_t);
    78 static errno_t hr_raid1_bd_get_block_size(bd_srv_t *, size_t *);
    79 static errno_t hr_raid1_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
    80 
    81 static bd_ops_t hr_raid1_bd_ops = {
    82         .open = hr_raid1_bd_open,
    83         .close = hr_raid1_bd_close,
    84         .sync_cache = hr_raid1_bd_sync_cache,
    85         .read_blocks = hr_raid1_bd_read_blocks,
    86         .write_blocks = hr_raid1_bd_write_blocks,
    87         .get_block_size = hr_raid1_bd_get_block_size,
    88         .get_num_blocks = hr_raid1_bd_get_num_blocks
    89 };
    9090
    9191errno_t hr_raid1_create(hr_volume_t *new_volume)
  • uspace/srv/bd/hr/raid5.c

    r746e636 r6d0fc11  
    5353#include "var.h"
    5454
     55static errno_t  hr_raid5_vol_usable(hr_volume_t *);
     56static ssize_t  hr_raid5_get_bad_ext(hr_volume_t *);
     57static errno_t  hr_raid5_update_vol_status(hr_volume_t *);
     58static void     hr_raid5_handle_extent_error(hr_volume_t *, size_t, errno_t);
     59static void     xor(void *, const void *, size_t);
     60static errno_t  hr_raid5_read_degraded(hr_volume_t *, uint64_t, uint64_t,
     61    void *, size_t);
     62static errno_t  hr_raid5_write(hr_volume_t *, uint64_t, uint64_t, aoff64_t,
     63    const void *, size_t);
     64static errno_t  hr_raid5_write_parity(hr_volume_t *, uint64_t, uint64_t,
     65    uint64_t, const void *, size_t);
     66static errno_t  hr_raid5_bd_op(hr_bd_op_type_t, bd_srv_t *, aoff64_t, size_t,
     67    void *, const void *, size_t);
     68static errno_t  hr_raid5_rebuild(void *);
     69
     70/* bdops */
     71static errno_t  hr_raid5_bd_open(bd_srvs_t *, bd_srv_t *);
     72static errno_t  hr_raid5_bd_close(bd_srv_t *);
     73static errno_t  hr_raid5_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *,
     74    size_t);
     75static errno_t  hr_raid5_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
     76static errno_t  hr_raid5_bd_write_blocks(bd_srv_t *, aoff64_t, size_t,
     77    const void *, size_t);
     78static errno_t  hr_raid5_bd_get_block_size(bd_srv_t *, size_t *);
     79static errno_t  hr_raid5_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
     80
     81static bd_ops_t hr_raid5_bd_ops = {
     82        .open           = hr_raid5_bd_open,
     83        .close          = hr_raid5_bd_close,
     84        .sync_cache     = hr_raid5_bd_sync_cache,
     85        .read_blocks    = hr_raid5_bd_read_blocks,
     86        .write_blocks   = hr_raid5_bd_write_blocks,
     87        .get_block_size = hr_raid5_bd_get_block_size,
     88        .get_num_blocks = hr_raid5_bd_get_num_blocks
     89};
     90
    5591extern loc_srv_t *hr_srv;
    56 
    57 static errno_t hr_raid5_vol_usable(hr_volume_t *);
    58 static ssize_t hr_raid5_get_bad_ext(hr_volume_t *);
    59 static errno_t hr_raid5_update_vol_status(hr_volume_t *);
    60 static void hr_raid5_handle_extent_error(hr_volume_t *, size_t, errno_t);
    61 static void xor(void *, const void *, size_t);
    62 static errno_t hr_raid5_read_degraded(hr_volume_t *, uint64_t, uint64_t,
    63     void *, size_t);
    64 static errno_t hr_raid5_write(hr_volume_t *, uint64_t, uint64_t, aoff64_t,
    65     const void *, size_t);
    66 static errno_t hr_raid5_write_parity(hr_volume_t *, uint64_t, uint64_t,
    67     uint64_t, const void *, size_t);
    68 static errno_t hr_raid5_bd_op(hr_bd_op_type_t, bd_srv_t *, aoff64_t, size_t,
    69     void *, const void *, size_t);
    70 static errno_t hr_raid5_rebuild(void *);
    71 
    72 /* bdops */
    73 static errno_t hr_raid5_bd_open(bd_srvs_t *, bd_srv_t *);
    74 static errno_t hr_raid5_bd_close(bd_srv_t *);
    75 static errno_t hr_raid5_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *,
    76     size_t);
    77 static errno_t hr_raid5_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
    78 static errno_t hr_raid5_bd_write_blocks(bd_srv_t *, aoff64_t, size_t,
    79     const void *, size_t);
    80 static errno_t hr_raid5_bd_get_block_size(bd_srv_t *, size_t *);
    81 static errno_t hr_raid5_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
    82 
    83 static bd_ops_t hr_raid5_bd_ops = {
    84         .open = hr_raid5_bd_open,
    85         .close = hr_raid5_bd_close,
    86         .sync_cache = hr_raid5_bd_sync_cache,
    87         .read_blocks = hr_raid5_bd_read_blocks,
    88         .write_blocks = hr_raid5_bd_write_blocks,
    89         .get_block_size = hr_raid5_bd_get_block_size,
    90         .get_num_blocks = hr_raid5_bd_get_num_blocks
    91 };
    9292
    9393errno_t hr_raid5_create(hr_volume_t *new_volume)
  • uspace/srv/bd/hr/superblock.h

    r746e636 r6d0fc11  
    6363        uint64_t        data_offset;
    6464
    65         uint64_t        counter;                /* yet unused */
    66         uint32_t        version;                /* yet unused */
     65        uint64_t        counter;                /* XXX: yet unused */
     66        uint32_t        version;                /* XXX: yet unused */
    6767        uint32_t        extent_no;
    6868
  • uspace/srv/bd/hr/util.c

    r746e636 r6d0fc11  
    5353#include "var.h"
    5454
     55struct svc_id_linked;
     56
     57static bool     hr_range_lock_overlap(hr_range_lock_t *, hr_range_lock_t *);
     58static errno_t  hr_add_svc_linked_to_list(list_t *, service_id_t, bool,
     59    hr_metadata_t *);
     60static void     free_svc_id_linked(struct svc_id_linked *);
     61static void     free_svc_id_list(list_t *);
     62static errno_t  hr_fill_disk_part_svcs_list(list_t *);
     63static errno_t  block_init_dev_list(list_t *);
     64static void     block_fini_dev_list(list_t *);
     65static errno_t  hr_util_get_matching_md_svcs_list(list_t *, list_t *,
     66    service_id_t, hr_metadata_t *);
     67static errno_t  hr_util_assemble_from_matching_list(list_t *);
     68static errno_t  hr_fill_svcs_list_from_cfg(hr_config_t *, list_t *);
     69
    5570#define HR_RL_LIST_LOCK(vol) (fibril_mutex_lock(&vol->range_lock_list_lock))
    5671#define HR_RL_LIST_UNLOCK(vol) \
    5772    (fibril_mutex_unlock(&vol->range_lock_list_lock))
    5873
    59 static bool hr_range_lock_overlap(hr_range_lock_t *, hr_range_lock_t *);
     74struct svc_id_linked {
     75        link_t           link;
     76        service_id_t     svc_id;
     77        hr_metadata_t   *md;
     78        bool             inited;
     79        bool             md_present;
     80};
    6081
    6182extern loc_srv_t *hr_srv;
     
    586607}
    587608
    588 struct svc_id_linked {
    589         link_t link;
    590         service_id_t svc_id;
    591         hr_metadata_t *md;
    592         bool inited;
    593         bool md_present;
    594 };
    595 
    596609static errno_t hr_add_svc_linked_to_list(list_t *list, service_id_t svc_id,
    597610    bool inited, hr_metadata_t *md)
Note: See TracChangeset for help on using the changeset viewer.