[functional-tests] a few more bcache tests
This commit is contained in:
parent
3f8add4334
commit
3b7320cd84
@ -34,5 +34,37 @@
|
||||
(with-bcache (cache md 16)
|
||||
(with-block (b cache 0 (get-flags))
|
||||
#f))))
|
||||
|
||||
(define-scenario (bcache write-ref)
|
||||
"get a write-ref on a block"
|
||||
(with-empty-metadata (md 16)
|
||||
(with-bcache (cache md 16)
|
||||
(with-block (b cache 0 (get-flags dirty))
|
||||
#f))))
|
||||
|
||||
(define-scenario (bcache zero-ref)
|
||||
"get a write-ref on a block"
|
||||
(with-empty-metadata (md 16)
|
||||
(with-bcache (cache md 16)
|
||||
(with-block (b cache 0 (get-flags zero))
|
||||
#f))))
|
||||
|
||||
(define-scenario (bcache multiple-refs-to-same-block)
|
||||
"the same block can be held multiple times"
|
||||
(with-empty-metadata (md 16)
|
||||
(with-bcache (cache md 16)
|
||||
(with-block (b cache 0 (get-flags))
|
||||
(with-block (b cache 0 (get-flags))
|
||||
(with-block (b cache 0 (get-flags))
|
||||
#f))))))
|
||||
|
||||
(define-scenario (bcache multiple-blocks)
|
||||
"multiple blocks can be held at once"
|
||||
(with-empty-metadata (md 16)
|
||||
(with-bcache (cache md 16)
|
||||
(with-block (b cache 0 (get-flags))
|
||||
(with-block (b cache 1 (get-flags))
|
||||
(with-block (b cache 2 (get-flags))
|
||||
#f))))))
|
||||
)
|
||||
|
||||
|
@ -707,7 +707,8 @@ struct bcache *bcache_simple(const char *path, unsigned nr_cache_blocks)
|
||||
}
|
||||
|
||||
s = info.st_size;
|
||||
cache = bcache_create(fd, MD_BLOCK_SIZE >> SECTOR_SHIFT, s / MD_BLOCK_SIZE, nr_cache_blocks);
|
||||
cache = bcache_create(fd, MD_BLOCK_SIZE >> SECTOR_SHIFT,
|
||||
s / MD_BLOCK_SIZE, nr_cache_blocks);
|
||||
if (!cache)
|
||||
close(fd);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user