Lines Matching +full:use +full:- +full:parity
1 /* SPDX-License-Identifier: GPL-2.0 */
31 * Empty -> Want - on read or write to get old data for parity calc
32 * Empty -> Dirty - on compute_parity to satisfy write/sync request.
33 * Empty -> Clean - on compute_block when computing a block for failed drive
34 * Want -> Empty - on failed read
35 * Want -> Clean - on successful completion of read request
36 * Dirty -> Clean - on successful completion of write request
37 * Dirty -> Clean - on failed write
38 * Clean -> Dirty - on compute_parity to satisfy write/sync (RECONSTRUCT or RMW)
40 * The Want->Empty, Want->Clean, Dirty->Clean, transitions
43 * This leaves one multi-stage transition:
44 * Want->Dirty->Clean
52 * from parity calculations, and a clean block that has been
53 * successfully written to the spare ( or to parity when resyncing).
55 * is set whenever a write is scheduled to the spare, or to the parity
77 * third list, the written list (bh_written). Once both the parity
99 * - stripes have a reference counter. If count==0, they are on a list.
100 * - If a stripe might need handling, STRIPE_HANDLE is set.
101 * - When refcount reaches zero, then if STRIPE_HANDLE it is put on
105 * cleared while a stripe has a non-zero count means that if the
112 * lockdev check-hash unlink-stripe cnt++ clean-stripe hash-stripe unlockdev
114 * lockdev check-hash if(!cnt++)unlink-stripe unlockdev
116 * lockdev attach-buffer unlockdev
119 * (lockdev check-buffers unlockdev) ..
120 * change-state ..
123 …* lockdev if (!--cnt) { if STRIPE_HANDLE, add to handle_list else add to inactive-list } unlo…
131 * -copying data between the stripe cache and user application buffers
132 * -computing blocks to save a disk access, or to recover a missing block
133 * -updating the parity on a write operation (reconstruct write and
134 * read-modify-write)
135 * -checking parity correctness
136 * -running i/o to disk
141 * the count is non-zero.
144 * 1/ Parity check operations destroy the in cache version of the parity block,
145 * so we prevent parity dependent operations like writes and compute_blocks
147 * the check without damaging the parity block, in these cases the parity
148 * block is re-marked up to date (assuming the check was successful) and is
149 * not re-read from disk.
152 * to be held off, as well as parity checks and compute block operations.
160 * Operations state - intermediate states that are visible outside of
166 * sh->state flags (STRIPE_BIOFILL_RUN and STRIPE_COMPUTE_RUN)
169 * enum check_states - handles syncing / repairing a stripe
170 * @check_state_idle - check operations are quiesced
171 * @check_state_run - check operation is running
172 * @check_state_result - set outside lock when check result is valid
173 * @check_state_compute_run - check failed and we are repairing
174 * @check_state_compute_result - set outside lock when compute result is valid
178 check_state_run, /* xor parity check */
179 check_state_run_q, /* q-parity check */
180 check_state_run_pq, /* pq dual parity check */
182 check_state_compute_run, /* parity repair */
187 * enum reconstruct_states - handles writing or expanding a stripe
191 reconstruct_state_prexor_drain_run, /* prexor-write */
208 short pd_idx; /* parity disk index */
210 short ddf_layout;/* use DDF ordering to calculate Q */
237 struct list_head r5c; /* for r5c_cache->stripe_in_journal */
239 struct page *ppl_page; /* partial parity of this stripe */
242 * @target - STRIPE_OP_COMPUTE_BLK target
243 * @target2 - 2nd compute target in the raid6 case
244 * @zero_sum_result - P and Q verification flags
245 * @request - async service request flags for raid_run_ops
274 /* stripe_head_state - collects and tracks the dynamic state of a stripe_head
279 * to check/correct parity, or to reconstruct a missing device.
306 R5_Insync, /* rdev && rdev->in_sync at start */
311 R5_ReadNoMerge, /* prevent bio from merging in block-layer */
313 R5_ReWrite, /* have tried to over-write the readerror */
315 R5_Expanded, /* This block now has post-expand data */
319 R5_Wantfill, /* dev->toread contains a bio that needs
322 R5_Wantdrain, /* dev->towrite needs to be drained */
325 R5_WriteError, /* got a write error - need to record it */
331 * up-to-date at this stripe. */
338 * if R5_InJournal is set for parity pd_idx, all the
339 * data and parity being written are in the journal
343 * dev->orig_page for prexor. When this flag is
378 STRIPE_LOG_TRAPPED, /* trapped into log (see raid5-cache.c)
381 * 1. write-out phase
393 * see more detail in the raid5-cache.c
395 STRIPE_R5C_PARTIAL_STRIPE, /* in r5c cache (to-be/being handled or
396 * in conf->r5c_partial_stripe_list)
398 STRIPE_R5C_FULL_STRIPE, /* in r5c cache (to-be/being handled or
399 * in conf->r5c_full_stripe_list)
423 * RAID parity calculation preferences
445 * In particular, any write request that would require pre-reading
447 * in a pre-read phase. Further, if the "delayed" queue is empty when
458 * In stripe_handle, if we find pre-reading is necessary, we do it if
465 * 1/ when holding mddev->reconfig_mutex
466 * 2/ when resync/recovery/reshape is known to be happening - i.e. in code that
468 * 3/ while holding rcu_read_lock(), use rcu_dereference to get the pointer
469 * and if it is non-NULL, increment rdev->nr_pending before dropping the RCU
478 struct page *extra_page; /* extra page to use in prexor */
489 #define STRIPE_SHIFT (PAGE_SHIFT - 9)
496 #define HASH_MASK (NR_HASH - 1)
505 #define STRIPE_HASH_LOCKS_MASK (NR_STRIPE_HASH_LOCKS - 1)
523 * r5c journal modes of the array: write-back or write-through.
524 * write-through mode has identical behavior as existing log only
704 #define RAID5_STRIPE_SIZE(conf) ((conf)->stripe_size)
705 #define RAID5_STRIPE_SHIFT(conf) ((conf)->stripe_shift)
706 #define RAID5_STRIPE_SECTORS(conf) ((conf)->stripe_sectors)
721 return bio->bi_next; in r5_next_bio()
729 #define ALGORITHM_LEFT_ASYMMETRIC 0 /* Rotating Parity N with Data Restart */
730 #define ALGORITHM_RIGHT_ASYMMETRIC 1 /* Rotating Parity 0 with Data Restart */
731 #define ALGORITHM_LEFT_SYMMETRIC 2 /* Rotating Parity N with Data Continuation */
732 #define ALGORITHM_RIGHT_SYMMETRIC 3 /* Rotating Parity 0 with Data Continuation */
734 /* Define non-rotating (raid4) algorithms. These allow
741 * Firstly, the exact positioning of the parity block is slightly
748 * Interestingly DDFv1.2-Errata-A does not specify N_CONTINUE but
757 * with exactly the same layout for data and parity, and
758 * with the Q block always on the last device (N-1).
793 return (disk_idx % sh->stripes_per_page) * RAID5_STRIPE_SIZE(sh->raid_conf); in raid5_get_page_offset()
802 return sh->pages[disk_idx / sh->stripes_per_page]; in raid5_get_dev_page()