Changeset c5c367a in mainline
- Timestamp:
- 2025-07-08T20:55:31Z (2 weeks ago)
- Children:
- 9c3369b
- Parents:
- ba65caf5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/parity_stripe.c
rba65caf5 rc5c367a 46 46 static void hr_execute_write_stripe_degraded(hr_stripe_t *, size_t); 47 47 static void hr_execute_write_stripe_optimal_reconstruct(hr_stripe_t *); 48 static void hr_execute_write_stripe_ optimal_subtract(hr_stripe_t *);48 static void hr_execute_write_stripe_subtract(hr_stripe_t *, size_t); 49 49 static void hr_execute_write_stripe(hr_stripe_t *, size_t); 50 50 static void hr_execute_read_stripe(hr_stripe_t *, size_t); 51 static void hr_execute_write_stripe_degraded_good(hr_stripe_t *, size_t);52 51 static bool hr_stripe_range_non_extension(const range_t *, const range_t *, 53 52 range_t *); … … 147 146 } 148 147 149 static void hr_execute_write_stripe_degraded_good(hr_stripe_t *stripe,150 size_t bad_extent)151 {152 hr_volume_t *vol = stripe->vol;153 154 stripe->ps_to_be_added = stripe->strips_touched; /* writers */155 stripe->ps_to_be_added += stripe->range_count; /* parity readers */156 stripe->p_count_final = true;157 158 size_t worker_cnt = stripe->strips_touched + stripe->range_count * 2;159 stripe->worker_group = hr_fgroup_create(vol->fge, worker_cnt);160 161 for (size_t e = 0; e < vol->extent_no; e++) {162 if (e == bad_extent || e == stripe->p_extent)163 continue;164 if (stripe->extent_span[e].cnt == 0)165 continue;166 167 hr_io_raid5_t *io = hr_fgroup_alloc(stripe->worker_group);168 io->extent = e;169 io->data_write = stripe->extent_span[e].data_write;170 io->ba = stripe->extent_span[e].range.start;171 io->cnt = stripe->extent_span[e].cnt;172 io->strip_off = stripe->extent_span[e].strip_off * vol->bsize;173 io->vol = vol;174 io->stripe = stripe;175 176 hr_fgroup_submit(stripe->worker_group,177 hr_io_raid5_subtract_writer, io);178 }179 180 for (size_t r = 0; r < stripe->range_count; r++) {181 hr_io_raid5_t *p_reader = hr_fgroup_alloc(stripe->worker_group);182 p_reader->extent = stripe->p_extent;183 p_reader->ba = stripe->total_height[r].start;184 p_reader->cnt = stripe->total_height[r].end -185 stripe->total_height[r].start + 1;186 p_reader->vol = vol;187 p_reader->stripe = stripe;188 189 p_reader->strip_off = p_reader->ba;190 hr_sub_data_offset(vol, &p_reader->strip_off);191 p_reader->strip_off %= vol->strip_size / vol->bsize;192 p_reader->strip_off *= vol->bsize;193 194 hr_fgroup_submit(stripe->worker_group,195 hr_io_raid5_reconstruct_reader, p_reader);196 197 hr_io_raid5_t *p_writer = hr_fgroup_alloc(stripe->worker_group);198 p_writer->extent = stripe->p_extent;199 p_writer->ba = stripe->total_height[r].start;200 p_writer->cnt = stripe->total_height[r].end -201 stripe->total_height[r].start + 1;202 p_writer->vol = vol;203 p_writer->stripe = stripe;204 205 p_writer->strip_off = p_writer->ba;206 hr_sub_data_offset(vol, &p_writer->strip_off);207 p_writer->strip_off %= vol->strip_size / vol->bsize;208 p_writer->strip_off *= vol->bsize;209 210 hr_fgroup_submit(stripe->worker_group,211 hr_io_raid5_parity_writer, p_writer);212 }213 }214 215 148 static void hr_execute_write_stripe_degraded_mixed(hr_stripe_t *stripe, 216 149 size_t bad_extent) 217 150 { 218 151 hr_volume_t *vol = stripe->vol; 152 153 stripe->range_count = hr_stripe_merge_extent_spans(stripe, 154 vol->extent_no, stripe->total_height); 219 155 220 156 size_t worker_cnt = (vol->extent_no - 2) * 3 + 3; /* upper bound */ … … 419 355 } 420 356 421 stripe->range_count = hr_stripe_merge_extent_spans(stripe,422 vol->extent_no, stripe->total_height);423 424 357 if (stripe->extent_span[bad_extent].cnt > 0) 425 358 hr_execute_write_stripe_degraded_mixed(stripe, bad_extent); 426 359 else 427 hr_execute_write_stripe_ degraded_good(stripe, bad_extent);360 hr_execute_write_stripe_subtract(stripe, bad_extent); 428 361 } 429 362 … … 546 479 } 547 480 548 static void hr_execute_write_stripe_ optimal_subtract(hr_stripe_t *stripe)481 static void hr_execute_write_stripe_subtract(hr_stripe_t *stripe, size_t bad) 549 482 { 550 483 hr_volume_t *vol = stripe->vol; … … 564 497 565 498 for (size_t e = 0; e < vol->extent_no; e++) { 566 if (e == stripe->p_extent)499 if (e == bad || e == stripe->p_extent) 567 500 continue; 568 501 … … 629 562 630 563 if (stripe->subtract) 631 hr_execute_write_stripe_ optimal_subtract(stripe);564 hr_execute_write_stripe_subtract(stripe, vol->extent_no); 632 565 else 633 566 hr_execute_write_stripe_optimal_reconstruct(stripe);
Note:
See TracChangeset
for help on using the changeset viewer.