From 24fa20340dda244270a1382bfdb8d94f579ae7df Mon Sep 17 00:00:00 2001 From: jxiong Date: Tue, 2 May 2017 10:04:30 -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. Reviewed-by: Don Brady Reviewed-by: Brian Behlendorf Signed-off-by: Jinshan Xiong Signed-off-by: Jinshan Xiong Closes #6084 --- 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 d0466709b2..61eb575ef8 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