Changeset 401b9e42 in mainline
- Timestamp:
- 2025-01-12T21:53:55Z (5 months ago)
- Children:
- dec4150
- Parents:
- e2b417f
- git-author:
- Miroslav Cimerman <mc@…> (2025-01-12 19:18:08)
- git-committer:
- Miroslav Cimerman <mc@…> (2025-01-12 21:53:55)
- Location:
- uspace/srv/bd/hr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/hr.c
re2b417f r401b9e42 264 264 265 265 atomic_init(&new_volume->rebuild_blk, 0); 266 atomic_init(&new_volume->state_changed, false); 267 atomic_init(&new_volume->pending_invalidation, false); 266 268 267 269 rc = new_volume->hr_ops.create(new_volume); … … 320 322 fibril_rwlock_write_lock(&vol->states_lock); 321 323 fibril_rwlock_read_lock(&vol->extents_lock); 324 325 /* TODO: maybe expose extent state callbacks */ 322 326 hr_update_ext_status(vol, fail_extent, HR_EXT_FAILED); 327 atomic_store(&vol->state_changed, true); 328 323 329 fibril_rwlock_read_unlock(&vol->extents_lock); 324 330 fibril_rwlock_write_unlock(&vol->states_lock); -
uspace/srv/bd/hr/raid1.c
re2b417f r401b9e42 103 103 new_volume->hr_bds.sarg = new_volume; 104 104 105 /* force volume state update */ 106 atomic_store(&new_volume->state_changed, true); 105 107 hr_raid1_update_vol_status(new_volume); 106 108 if (new_volume->status == HR_VOL_FAULTY) … … 275 277 static void hr_raid1_update_vol_status(hr_volume_t *vol) 276 278 { 277 fibril_mutex_lock(&vol->deferred_list_lock); 278 279 if (list_count(&vol->deferred_invalidations_list) > 0) 279 bool exp = true; 280 281 if (!atomic_compare_exchange_strong(&vol->state_changed, &exp, false)) 282 return; 283 284 if (atomic_compare_exchange_strong(&vol->pending_invalidation, &exp, 285 false)) { 286 fibril_mutex_lock(&vol->deferred_list_lock); 280 287 process_deferred_invalidations(vol); 281 282 fibril_mutex_unlock(&vol->deferred_list_lock);288 fibril_mutex_unlock(&vol->deferred_list_lock); 289 } 283 290 284 291 fibril_rwlock_read_lock(&vol->extents_lock); … … 344 351 assert(vol->extents[extent].status == 345 352 HR_EXT_INVALID); 346 goto d one;353 goto deferring_end; 347 354 } 348 355 } … … 358 365 list_append(&vol->deferred_inval[i].link, 359 366 &vol->deferred_invalidations_list); 360 done: 367 368 atomic_store(&vol->pending_invalidation, true); 369 deferring_end: 370 361 371 fibril_mutex_unlock(&vol->deferred_list_lock); 362 372 break; … … 367 377 hr_update_ext_status(vol, extent, HR_EXT_FAILED); 368 378 } 379 380 atomic_store(&vol->state_changed, true); 369 381 370 382 fibril_rwlock_write_unlock(&vol->states_lock); -
uspace/srv/bd/hr/var.h
re2b417f r401b9e42 117 117 * are harvested later when we are able to. 118 118 */ 119 _Atomic bool pending_invalidation; 119 120 fibril_mutex_t deferred_list_lock; 120 121 list_t deferred_invalidations_list; 121 122 hr_deferred_invalidation_t deferred_inval[HR_MAX_EXTENTS]; 122 123 124 _Atomic bool state_changed; 123 125 _Atomic uint64_t rebuild_blk; 124 126 uint64_t counter; /* metadata syncing */
Note:
See TracChangeset
for help on using the changeset viewer.