From dc0c99eb4fdc095c1a96602dd2f9f0d94041517b Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Sun, 8 May 2016 07:16:28 +0800 Subject: [PATCH] aos/bluestore/KernelDevice: optimize rebuild for aio_write. For the requirement of directio, the content maybe rebuild. In fact, rebuild_aligned_size_and_memory first check is_n_align_sized && is_algined and if need it rebuild. So using rebuild_aligned_size_and_memory can remove the check. Signed-off-by: Jianpeng Ma --- src/os/bluestore/KernelDevice.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/os/bluestore/KernelDevice.cc b/src/os/bluestore/KernelDevice.cc index 971a0a5244b..428b607f072 100644 --- a/src/os/bluestore/KernelDevice.cc +++ b/src/os/bluestore/KernelDevice.cc @@ -375,9 +375,8 @@ int KernelDevice::aio_write( assert(off < size); assert(off + len <= size); - if (!buffered && (!bl.is_n_align_sized(block_size) || !bl.is_aligned(block_size))) { + if (!buffered && bl.rebuild_aligned_size_and_memory(block_size, block_size)) { dout(20) << __func__ << " rebuilding buffer to be aligned" << dendl; - bl.rebuild_aligned(block_size); } dout(40) << "data: "; -- 2.39.5