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, dm-crypt: align "struct bvec_iter" correctly

"struct bvec_iter" is defined with the __packed attribute, so it is
aligned on a single byte. On X86 (and on other architectures that support
unaligned addresses in hardware), "struct bvec_iter" is accessed using the
8-byte and 4-byte memory instructions, however these instructions are less
efficient if they operate on unaligned addresses.

(on RISC machines that don't have unaligned access in hardware, GCC
generates byte-by-byte accesses that are very inefficient - see [1])

This commit reorders the entries in "struct dm_verity_io" and "struct
convert_context", so that "struct bvec_iter" is aligned on 8 bytes.

[1] https://lore.kernel.org/all/ZcLuWUNRZadJr0tQ@fedora/T/

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>

authored by

Mikulas Patocka and committed by
Mike Snitzer
787f1b28 42e15d12

+4 -4
+2 -2
drivers/md/dm-crypt.c
··· 53 53 struct convert_context { 54 54 struct completion restart; 55 55 struct bio *bio_in; 56 - struct bio *bio_out; 57 56 struct bvec_iter iter_in; 57 + struct bio *bio_out; 58 58 struct bvec_iter iter_out; 59 - u64 cc_sector; 60 59 atomic_t cc_pending; 60 + u64 cc_sector; 61 61 union { 62 62 struct skcipher_request *req; 63 63 struct aead_request *req_aead;
+2 -2
drivers/md/dm-verity.h
··· 80 80 /* original value of bio->bi_end_io */ 81 81 bio_end_io_t *orig_bi_end_io; 82 82 83 + struct bvec_iter iter; 84 + 83 85 sector_t block; 84 86 unsigned int n_blocks; 85 87 bool in_tasklet; 86 - 87 - struct bvec_iter iter; 88 88 89 89 struct work_struct work; 90 90