1 /* 2 * Copyright (C) 2014 Facebook. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public 14 * License along with this program; if not, write to the 15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 * Boston, MA 021110-1307, USA. 17 */ 18 #ifndef __REF_VERIFY__ 19 #define __REF_VERIFY__ 20 21 #ifdef CONFIG_BTRFS_FS_REF_VERIFY 22 int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info); 23 void btrfs_free_ref_cache(struct btrfs_fs_info *fs_info); 24 int btrfs_ref_tree_mod(struct btrfs_root *root, u64 bytenr, u64 num_bytes, 25 u64 parent, u64 ref_root, u64 owner, u64 offset, 26 int action); 27 void btrfs_free_ref_tree_range(struct btrfs_fs_info *fs_info, u64 start, 28 u64 len); 29 30 static inline void btrfs_init_ref_verify(struct btrfs_fs_info *fs_info) 31 { 32 spin_lock_init(&fs_info->ref_verify_lock); 33 fs_info->block_tree = RB_ROOT; 34 } 35 #else 36 static inline int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info) 37 { 38 return 0; 39 } 40 41 static inline void btrfs_free_ref_cache(struct btrfs_fs_info *fs_info) 42 { 43 } 44 45 static inline int btrfs_ref_tree_mod(struct btrfs_root *root, u64 bytenr, 46 u64 num_bytes, u64 parent, u64 ref_root, 47 u64 owner, u64 offset, int action) 48 { 49 return 0; 50 } 51 52 static inline void btrfs_free_ref_tree_range(struct btrfs_fs_info *fs_info, 53 u64 start, u64 len) 54 { 55 } 56 57 static inline void btrfs_init_ref_verify(struct btrfs_fs_info *fs_info) 58 { 59 } 60 61 #endif /* CONFIG_BTRFS_FS_REF_VERIFY */ 62 #endif /* _REF_VERIFY__ */ 63