ref-verify.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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_root *root, u64 bytenr, u64 num_bytes,
  11. u64 parent, u64 ref_root, u64 owner, u64 offset,
  12. int action);
  13. void btrfs_free_ref_tree_range(struct btrfs_fs_info *fs_info, u64 start,
  14. u64 len);
  15. static inline void btrfs_init_ref_verify(struct btrfs_fs_info *fs_info)
  16. {
  17. spin_lock_init(&fs_info->ref_verify_lock);
  18. fs_info->block_tree = RB_ROOT;
  19. }
  20. #else
  21. static inline int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info)
  22. {
  23. return 0;
  24. }
  25. static inline void btrfs_free_ref_cache(struct btrfs_fs_info *fs_info)
  26. {
  27. }
  28. static inline int btrfs_ref_tree_mod(struct btrfs_root *root, u64 bytenr,
  29. u64 num_bytes, u64 parent, u64 ref_root,
  30. u64 owner, u64 offset, int action)
  31. {
  32. return 0;
  33. }
  34. static inline void btrfs_free_ref_tree_range(struct btrfs_fs_info *fs_info,
  35. u64 start, u64 len)
  36. {
  37. }
  38. static inline void btrfs_init_ref_verify(struct btrfs_fs_info *fs_info)
  39. {
  40. }
  41. #endif /* CONFIG_BTRFS_FS_REF_VERIFY */
  42. #endif