diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-03-27 09:06:38 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-03-27 09:06:38 -0400 |
commit | 9a6f11ed8f421fb1cc7b37390e32316ff4701f5d (patch) | |
tree | eb4709b48ddc223669e226b34db2e1a22f9aac86 /fs | |
parent | 6407bf6d7c449cbfb0a39d985194e265eda3baf4 (diff) |
Btrfs: split out level field in struct header
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/TODO | 5 | ||||
-rw-r--r-- | fs/btrfs/ctree.c | 1 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 8 |
3 files changed, 4 insertions, 10 deletions
diff --git a/fs/btrfs/TODO b/fs/btrfs/TODO index 7aec75e9a37e..e9371385ccc0 100644 --- a/fs/btrfs/TODO +++ b/fs/btrfs/TODO | |||
@@ -1,12 +1,7 @@ | |||
1 | * cleanup, add more error checking, get rid of BUG_ONs | 1 | * cleanup, add more error checking, get rid of BUG_ONs |
2 | * Make IO functions look more like the page cache | ||
3 | * Fix ENOSPC handling | 2 | * Fix ENOSPC handling |
4 | * make a real mkfs and superblock | ||
5 | * Do checksumming | 3 | * Do checksumming |
6 | * Use a real check instead of mark_buffer_dirty | ||
7 | * Define FS objects in terms of different item types | ||
8 | * Add block mapping tree (simple dm layer) | 4 | * Add block mapping tree (simple dm layer) |
9 | * Add simple tree locking (semaphore per tree) | ||
10 | * Make allocator smarter | 5 | * Make allocator smarter |
11 | * make level a field in header | 6 | * make level a field in header |
12 | * add a block group to struct inode | 7 | * add a block group to struct inode |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index b33a6bfaf327..48c611948d11 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -753,6 +753,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root | |||
753 | split_buffer = btrfs_alloc_free_block(trans, root); | 753 | split_buffer = btrfs_alloc_free_block(trans, root); |
754 | split = btrfs_buffer_node(split_buffer); | 754 | split = btrfs_buffer_node(split_buffer); |
755 | btrfs_set_header_flags(&split->header, btrfs_header_flags(&c->header)); | 755 | btrfs_set_header_flags(&split->header, btrfs_header_flags(&c->header)); |
756 | btrfs_set_header_level(&split->header, btrfs_header_level(&c->header)); | ||
756 | btrfs_set_header_blocknr(&split->header, split_buffer->b_blocknr); | 757 | btrfs_set_header_blocknr(&split->header, split_buffer->b_blocknr); |
757 | btrfs_set_header_generation(&split->header, trans->transid); | 758 | btrfs_set_header_generation(&split->header, trans->transid); |
758 | btrfs_set_header_parentid(&split->header, | 759 | btrfs_set_header_parentid(&split->header, |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1a98952e0faf..a4ad39b58a4b 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -59,7 +59,7 @@ struct btrfs_header { | |||
59 | __le32 ham; | 59 | __le32 ham; |
60 | __le16 nritems; | 60 | __le16 nritems; |
61 | __le16 flags; | 61 | __le16 flags; |
62 | /* generation flags to be added */ | 62 | u8 level; |
63 | } __attribute__ ((__packed__)); | 63 | } __attribute__ ((__packed__)); |
64 | 64 | ||
65 | #define BTRFS_MAX_LEVEL 8 | 65 | #define BTRFS_MAX_LEVEL 8 |
@@ -648,15 +648,13 @@ static inline void btrfs_set_header_flags(struct btrfs_header *h, u16 val) | |||
648 | 648 | ||
649 | static inline int btrfs_header_level(struct btrfs_header *h) | 649 | static inline int btrfs_header_level(struct btrfs_header *h) |
650 | { | 650 | { |
651 | return btrfs_header_flags(h) & (BTRFS_MAX_LEVEL - 1); | 651 | return h->level; |
652 | } | 652 | } |
653 | 653 | ||
654 | static inline void btrfs_set_header_level(struct btrfs_header *h, int level) | 654 | static inline void btrfs_set_header_level(struct btrfs_header *h, int level) |
655 | { | 655 | { |
656 | u16 flags; | ||
657 | BUG_ON(level > BTRFS_MAX_LEVEL); | 656 | BUG_ON(level > BTRFS_MAX_LEVEL); |
658 | flags = btrfs_header_flags(h) & ~(BTRFS_MAX_LEVEL - 1); | 657 | h->level = level; |
659 | btrfs_set_header_flags(h, flags | level); | ||
660 | } | 658 | } |
661 | 659 | ||
662 | static inline int btrfs_is_leaf(struct btrfs_node *n) | 660 | static inline int btrfs_is_leaf(struct btrfs_node *n) |