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: rename block_offset to out_pos

The current position in the output block buffer is called 'pos' in
fec_decode_rsb(), and 'block_offset' in fec_read_bufs() and
fec_decode_bufs(). These names aren't very clear, especially
'block_offset' which is easily confused with the offset of a message or
parity block or the position in the current parity block.

Rename it to 'out_pos'.

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
3ad2b952 96dfabe7

+13 -15
+13 -15
drivers/md/dm-verity-fec.c
··· 46 46 47 47 /* 48 48 * Decode all RS codewords whose message bytes were loaded into fio->bufs. Copy 49 - * the corrected bytes into fio->output starting from block_offset. 49 + * the corrected bytes into fio->output starting from out_pos. 50 50 */ 51 51 static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_io *io, 52 52 struct dm_verity_fec_io *fio, u64 rsb, int byte_index, 53 - unsigned int block_offset, int neras) 53 + unsigned int out_pos, int neras) 54 54 { 55 55 int r, corrected = 0, res; 56 56 struct dm_buffer *buf; ··· 67 67 * block_size is always a power of 2, but roots might not be. Note that 68 68 * when it's not, a codeword's parity bytes can span a block boundary. 69 69 */ 70 - parity_block = (rsb + block_offset) * v->fec->roots; 70 + parity_block = (rsb + out_pos) * v->fec->roots; 71 71 parity_pos = parity_block & (v->fec->block_size - 1); 72 72 parity_block >>= v->data_dev_block_bits; 73 73 par = dm_bufio_read_with_ioprio(v->fec->bufio, parity_block, &buf, ··· 120 120 } 121 121 122 122 corrected += res; 123 - fio->output[block_offset] = msg_buf[byte_index]; 123 + fio->output[out_pos++] = msg_buf[byte_index]; 124 124 125 - block_offset++; 126 - if (block_offset >= v->fec->block_size) 125 + if (out_pos >= v->fec->block_size) 127 126 goto done; 128 127 } 129 128 done: ··· 158 159 * fits into buffers. Check for erasure locations if @neras is non-NULL. 159 160 */ 160 161 static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io, 161 - u64 rsb, u64 target, unsigned int block_offset, 162 - int *neras) 162 + u64 rsb, u64 target, unsigned int out_pos, int *neras) 163 163 { 164 164 bool is_zero; 165 165 int i, j, target_index = -1; ··· 241 243 242 244 /* 243 245 * deinterleave and copy the bytes that fit into bufs, 244 - * starting from block_offset 246 + * starting from out_pos 245 247 */ 246 - src_pos = block_offset; 248 + src_pos = out_pos; 247 249 fec_for_each_buffer_rs_message(fio, n, j) { 248 250 if (src_pos >= v->fec->block_size) 249 251 goto done; ··· 315 317 const u8 *want_digest, bool use_erasures) 316 318 { 317 319 int r, neras = 0; 318 - unsigned int pos; 320 + unsigned int out_pos; 319 321 320 - for (pos = 0; pos < v->fec->block_size;) { 322 + for (out_pos = 0; out_pos < v->fec->block_size;) { 321 323 fec_init_bufs(v, fio); 322 324 323 - r = fec_read_bufs(v, io, rsb, offset, pos, 325 + r = fec_read_bufs(v, io, rsb, offset, out_pos, 324 326 use_erasures ? &neras : NULL); 325 327 if (unlikely(r < 0)) 326 328 return r; 327 329 328 - r = fec_decode_bufs(v, io, fio, rsb, r, pos, neras); 330 + r = fec_decode_bufs(v, io, fio, rsb, r, out_pos, neras); 329 331 if (r < 0) 330 332 return r; 331 333 332 - pos += fio->nbufs << DM_VERITY_FEC_BUF_RS_BITS; 334 + out_pos += fio->nbufs << DM_VERITY_FEC_BUF_RS_BITS; 333 335 } 334 336 335 337 /* Always re-validate the corrected block against the expected hash */