Skip to content

Commit 7838b46

Browse files
Ming Leitorvalds
authored andcommitted
block: define bvec_iter as __packed __aligned(4)
In commit 1941612 ("block: define 'struct bvec_iter' as packed"), what we need is to save the 4byte padding, and avoid `bio` to spread on one extra cache line. It is enough to define it as '__packed __aligned(4)', as '__packed' alone means byte aligned, and can cause compiler to generate horrible code on architectures that don't support unaligned access in case that bvec_iter is embedded in other structures. Cc: Mikulas Patocka <mpatocka@redhat.com> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Fixes: 1941612 ("block: define 'struct bvec_iter' as packed") Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7fd6644 commit 7838b46

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/bvec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct bvec_iter {
8383

8484
unsigned int bi_bvec_done; /* number of bytes completed in
8585
current bvec */
86-
} __packed;
86+
} __packed __aligned(4);
8787

8888
struct bvec_iter_all {
8989
struct bio_vec bv;

0 commit comments

Comments
 (0)