btrfs: avoid duplications by moving the static int array from header to c file
diff mbox

Message ID 1281664548-10189-1-git-send-email-crquan@gmail.com
State New, archived
Headers show

Commit Message

Cheng Renquan Aug. 13, 2010, 1:55 a.m. UTC
None

Patch
diff mbox

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index c3df14c..3a89207 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -24,6 +24,15 @@ 
 #include "print-tree.h"
 #include "locking.h"
 
+int btrfs_super_csum_size(struct btrfs_super_block *s)
+{
+	static const int btrfs_csum_sizes[] = { 4, 0 };
+
+	int t = btrfs_super_csum_type(s);
+	BUG_ON(t >= ARRAY_SIZE(btrfs_csum_sizes));
+	return btrfs_csum_sizes[t];
+}
+
 static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
 		      *root, struct btrfs_path *path, int level);
 static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index e9bf864..99220ee 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -132,8 +132,6 @@  struct btrfs_ordered_sum;
 /* csum types */
 #define BTRFS_CSUM_TYPE_CRC32	0
 
-static int btrfs_csum_sizes[] = { 4, 0 };
-
 /* four bytes for CRC32 */
 #define BTRFS_EMPTY_DIR_SIZE 0
 
@@ -1877,12 +1875,7 @@  BTRFS_SETGET_STACK_FUNCS(super_incompat_flags, struct btrfs_super_block,
 BTRFS_SETGET_STACK_FUNCS(super_csum_type, struct btrfs_super_block,
 			 csum_type, 16);
 
-static inline int btrfs_super_csum_size(struct btrfs_super_block *s)
-{
-	int t = btrfs_super_csum_type(s);
-	BUG_ON(t >= ARRAY_SIZE(btrfs_csum_sizes));
-	return btrfs_csum_sizes[t];
-}
+int btrfs_super_csum_size(struct btrfs_super_block *s);
 
 static inline unsigned long btrfs_leaf_data(struct extent_buffer *l)
 {