Changeset 52af125 in mainline


Ignore:
Timestamp:
2024-11-08T15:08:30Z (6 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
5f543e9
Parents:
1cfa162
Message:

hr: add hr_sync_all_extents()

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

Legend:

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

    r1cfa162 r52af125  
    204204}
    205205
     206/*
     207 * Do a whole sync (ba = 0, cnt = 0) across all extents,
     208 * and update extent status. *For now*, the caller has to
     209 * update volume status after the syncs.
     210 *
     211 * TODO: add update_vol_status fcn ptr for each raid
     212 */
     213void hr_sync_all_extents(hr_volume_t *vol)
     214{
     215        errno_t rc;
     216
     217        fibril_mutex_lock(&vol->lock);
     218        for (size_t i = 0; i < vol->dev_no; i++) {
     219                if (vol->extents[i].status != HR_EXT_ONLINE)
     220                        continue;
     221                rc = block_sync_cache(vol->extents[i].svc_id, 0, 0);
     222                if (rc != EOK && rc != ENOTSUP) {
     223                        if (rc == ENOENT)
     224                                hr_update_ext_status(vol, i, HR_EXT_MISSING);
     225                        else if (rc != EOK)
     226                                hr_update_ext_status(vol, i, HR_EXT_FAILED);
     227                }
     228        }
     229        fibril_mutex_unlock(&vol->lock);
     230}
     231
    206232/** @}
    207233 */
  • uspace/srv/bd/hr/util.h

    r1cfa162 r52af125  
    4848extern void hr_add_ba_offset(hr_volume_t *, uint64_t *);
    4949extern void hr_update_ext_status(hr_volume_t *, uint64_t, hr_ext_status_t);
     50extern void hr_sync_all_extents(hr_volume_t *);
    5051
    5152#endif
Note: See TracChangeset for help on using the changeset viewer.