$(check) $<
$(CC) $(CFLAGS) -c $<
-all: tester debug-tree quick-test dir-test tags mkfs.btrfs
+all: bit-radix-test tester debug-tree quick-test dir-test tags mkfs.btrfs
mkfs.btrfs: $(objects) mkfs.o
gcc $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o
+bit-radix-test: $(objects) bit-radix.o
+ gcc $(CFLAGS) -o bit-radix-test $(objects) bit-radix.o
+
debug-tree: $(objects) debug-tree.o
gcc $(CFLAGS) -o debug-tree $(objects) debug-tree.o
#define BTRFS_FS_TREE_OBJECTID 4
#define BTRFS_FIRST_FREE_OBJECTID 5
+#define BTRFS_CSUM_SIZE 32
+
/*
* the key defines the order in the tree, and so it also defines (optimal)
* block layout. objectid corresonds to the inode number. The flags
* every tree block (leaf or node) starts with this header.
*/
struct btrfs_header {
- __le32 csum[8];
+ u8 csum[BTRFS_CSUM_SIZE];
u8 fsid[16]; /* FS specific uuid */
__le64 blocknr; /* which block this node is supposed to live in */
__le64 generation;
* it currently lacks any block count etc etc
*/
struct btrfs_super_block {
+ u8 csum[BTRFS_CSUM_SIZE];
/* the first 3 fields must match struct btrfs_header */
- __le32 csum[8];
u8 fsid[16]; /* FS specific uuid */
__le64 blocknr; /* this block number */
__le64 magic;
} __attribute__ ((__packed__));
struct btrfs_inode_timespec {
- __le32 sec;
+ __le64 sec;
__le32 nsec;
} __attribute__ ((__packed__));
__le64 num_blocks;
} __attribute__ ((__packed__));
+struct btrfs_csum_item {
+ u8 csum[BTRFS_CSUM_SIZE];
+} __attribute__ ((__packed__));
+
struct btrfs_inode_map_item {
struct btrfs_disk_key key;
} __attribute__ ((__packed__));
+
struct btrfs_fs_info {
struct btrfs_root *fs_root;
struct btrfs_root *extent_root;
exit(1);
}
memset(buf, 0, 4096);
- for(i = 0; i < 6; i++) {
+ for(i = 0; i < 16; i++) {
ret = write(fd, buf, 4096);
if (ret != 4096) {
fprintf(stderr, "unable to zero fill device\n");
radix_tree_init();
- root = open_ctree("dbfile", &super);
+ root = open_ctree(av[1], &super);
trans = btrfs_start_transaction(root, 1);
srand(55);
ins.flags = 0;
if (i == run_size - 5) {
btrfs_commit_transaction(trans, root, &super);
}
-
}
close_ctree(root, &super);
+ exit(1);
root = open_ctree("dbfile", &super);
printf("starting search\n");