mirror of
https://github.com/ceph/ceph
synced 2025-04-06 17:44:22 +00:00
os/bluestore: make block array of test_bmap_alloc self-adapting
So we are be able change total_blocks or zone_size flexibly and thus append more test cases. Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
parent
06c48e410a
commit
1af00b15e1
@ -390,7 +390,6 @@ TEST(BitAllocator, test_bmap_alloc)
|
|||||||
delete alloc;
|
delete alloc;
|
||||||
alloc = new BitAllocator(total_blocks, zone_size, CONCURRENT);
|
alloc = new BitAllocator(total_blocks, zone_size, CONCURRENT);
|
||||||
|
|
||||||
int64_t blocks[2048] = {0};
|
|
||||||
for (int64_t i = 0; i < alloc->size(); i++) {
|
for (int64_t i = 0; i < alloc->size(); i++) {
|
||||||
allocated = alloc->alloc_blocks(1, &start_block);
|
allocated = alloc->alloc_blocks(1, &start_block);
|
||||||
bmap_test_assert(allocated == 1);
|
bmap_test_assert(allocated == 1);
|
||||||
@ -399,6 +398,8 @@ TEST(BitAllocator, test_bmap_alloc)
|
|||||||
alloc->free_blocks(i, 1);
|
alloc->free_blocks(i, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t blocks[alloc->size() / 2];
|
||||||
|
memset(blocks, 0, sizeof(blocks));
|
||||||
allocated = alloc->alloc_blocks_dis(alloc->size()/2, blocks);
|
allocated = alloc->alloc_blocks_dis(alloc->size()/2, blocks);
|
||||||
bmap_test_assert(allocated == alloc->size() / 2);
|
bmap_test_assert(allocated == alloc->size() / 2);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user