sync up with kernel sources

This commit is contained in:
Chris Mason 2007-04-02 14:18:17 -04:00 committed by David Woodhouse
parent b21892315c
commit 1330edb0bc
5 changed files with 18 additions and 7 deletions

View File

@ -16,11 +16,14 @@ check=sparse $(CHECKFLAGS)
$(check) $< $(check) $<
$(CC) $(CFLAGS) -c $< $(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 mkfs.btrfs: $(objects) mkfs.o
gcc $(CFLAGS) -o 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 debug-tree: $(objects) debug-tree.o
gcc $(CFLAGS) -o debug-tree $(objects) debug-tree.o gcc $(CFLAGS) -o debug-tree $(objects) debug-tree.o

13
ctree.h
View File

@ -14,6 +14,8 @@ struct btrfs_trans_handle;
#define BTRFS_FS_TREE_OBJECTID 4 #define BTRFS_FS_TREE_OBJECTID 4
#define BTRFS_FIRST_FREE_OBJECTID 5 #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) * the key defines the order in the tree, and so it also defines (optimal)
* block layout. objectid corresonds to the inode number. The flags * 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. * every tree block (leaf or node) starts with this header.
*/ */
struct btrfs_header { struct btrfs_header {
__le32 csum[8]; u8 csum[BTRFS_CSUM_SIZE];
u8 fsid[16]; /* FS specific uuid */ u8 fsid[16]; /* FS specific uuid */
__le64 blocknr; /* which block this node is supposed to live in */ __le64 blocknr; /* which block this node is supposed to live in */
__le64 generation; __le64 generation;
@ -68,8 +70,8 @@ struct btrfs_buffer;
* it currently lacks any block count etc etc * it currently lacks any block count etc etc
*/ */
struct btrfs_super_block { struct btrfs_super_block {
u8 csum[BTRFS_CSUM_SIZE];
/* the first 3 fields must match struct btrfs_header */ /* the first 3 fields must match struct btrfs_header */
__le32 csum[8];
u8 fsid[16]; /* FS specific uuid */ u8 fsid[16]; /* FS specific uuid */
__le64 blocknr; /* this block number */ __le64 blocknr; /* this block number */
__le64 magic; __le64 magic;
@ -140,7 +142,7 @@ struct btrfs_extent_item {
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
struct btrfs_inode_timespec { struct btrfs_inode_timespec {
__le32 sec; __le64 sec;
__le32 nsec; __le32 nsec;
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
@ -207,10 +209,15 @@ struct btrfs_file_extent_item {
__le64 num_blocks; __le64 num_blocks;
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
struct btrfs_csum_item {
u8 csum[BTRFS_CSUM_SIZE];
} __attribute__ ((__packed__));
struct btrfs_inode_map_item { struct btrfs_inode_map_item {
struct btrfs_disk_key key; struct btrfs_disk_key key;
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
struct btrfs_fs_info { struct btrfs_fs_info {
struct btrfs_root *fs_root; struct btrfs_root *fs_root;
struct btrfs_root *extent_root; struct btrfs_root *extent_root;

View File

@ -7,6 +7,7 @@
#define __GFP_BITS_SHIFT 20 #define __GFP_BITS_SHIFT 20
#define __GFP_BITS_MASK ((int)((1 << __GFP_BITS_SHIFT) - 1)) #define __GFP_BITS_MASK ((int)((1 << __GFP_BITS_SHIFT) - 1))
#define GFP_KERNEL 0 #define GFP_KERNEL 0
#define GFP_NOFS 0
#define __read_mostly #define __read_mostly
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define PAGE_SHIFT 12 #define PAGE_SHIFT 12

2
mkfs.c
View File

@ -296,7 +296,7 @@ int main(int ac, char **av)
exit(1); exit(1);
} }
memset(buf, 0, 4096); memset(buf, 0, 4096);
for(i = 0; i < 6; i++) { for(i = 0; i < 16; i++) {
ret = write(fd, buf, 4096); ret = write(fd, buf, 4096);
if (ret != 4096) { if (ret != 4096) {
fprintf(stderr, "unable to zero fill device\n"); fprintf(stderr, "unable to zero fill device\n");

View File

@ -30,7 +30,7 @@ int main(int ac, char **av) {
radix_tree_init(); radix_tree_init();
root = open_ctree("dbfile", &super); root = open_ctree(av[1], &super);
trans = btrfs_start_transaction(root, 1); trans = btrfs_start_transaction(root, 1);
srand(55); srand(55);
ins.flags = 0; ins.flags = 0;
@ -51,9 +51,9 @@ int main(int ac, char **av) {
if (i == run_size - 5) { if (i == run_size - 5) {
btrfs_commit_transaction(trans, root, &super); btrfs_commit_transaction(trans, root, &super);
} }
} }
close_ctree(root, &super); close_ctree(root, &super);
exit(1);
root = open_ctree("dbfile", &super); root = open_ctree("dbfile", &super);
printf("starting search\n"); printf("starting search\n");