Changeset 059885c in mainline


Ignore:
Timestamp:
2025-06-30T10:55:31Z (4 weeks ago)
Author:
Miroslav Cimerman <mc@…>
Children:
d04a350
Parents:
95ca19d
Message:

hr: metadata/softraid: fix and allow rebuild

Location:
uspace/srv/bd/hr/metadata/foreign/softraid
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/hr/metadata/foreign/softraid/hr_softraid.c

    r95ca19d r059885c  
    182182        memcpy(vol->in_mem_md, main_meta, SR_META_SIZE * DEV_BSIZE);
    183183
    184         bool rebuild = false;
     184        bool rebuild_set = false;
    185185        list_foreach(*list, link, struct dev_list_member, iter) {
    186186                struct sr_metadata *iter_meta = iter->md;
     
    195195
    196196                bool invalidate = false;
     197                bool rebuild_this_ext = false;
    197198
    198199                if (iter_meta->ssd_meta_flags & SR_META_DIRTY)
     
    202203
    203204                if (mc->scm_status == BIOC_SDREBUILD && !invalidate) {
    204                         if (rebuild) {
     205                        if (rebuild_set) {
    205206                                HR_DEBUG("only 1 rebuilt extent allowed");
    206207                                rc = EINVAL;
    207208                                goto error;
    208209                        }
    209                         rebuild = true;
     210                        rebuild_set = true;
     211                        rebuild_this_ext = true;
    210212                        vol->rebuild_blk = iter_meta->ssd_rebuild;
    211213                }
    212214
    213                 if (!rebuild && !invalidate)
     215                if (!rebuild_this_ext && !invalidate)
    214216                        vol->extents[index].state = HR_EXT_ONLINE;
    215                 else if (rebuild && !invalidate)
     217                else if (rebuild_this_ext && !invalidate)
    216218                        vol->extents[index].state = HR_EXT_REBUILD;
    217219                else
     
    297299        fibril_mutex_lock(&vol->md_lock);
    298300
    299         if (s == HR_EXT_REBUILD) {
    300                 md->ssd_rebuild = vol->rebuild_blk;
     301        md->ssd_rebuild = vol->rebuild_blk;
     302        md->ssdi.ssd_chunk_id = ext_idx;
     303
     304        if (s == HR_EXT_REBUILD)
    301305                mc->scm_status = BIOC_SDREBUILD;
    302         } else {
    303                 md->ssd_rebuild = 0;
     306        else
    304307                mc->scm_status = BIOC_SDONLINE;
    305         }
    306308
    307309        meta_softraid_encode(md, md_block);
     
    355357{
    356358        uint8_t flags = 0;
     359
     360        flags |= HR_METADATA_ALLOW_REBUILD;
    357361
    358362        return flags;
  • uspace/srv/bd/hr/metadata/foreign/softraid/softraid.c

    r95ca19d r059885c  
    9797        printf("\tssd_meta_flags 0x%" PRIx32 "\n", m->ssd_meta_flags);
    9898        printf("\tssd_ondisk %" PRId64 "\n", m->ssd_ondisk);
     99        printf("\tssd_rebuild %" PRId64 "\n", m->ssd_rebuild);
    99100
    100101        mc = (struct sr_meta_chunk *)(m + 1);
Note: See TracChangeset for help on using the changeset viewer.