aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2024-02-25 11:01:41 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-03-06 14:45:19 +0000
commit0e351d1aa2e4c1a7a4cb2a5753b86db89796d3c8 (patch)
tree44e1b4c4716f5dfcff57a5f2ce9ec7d96fe576b7
parentc6ff5fb6b157cf4101889c1f3e169eb6897e8f50 (diff)
downloadlinux-0e351d1aa2e4c1a7a4cb2a5753b86db89796d3c8.tar.gz
block: define bvec_iter as __packed __aligned(4)
[ Upstream commit 7838b4656110d950afdd92a081cc0f33e23e0ea8 ] In commit 19416123ab3e ("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: 19416123ab3e ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--include/linux/bvec.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 9e3dac51eb26b6..d4dbaae8b5218a 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -59,7 +59,7 @@ struct bvec_iter {
unsigned int bi_bvec_done; /* number of bytes completed in
current bvec */
-} __packed;
+} __packed __aligned(4);
struct bvec_iter_all {
struct bio_vec bv;