]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: add support for allocating 0-sized extent 10040/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 6 Jul 2016 07:13:38 +0000 (15:13 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sun, 10 Jul 2016 13:25:52 +0000 (21:25 +0800)
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 <xie.xingguo@zte.com.cn>
src/os/bluestore/BitMapAllocator.cc

index d42093e79b1ff7099dfb6189fb4bb04dca740949..ac3037e20143f9dd96c71b66be87b371960f6780 100644 (file)
@@ -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;