From af82dbcbeb965a7524d72f597e21433771892f9a Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 6 Jul 2016 15:13:38 +0800 Subject: [PATCH] os/bluestore: add support for allocating 0-sized extent For testing, we may choose randomized length of extent to allocate, which means we could trim down the length to 0. Signed-off-by: xie xingguo --- src/os/bluestore/BitMapAllocator.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/os/bluestore/BitMapAllocator.cc b/src/os/bluestore/BitMapAllocator.cc index d42093e79b1f..ac3037e20143 100644 --- a/src/os/bluestore/BitMapAllocator.cc +++ b/src/os/bluestore/BitMapAllocator.cc @@ -105,6 +105,8 @@ int BitMapAllocator::allocate( uint64_t want_size, uint64_t alloc_unit, int64_t hint, uint64_t *offset, uint32_t *length) { + if (want_size == 0) + return 0; assert(!(alloc_unit % m_block_size)); int64_t nblks = (want_size + m_block_size - 1) / m_block_size; -- 2.47.3