]> granicus.if.org Git - zfs/commitdiff
Guarantee PAGESIZE alignment for large zio buffers
authorjxiong <jinshan.xiong@gmail.com>
Tue, 2 May 2017 17:04:30 +0000 (10:04 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 2 May 2017 17:04:30 +0000 (10:04 -0700)
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 <don.brady@intel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jinshan Xiong <jinshan.xiong@gmail.com>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Closes #6084

module/zfs/zio.c

index d0466709b2e437644c62c44df124769268c06296..61eb575ef817df50f027a939a752084c4be08f07 100644 (file)
@@ -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