Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dm-verity-fec: improve comments for fec_read_bufs()

Update the comments in and above fec_read_bufs() to more clearly
describe what it does.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

authored by

Eric Biggers and committed by
Mikulas Patocka
4f6d6fb3 d0829329

+22 -8
+22 -8
drivers/md/dm-verity-fec.c
··· 154 154 } 155 155 156 156 /* 157 - * Read data blocks that are part of the RS block and deinterleave as much as 158 - * fits into buffers. Check for erasure locations if @neras is non-NULL. 157 + * Read the message block at index @index_in_region within each of the 158 + * @v->fec->rs_k regions and deinterleave their contents into @io->fec_io->bufs. 159 + * 160 + * @target_block gives the index of specific block within this sequence that is 161 + * being corrected, relative to the start of all the FEC message blocks. 162 + * 163 + * @out_pos gives the current output position, i.e. the position in (each) block 164 + * from which to start the deinterleaving. Deinterleaving continues until 165 + * either end-of-block is reached or there's no more buffer space. 166 + * 167 + * If @neras is non-NULL, then also use verity hashes and the presence/absence 168 + * of I/O errors to determine which of the message blocks in the sequence are 169 + * likely to be incorrect. Write the number of such blocks to *@neras and the 170 + * indices of the corresponding RS message bytes in [0, k - 1] to 171 + * @io->fec_io->erasures, up to a limit of @v->fec->roots + 1 such blocks. 159 172 */ 160 173 static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io, 161 174 u64 target_block, u64 index_in_region, ··· 191 178 if (WARN_ON(v->digest_size > sizeof(want_digest))) 192 179 return -EINVAL; 193 180 194 - /* 195 - * read each of the rs_k data blocks that are part of the RS block, and 196 - * interleave contents to available bufs 197 - */ 198 181 for (i = 0; i < v->fec->rs_k; i++) { 182 + /* 183 + * Read the block from region i. It contains the i'th message 184 + * byte of the target block's RS codewords. 185 + */ 199 186 block = i * v->fec->region_blocks + index_in_region; 200 187 bufio = v->fec->data_bufio; 201 188 ··· 244 231 } 245 232 246 233 /* 247 - * deinterleave and copy the bytes that fit into bufs, 248 - * starting from out_pos 234 + * Deinterleave the bytes of the block, starting from 'out_pos', 235 + * into the i'th byte of the RS message buffers. Stop when 236 + * end-of-block is reached or there are no more buffers. 249 237 */ 250 238 src_pos = out_pos; 251 239 fec_for_each_buffer_rs_message(fio, n, j) {