ref-verify.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2014 Facebook. All rights reserved.
  4. */
  5. #ifndef BTRFS_REF_VERIFY_H
  6. #define BTRFS_REF_VERIFY_H
  7. #ifdef CONFIG_BTRFS_FS_REF_VERIFY
  8. int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info);
  9. void btrfs_free_ref_cache(struct btrfs_fs_info *fs_info);
  10. int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info,
  11. struct btrfs_ref *generic_ref);
  12. void btrfs_free_ref_tree_range(struct btrfs_fs_info *fs_info, u64 start,
  13. u64 len);
  14. static inline void btrfs_init_ref_verify(struct btrfs_fs_info *fs_info)
  15. {
  16. spin_lock_init(&fs_info->ref_verify_lock);
  17. fs_info->block_tree = RB_ROOT;
  18. }
  19. #else
  20. static inline int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info)
  21. {
  22. return 0;
  23. }
  24. static inline void btrfs_free_ref_cache(struct btrfs_fs_info *fs_info)
  25. {
  26. }
  27. static inline int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info,
  28. struct btrfs_ref *generic_ref)
  29. {
  30. return 0;
  31. }
  32. static inline void btrfs_free_ref_tree_range(struct btrfs_fs_info *fs_info,
  33. u64 start, u64 len)
  34. {
  35. }
  36. static inline void btrfs_init_ref_verify(struct btrfs_fs_info *fs_info)
  37. {
  38. }
  39. #endif /* CONFIG_BTRFS_FS_REF_VERIFY */
  40. #endif