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: simplify deinterleaving

Since fec_read_bufs() deinterleaves the bytes from 'bbuf' sequentially
starting from 'block_offset', it can just do simple increments instead
of the more complex fec_buffer_rs_index() computation.

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
96dfabe7 5ef22361

+4 -15
+4 -15
drivers/md/dm-verity-fec.c
··· 45 45 } 46 46 47 47 /* 48 - * Return the index of the current RS message when called inside 49 - * fec_for_each_buffer_rs_message. 50 - */ 51 - static inline unsigned int fec_buffer_rs_index(unsigned int i, unsigned int j) 52 - { 53 - return (i << DM_VERITY_FEC_BUF_RS_BITS) + j; 54 - } 55 - 56 - /* 57 48 * Decode all RS codewords whose message bytes were loaded into fio->bufs. Copy 58 49 * the corrected bytes into fio->output starting from block_offset. 59 50 */ ··· 170 179 u64 block, ileaved; 171 180 u8 *bbuf; 172 181 u8 want_digest[HASH_MAX_DIGESTSIZE]; 173 - unsigned int n, k; 182 + unsigned int n, src_pos; 174 183 struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); 175 184 176 185 if (neras) ··· 245 254 * deinterleave and copy the bytes that fit into bufs, 246 255 * starting from block_offset 247 256 */ 257 + src_pos = block_offset; 248 258 fec_for_each_buffer_rs_message(fio, n, j) { 249 - k = fec_buffer_rs_index(n, j) + block_offset; 250 - 251 - if (k >= v->fec->block_size) 259 + if (src_pos >= v->fec->block_size) 252 260 goto done; 253 - 254 - fec_buffer_rs_message(v, fio, n, j)[i] = bbuf[k]; 261 + fec_buffer_rs_message(v, fio, n, j)[i] = bbuf[src_pos++]; 255 262 } 256 263 done: 257 264 dm_bufio_release(buf);