git: sbin/hammer: Assert simplified blockmap allocator
Tomohiro Kusumi
tkusumi at crater.dragonflybsd.org
Fri Jul 17 09:50:05 PDT 2015
commit 0d1f608583649369f4bdd520c29f342b2d3806d8
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date: Fri Jul 17 20:36:07 2015 +0900
sbin/hammer: Assert simplified blockmap allocator
- alloc_blockmap() is a simplified blockmap allocator of
kernel function hammer_blockmap_alloc() as the comment says.
alloc_blockmap() is not aware of layer1 boundary since it
lacks layer1 boundary check and zone wrap check. This still
works for newfs_hammer because it's guaranteed that the newfs
never hits layer1 boundary even in the worst case[*] when
there are 2^8 volumes and each volume is 2^52 bytes storage.
- This commit adds assertions to ensure it's safe to use the
simplified allocator. If a caller hits the assertions then
the program does more than what this allocator supports.
--
[*] In the worst case each volume has 2^(18-8) big-blocks
for layer2 metadata which totals (8[MB] * 1024) = 8[GB].
Other than layer2 metadata, the root volume has 1 big-block
for layer1 metadata, less than 128 big-blocks for undo fifo,
and 1 big-block for btree and meta zone each. These add up
to somewhere between 8-10[GB] but it's still far less than
a single layer1 capacity of 4[TB]. Non-root volumes consume
a bit less than the root volume since it only has layer2
metadata initially which also fits in a single layer1.
The blockmaps for the root and non-root volumes would look
something like the following.
volume#0
zone big-blocks note
==============================================================
4 1 2^18 * layer1 = 2^(18+5) = 8[MB]
4 1024 2^19 * layer2 * 1024 = 2^(19+4+10) = 8[GB]
3 n undo zone for undo fifo (n <= 128)
8 1 btree zone for root btree node
9 1 meta zone for root inode and pfs0
volume#N (0<N<256)
zone big-blocks note
==============================================================
4 1024 2^19 * layer2 * 1024 = 2^(19+4+10) = 8[GB]
Summary of changes:
sbin/hammer/ondisk.c | 8 ++++++++
1 file changed, 8 insertions(+)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/0d1f608583649369f4bdd520c29f342b2d3806d8
--
DragonFly BSD source repository
More information about the Commits
mailing list