Changeset 80c760e in mainline for uspace/srv/bd/hr/util.c


Ignore:
Timestamp:
2025-04-21T12:34:02Z (3 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
75262d2f
Parents:
18c3658
Message:

hr: remove truncated_blkno calculation from raid*.c

Calculate the initial truncated_blkno in hr_init_extents_from_cfg,
allowing the removal of hr_extent_t.blkno.

Also fixes double block_fini() on failed volume creation in
hr_util_try_assemble().

File:
1 edited

Legend:

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

    r18c3658 r80c760e  
    234234
    235235        errno_t rc;
    236         uint64_t blkno;
     236        uint64_t blkno, smallest_blkno = ~0ULL;
    237237        size_t i, bsize;
    238238        size_t last_bsize = 0;
     
    269269
    270270                vol->extents[i].svc_id = svc_id;
    271                 vol->extents[i].blkno = blkno;
    272271                vol->extents[i].status = HR_EXT_ONLINE;
    273272
     273                if (blkno < smallest_blkno)
     274                        smallest_blkno = blkno;
    274275                last_bsize = bsize;
    275276        }
     
    277278        vol->bsize = last_bsize;
    278279        vol->extent_no = cfg->dev_no;
     280        vol->truncated_blkno = smallest_blkno;
    279281
    280282        for (i = 0; i < HR_MAX_HOTSPARES; i++)
     
    728730
    729731                iter->inited = true;
     732                iter->fini = true;
    730733        }
    731734
     
    738741
    739742        list_foreach(*list, link, struct dev_list_member, iter) {
    740                 if (iter->inited) {
     743                if (iter->inited && iter->fini) {
    741744                        block_fini(iter->svc_id);
    742745                        iter->inited = false;
     746                        iter->fini = false;
    743747                }
    744748        }
     
    983987                        asm_cnt++;
    984988                        break;
    985                 case EEXIST:
    986                         /*
    987                          * A race is detected this way, because we don't want
    988                          * to hold the hr_volumes list lock for a long time,
    989                          * for all assembly attempts. XXX: discuss...
    990                          */
     989                case ENOMEM:
     990                        goto error;
     991                default:
    991992                        rc = EOK;
    992                         break;
    993                 default:
    994                         block_fini_dev_list(&matching_svcs_list);
    995                         free_svc_id_list(&matching_svcs_list);
    996                         goto error;
    997                 }
    998 
     993                }
     994                block_fini_dev_list(&matching_svcs_list);
    999995                free_svc_id_list(&matching_svcs_list);
    1000996        }
Note: See TracChangeset for help on using the changeset viewer.