summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/ctree.c22
-rw-r--r--fs/btrfs/ctree.h20
2 files changed, 24 insertions, 18 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 88c3b338508d..98f741c85905 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -29,6 +29,28 @@ static int balance_node_right(struct btrfs_trans_handle *trans,
29static void del_ptr(struct btrfs_root *root, struct btrfs_path *path, 29static void del_ptr(struct btrfs_root *root, struct btrfs_path *path,
30 int level, int slot); 30 int level, int slot);
31 31
32static const struct btrfs_csums {
33 u16 size;
34 const char *name;
35} btrfs_csums[] = {
36 [BTRFS_CSUM_TYPE_CRC32] = { .size = 4, .name = "crc32c" },
37};
38
39int btrfs_super_csum_size(const struct btrfs_super_block *s)
40{
41 u16 t = btrfs_super_csum_type(s);
42 /*
43 * csum type is validated at mount time
44 */
45 return btrfs_csums[t].size;
46}
47
48const char *btrfs_super_csum_name(u16 csum_type)
49{
50 /* csum type is validated at mount time */
51 return btrfs_csums[csum_type].name;
52}
53
32struct btrfs_path *btrfs_alloc_path(void) 54struct btrfs_path *btrfs_alloc_path(void)
33{ 55{
34 return kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS); 56 return kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS);
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 033a0d5d1789..19d669d12ca1 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -83,10 +83,6 @@ struct btrfs_ref;
83 */ 83 */
84#define BTRFS_LINK_MAX 65535U 84#define BTRFS_LINK_MAX 65535U
85 85
86/* four bytes for CRC32 */
87static const int btrfs_csum_sizes[] = { 4 };
88static const char *btrfs_csum_names[] = { "crc32c" };
89
90#define BTRFS_EMPTY_DIR_SIZE 0 86#define BTRFS_EMPTY_DIR_SIZE 0
91 87
92/* ioprio of readahead is set to idle */ 88/* ioprio of readahead is set to idle */
@@ -2167,20 +2163,8 @@ BTRFS_SETGET_STACK_FUNCS(super_magic, struct btrfs_super_block, magic, 64);
2167BTRFS_SETGET_STACK_FUNCS(super_uuid_tree_generation, struct btrfs_super_block, 2163BTRFS_SETGET_STACK_FUNCS(super_uuid_tree_generation, struct btrfs_super_block,
2168 uuid_tree_generation, 64); 2164 uuid_tree_generation, 64);
2169 2165
2170static inline int btrfs_super_csum_size(const struct btrfs_super_block *s) 2166int btrfs_super_csum_size(const struct btrfs_super_block *s);
2171{ 2167const char *btrfs_super_csum_name(u16 csum_type);
2172 u16 t = btrfs_super_csum_type(s);
2173 /*
2174 * csum type is validated at mount time
2175 */
2176 return btrfs_csum_sizes[t];
2177}
2178
2179static inline const char *btrfs_super_csum_name(u16 csum_type)
2180{
2181 /* csum type is validated at mount time */
2182 return btrfs_csum_names[csum_type];
2183}
2184 2168
2185/* 2169/*
2186 * The leaf data grows from end-to-front in the node. 2170 * The leaf data grows from end-to-front in the node.