Changeset 800d188 in mainline for uspace/srv/bd/hr/io.c


Ignore:
Timestamp:
2025-04-15T07:00:31Z (2 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
29e7cc7
Parents:
ca7fa5b
git-author:
Miroslav Cimerman <mc@…> (2025-04-15 06:55:25)
git-committer:
Miroslav Cimerman <mc@…> (2025-04-15 07:00:31)
Message:

hr: metadata saving on stop

New bool argument for hr_metadata_save() to indicate if
we want callback too (on array stop we don't, so we won't
init a rebuild).

File:
1 edited

Legend:

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

    rca7fa5b r800d188  
    4545#include "var.h"
    4646
     47static errno_t exec_io_op(hr_io_t *);
     48
    4749errno_t hr_io_worker(void *arg)
    4850{
    4951        hr_io_t *io = arg;
     52
     53        errno_t rc = exec_io_op(io);
     54
     55        /*
     56         * We don't have to invalidate extents who got ENOMEM
     57         * on READ/SYNC. But when we get ENOMEM on a WRITE, we have
     58         * to invalidate it, because there could have been
     59         * other writes, there is no way to rollback.
     60         */
     61        if (rc != EOK && (rc != ENOMEM || io->type == HR_BD_WRITE))
     62                io->vol->state_callback(io->vol, io->extent, rc);
     63
     64        return rc;
     65}
     66
     67errno_t hr_io_worker_basic(void *arg)
     68{
     69        hr_io_t *io = arg;
     70
     71        errno_t rc = exec_io_op(io);
     72
     73        return rc;
     74}
     75
     76static errno_t exec_io_op(hr_io_t *io)
     77{
     78        size_t ext_idx = io->extent;
    5079        hr_extent_t *extents = (hr_extent_t *)&io->vol->extents;
    51         size_t ext_idx = io->extent;
    5280        errno_t rc;
    5381
     
    90118        HR_DEBUG("WORKER (%p) rc: %s\n", io, str_error(rc));
    91119
    92         /*
    93          * We don't have to invalidate extents who got ENOMEM
    94          * on READ/SYNC. But when we get ENOMEM on a WRITE, we have
    95          * to invalidate it, because there could have been
    96          * other writes, there is no way to rollback.
    97          */
    98         if (rc != EOK && (rc != ENOMEM || io->type == HR_BD_WRITE))
    99                 io->state_callback(io->vol, io->extent, rc);
    100 
    101120        return rc;
    102121}
Note: See TracChangeset for help on using the changeset viewer.