HAMMER B-Tree Filesystem

Daniel Lorch dlorch at gmail.com
Tue Apr 6 04:04:10 PDT 2010


Hey,

I wrote a file system which exposes HAMMER's B-Tree structure as a
filesystem:

- directories correspond to HAMMER nodes (hammer_node_ondisk)
- subdirectories correspond to the node's elements (hammer_node_ondisk.elms)
- node.txt contains hammer_node_ondisk's attributes
- btree.txt contains hammer_btree_elm_t's attributes
- etc.

Below a screenshot. My goal was being able to 'diff' two B-trees to
understand what changes happen when I add/modify/remove a file on the
file system. Unfortunately, HAMMER reorders the hammer_node_ondisk.elms
and `diff -r' gets all confused about new/missing directories. I'll try
to find a better representation.

Daniel

$ ls
0        17       25       33       41       5        7
1        18       26       34       42       50       8
10       19       27       35       43       51       9
11       2        28       36       44       52       node.txt
12       20       29       37       45       53
13       21       3        38       46       54
14       22       30       39       47       55
15       23       31       4        48       56
16       24       32       40       49       6

$ cat node.txt
--- hammer_node_ondisk
off       : 125833216
count     : 57
parent    : 0
type      : HAMMER_BTREE_TYPE_INTERNAL

$ cat 0/btree.txt
--- hammer_btree_elm_t
localization : HAMMER_LOCALIZE_RESERVED00
obj_id       : 9223372036854775808
key          : 9223372036854775808
create_tid   : 1
delete_tid   : 1
rec_type     : HAMMER_RECTYPE_UNKNOWN
obj_type     :
btype        : HAMMER_BTREE_TYPE_LEAF

$ cat 0/0/inode.txt
--- hammer_inode_data
data_len       : 128
data_offset    : 12682136550809534464
mode           : 755
uflags         : 0
rmajor         : 0
rmajor         : 0
parent_obj_id  : 0
uid            : 0
gid            : 0
nlinks         : 1
size           : 0
ctime          : Mon Mar 23 19:55:25 2009
mtime          : Mon Apr  5 07:37:55 2010
atime          : Mon Mar 23 19:55:25 2009

$ cat 30/27/dirname.txt
--- hammer_entry_data
data_len       : 20
data_offset    : 10376293541604230848
obj_id         : 4301368000
localization   : 0
name           : test





More information about the Hammer mailing list