From 200f18901fc1077281b8167cd8f4d1d271726678 Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Sun, 30 Apr 2017 20:06:17 -0700 Subject: [PATCH] Guarantee PAGESIZE alignment for large zio buffers In current implementation, only zio buffers in 16KB and bigger are guaranteed PAGESIZE alignment. This breaks Lustre since it assumes that 'arc_buf_t::b_data' must be page aligned when zio buffers are greater than or equal to PAGESIZE. This patch will make the zio buffers to be PAGESIZE aligned when the sizes are not less than PAGESIZE. This change may cause a little bit memory waste but that should be fine because after ABD is introduced, zio buffers are used to hold data temporarily and live in memory for a short while. Signed-off-by: Jinshan Xiong Signed-off-by: Jinshan Xiong --- module/zfs/zio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/zfs/zio.c b/module/zfs/zio.c index d0466709b2e4..61eb575ef817 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -167,10 +167,10 @@ zio_init(void) */ align = 8 * SPA_MINBLOCKSIZE; #else - if (size <= 4 * SPA_MINBLOCKSIZE) { + if (size < PAGESIZE) { align = SPA_MINBLOCKSIZE; } else if (IS_P2ALIGNED(size, p2 >> 2)) { - align = MIN(p2 >> 2, PAGESIZE); + align = PAGESIZE; } #endif