From bcc85579019644172b77dfafc2d87bbbaf88a9c3 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Thu, 17 Oct 2013 22:15:57 -0700 Subject: [PATCH] tmpfs does not support fallocate Summary: This caused Siying's unit test to fail. Test Plan: Unittest Reviewers: dhruba, kailiu, haobo Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D13539 --- util/blob_store.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/util/blob_store.cc b/util/blob_store.cc index 694787210b..168a6d74a7 100644 --- a/util/blob_store.cc +++ b/util/blob_store.cc @@ -261,7 +261,10 @@ Status BlobStore::Allocate(uint32_t blocks, Blob* blob) { s = free_list_.Allocate(blocks, blob); if (!s.ok()) { - CreateNewBucket(); + s = CreateNewBucket(); + if (!s.ok()) { + return s; + } s = free_list_.Allocate(blocks, blob); } @@ -284,12 +287,8 @@ Status BlobStore::CreateNewBucket() { return s; } - s = buckets_[new_bucket_id].get()->Allocate( - 0, block_size_ * blocks_per_bucket_); - if (!s.ok()) { - buckets_.erase(buckets_.begin() + new_bucket_id); - return s; - } + // tmpfs does not support allocate + buckets_[new_bucket_id].get()->Allocate(0, block_size_ * blocks_per_bucket_); return free_list_.Free(Blob(new_bucket_id, 0, blocks_per_bucket_)); }