backref.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2011 STRATO. All rights reserved.
  4. */
  5. #ifndef BTRFS_BACKREF_H
  6. #define BTRFS_BACKREF_H
  7. #include <linux/btrfs.h>
  8. #include "ulist.h"
  9. #include "extent_io.h"
  10. struct inode_fs_paths {
  11. struct btrfs_path *btrfs_path;
  12. struct btrfs_root *fs_root;
  13. struct btrfs_data_container *fspath;
  14. };
  15. typedef int (iterate_extent_inodes_t)(u64 inum, u64 offset, u64 root,
  16. void *ctx);
  17. int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
  18. struct btrfs_path *path, struct btrfs_key *found_key,
  19. u64 *flags);
  20. int tree_backref_for_extent(unsigned long *ptr, struct extent_buffer *eb,
  21. struct btrfs_key *key, struct btrfs_extent_item *ei,
  22. u32 item_size, u64 *out_root, u8 *out_level);
  23. int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
  24. u64 extent_item_objectid,
  25. u64 extent_offset, int search_commit_root,
  26. iterate_extent_inodes_t *iterate, void *ctx,
  27. bool ignore_offset);
  28. int iterate_inodes_from_logical(u64 logical, struct btrfs_fs_info *fs_info,
  29. struct btrfs_path *path,
  30. iterate_extent_inodes_t *iterate, void *ctx,
  31. bool ignore_offset);
  32. int paths_from_inode(u64 inum, struct inode_fs_paths *ipath);
  33. int btrfs_find_all_roots(struct btrfs_trans_handle *trans,
  34. struct btrfs_fs_info *fs_info, u64 bytenr,
  35. u64 time_seq, struct ulist **roots, bool ignore_offset);
  36. char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
  37. u32 name_len, unsigned long name_off,
  38. struct extent_buffer *eb_in, u64 parent,
  39. char *dest, u32 size);
  40. struct btrfs_data_container *init_data_container(u32 total_bytes);
  41. struct inode_fs_paths *init_ipath(s32 total_bytes, struct btrfs_root *fs_root,
  42. struct btrfs_path *path);
  43. void free_ipath(struct inode_fs_paths *ipath);
  44. int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
  45. u64 start_off, struct btrfs_path *path,
  46. struct btrfs_inode_extref **ret_extref,
  47. u64 *found_off);
  48. int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr,
  49. struct ulist *roots, struct ulist *tmp_ulist);
  50. int __init btrfs_prelim_ref_init(void);
  51. void __cold btrfs_prelim_ref_exit(void);
  52. struct prelim_ref {
  53. struct rb_node rbnode;
  54. u64 root_id;
  55. struct btrfs_key key_for_search;
  56. int level;
  57. int count;
  58. struct extent_inode_elem *inode_list;
  59. u64 parent;
  60. u64 wanted_disk_byte;
  61. };
  62. #endif