if the size of a bufferlist is page aligned we allocate page aligned
memory chunk for it when rebuild() is called. otherwise we just call
the plain new() to allocate new memory chunk for holding the continuous
buffer. but we should not expect that `new` allocator always returns
unaligned memory chunks. instead, it *could* return page aligned
memory chunk as long as the allocator feels appropriate. so, the
`EXPECT_FALSE(bl.is_page_aligned())` after the `rebuild()` call is
removed.
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit
8ed724222651812c2ee8cc3804dc1f54c973897d)
{
bufferlist bl;
bufferptr ptr(buffer::create_page_aligned(2));
+ ptr[0] = 'X';
+ ptr[1] = 'Y';
ptr.set_offset(1);
ptr.set_length(1);
bl.append(ptr);
EXPECT_FALSE(bl.is_page_aligned());
bl.rebuild();
- EXPECT_FALSE(bl.is_page_aligned());
+ EXPECT_EQ(1U, bl.length());
+ EXPECT_EQ('Y', *bl.begin());
}
{
bufferlist bl;