aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@redhat.com>2008-12-02 07:17:45 -0500
committerChris Mason <chris.mason@oracle.com>2008-12-02 07:17:45 -0500
commit607d432da0542e84ddcd358adfddac6f68500e3d (patch)
tree44425bf1fe8378022bc1b84425ca4ba9d0176566 /fs/btrfs/ctree.h
parentc6e2bac1a52ffc36dd10769b594dfa3994e95f77 (diff)
Btrfs: add support for multiple csum algorithms
This patch gives us the space we will need in order to have different csum algorithims at some point in the future. We save the csum algorithim type in the superblock, and use those instead of define's. Signed-off-by: Josef Bacik <jbacik@redhat.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b5af1fc77c5d..6d8350332b1d 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -109,8 +109,14 @@ struct btrfs_ordered_sum;
109 109
110/* 32 bytes in various csum fields */ 110/* 32 bytes in various csum fields */
111#define BTRFS_CSUM_SIZE 32 111#define BTRFS_CSUM_SIZE 32
112
113/* csum types */
114#define BTRFS_CSUM_TYPE_CRC32 0
115
116static int btrfs_csum_sizes[] = { 4, 0 };
117
112/* four bytes for CRC32 */ 118/* four bytes for CRC32 */
113#define BTRFS_CRC32_SIZE 4 119//#define BTRFS_CRC32_SIZE 4
114#define BTRFS_EMPTY_DIR_SIZE 0 120#define BTRFS_EMPTY_DIR_SIZE 0
115 121
116#define BTRFS_FT_UNKNOWN 0 122#define BTRFS_FT_UNKNOWN 0
@@ -308,6 +314,7 @@ struct btrfs_super_block {
308 __le64 compat_flags; 314 __le64 compat_flags;
309 __le64 compat_ro_flags; 315 __le64 compat_ro_flags;
310 __le64 incompat_flags; 316 __le64 incompat_flags;
317 __le16 csum_type;
311 u8 root_level; 318 u8 root_level;
312 u8 chunk_root_level; 319 u8 chunk_root_level;
313 u8 log_root_level; 320 u8 log_root_level;
@@ -1483,6 +1490,7 @@ BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item,
1483 last_snapshot, 64); 1490 last_snapshot, 64);
1484 1491
1485/* struct btrfs_super_block */ 1492/* struct btrfs_super_block */
1493
1486BTRFS_SETGET_STACK_FUNCS(super_bytenr, struct btrfs_super_block, bytenr, 64); 1494BTRFS_SETGET_STACK_FUNCS(super_bytenr, struct btrfs_super_block, bytenr, 64);
1487BTRFS_SETGET_STACK_FUNCS(super_flags, struct btrfs_super_block, flags, 64); 1495BTRFS_SETGET_STACK_FUNCS(super_flags, struct btrfs_super_block, flags, 64);
1488BTRFS_SETGET_STACK_FUNCS(super_generation, struct btrfs_super_block, 1496BTRFS_SETGET_STACK_FUNCS(super_generation, struct btrfs_super_block,
@@ -1524,6 +1532,15 @@ BTRFS_SETGET_STACK_FUNCS(super_compat_ro_flags, struct btrfs_super_block,
1524 compat_flags, 64); 1532 compat_flags, 64);
1525BTRFS_SETGET_STACK_FUNCS(super_incompat_flags, struct btrfs_super_block, 1533BTRFS_SETGET_STACK_FUNCS(super_incompat_flags, struct btrfs_super_block,
1526 incompat_flags, 64); 1534 incompat_flags, 64);
1535BTRFS_SETGET_STACK_FUNCS(super_csum_type, struct btrfs_super_block,
1536 csum_type, 16);
1537
1538static inline int btrfs_super_csum_size(struct btrfs_super_block *s)
1539{
1540 int t = btrfs_super_csum_type(s);
1541 BUG_ON(t >= ARRAY_SIZE(btrfs_csum_sizes));
1542 return btrfs_csum_sizes[t];
1543}
1527 1544
1528static inline unsigned long btrfs_leaf_data(struct extent_buffer *l) 1545static inline unsigned long btrfs_leaf_data(struct extent_buffer *l)
1529{ 1546{