Changeset e0695ce in mainline for uspace/srv/bd/hr/raid5.c


Ignore:
Timestamp:
2025-06-23T16:50:43Z (9 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
6a8c1569
Parents:
f18e36e
git-author:
Miroslav Cimerman <mc@…> (2025-06-23 16:47:52)
git-committer:
Miroslav Cimerman <mc@…> (2025-06-23 16:50:43)
Message:

hr: save REBUILD position

File:
1 edited

Legend:

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

    rf18e36e re0695ce  
    150150
    151151        vol->meta_ops->inc_counter(vol);
    152         (void)vol->meta_ops->save(vol, WITH_STATE_CALLBACK);
     152        vol->meta_ops->save(vol, WITH_STATE_CALLBACK);
    153153
    154154        hr_raid5_vol_state_eval_forced(vol);
     
    610610
    611611        size_t invalid_no = hr_count_extents(vol, HR_EXT_INVALID);
     612
     613        size_t rebuild_no = hr_count_extents(vol, HR_EXT_REBUILD);
    612614
    613615        fibril_mutex_lock(&vol->hotspare_lock);
     
    625627
    626628                if (state != HR_VOL_REBUILD) {
    627                         if (hs_no > 0 || invalid_no > 0) {
     629                        if (hs_no > 0 || invalid_no > 0 || rebuild_no > 0) {
    628630                                fid_t fib = fibril_create(hr_raid5_rebuild,
    629631                                    vol);
     
    720722
    721723        uint64_t max_blks = DATA_XFER_LIMIT / vol->bsize;
    722         uint64_t left = vol->data_blkno / (vol->extent_no - 1);
     724        uint64_t left =
     725            vol->data_blkno / (vol->extent_no - 1) - vol->rebuild_blk;
    723726        buf = hr_malloc_waitok(max_blks * vol->bsize);
    724727        xorbuf = hr_malloc_waitok(max_blks * vol->bsize);
     
    726729        uint64_t strip_size = vol->strip_size / vol->bsize; /* in blocks */
    727730
    728         uint64_t ba = 0, cnt;
     731        size_t cnt;
     732        uint64_t ba = vol->rebuild_blk;
    729733        hr_add_data_offset(vol, &ba);
    730734
     
    747751            false);
    748752
     753        HR_NOTE("\"%s\": REBUILD started on extent no. %zu at block %lu.\n",
     754            vol->devname, rebuild_idx, ba);
     755
     756        uint64_t written = 0;
    749757        unsigned int percent, old_percent = 100;
    750758        while (left != 0) {
     
    810818                }
    811819
     820                if (written * vol->bsize > HR_REBUILD_SAVE_BYTES) {
     821                        vol->meta_ops->save(vol, WITH_STATE_CALLBACK);
     822                        written = 0;
     823                }
     824
    812825                hr_range_lock_release(rl);
    813826                hr_reset_stripe(stripe);
    814827
     828                written += cnt;
    815829                ba += cnt;
    816830                left -= cnt;
     831                old_percent = percent;
    817832
    818833                /*
     
    829844        hr_update_ext_state(vol, rebuild_idx, HR_EXT_ONLINE);
    830845
     846        atomic_store_explicit(&vol->rebuild_blk, 0, memory_order_relaxed);
     847
    831848        hr_mark_vol_state_dirty(vol);
    832849
    833850        fibril_rwlock_write_unlock(&vol->states_lock);
    834 
    835         /* (void)vol->meta_ops->save(vol, WITH_STATE_CALLBACK); */
    836 
    837851end:
    838852        fibril_rwlock_read_unlock(&vol->extents_lock);
Note: See TracChangeset for help on using the changeset viewer.