summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--ctree.h13
-rw-r--r--kerncompat.h1
-rw-r--r--mkfs.c2
-rw-r--r--quick-test.c4
5 files changed, 18 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 0720169b..d3e70899 100644
--- a/Makefile
+++ b/Makefile
@@ -16,11 +16,14 @@ check=sparse $(CHECKFLAGS)
$(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
diff --git a/ctree.h b/ctree.h
index 7e4ff527..beaa6e02 100644
--- a/ctree.h
+++ b/ctree.h
@@ -14,6 +14,8 @@ struct btrfs_trans_handle;
#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
@@ -44,7 +46,7 @@ struct btrfs_key {
* 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;
@@ -68,8 +70,8 @@ struct btrfs_buffer;
* 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;
@@ -140,7 +142,7 @@ struct btrfs_extent_item {
} __attribute__ ((__packed__));
struct btrfs_inode_timespec {
- __le32 sec;
+ __le64 sec;
__le32 nsec;
} __attribute__ ((__packed__));
@@ -207,10 +209,15 @@ struct btrfs_file_extent_item {
__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;
diff --git a/kerncompat.h b/kerncompat.h
index 105d3f58..647d38e9 100644
--- a/kerncompat.h
+++ b/kerncompat.h
@@ -7,6 +7,7 @@
#define __GFP_BITS_SHIFT 20
#define __GFP_BITS_MASK ((int)((1 << __GFP_BITS_SHIFT) - 1))
#define GFP_KERNEL 0
+#define GFP_NOFS 0
#define __read_mostly
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define PAGE_SHIFT 12
diff --git a/mkfs.c b/mkfs.c
index d8f99606..bf2a434e 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -296,7 +296,7 @@ int main(int ac, char **av)
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");
diff --git a/quick-test.c b/quick-test.c
index ef12cf88..79da4856 100644
--- a/quick-test.c
+++ b/quick-test.c
@@ -30,7 +30,7 @@ int main(int ac, char **av) {
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;
@@ -51,9 +51,9 @@ int main(int ac, char **av) {
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");