disk-io.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // SPDX-License-Identifier: GPL-2.0+
  2. #ifndef __BTRFS_DISK_IO_H__
  3. #define __BTRFS_DISK_IO_H__
  4. #include <linux/sizes.h>
  5. #include <fs_internal.h>
  6. #include "ctree.h"
  7. #include "disk-io.h"
  8. #define BTRFS_SUPER_INFO_OFFSET SZ_64K
  9. #define BTRFS_SUPER_INFO_SIZE SZ_4K
  10. /* From btrfs-progs */
  11. int read_whole_eb(struct btrfs_fs_info *info, struct extent_buffer *eb, int mirror);
  12. struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
  13. u64 parent_transid);
  14. int read_extent_data(struct btrfs_fs_info *fs_info, char *data, u64 logical,
  15. u64 *len, int mirror);
  16. struct extent_buffer* btrfs_find_create_tree_block(
  17. struct btrfs_fs_info *fs_info, u64 bytenr);
  18. struct extent_buffer *btrfs_find_tree_block(struct btrfs_fs_info *fs_info,
  19. u64 bytenr, u32 blocksize);
  20. struct btrfs_root *btrfs_read_fs_root_no_cache(struct btrfs_fs_info *fs_info,
  21. struct btrfs_key *location);
  22. struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
  23. struct btrfs_key *location);
  24. void btrfs_setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
  25. u64 objectid);
  26. void btrfs_free_fs_info(struct btrfs_fs_info *fs_info);
  27. struct btrfs_fs_info *btrfs_new_fs_info(void);
  28. int btrfs_check_fs_compatibility(struct btrfs_super_block *sb);
  29. int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info);
  30. void btrfs_release_all_roots(struct btrfs_fs_info *fs_info);
  31. void btrfs_cleanup_all_caches(struct btrfs_fs_info *fs_info);
  32. struct btrfs_fs_info *open_ctree_fs_info(struct blk_desc *desc,
  33. struct disk_partition *part);
  34. int close_ctree_fs_info(struct btrfs_fs_info *fs_info);
  35. int btrfs_read_dev_super(struct blk_desc *desc, struct disk_partition *part,
  36. struct btrfs_super_block *sb);
  37. int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid);
  38. int btrfs_set_buffer_uptodate(struct extent_buffer *buf);
  39. int btrfs_csum_data(u16 csum_type, const u8 *data, u8 *out, size_t len);
  40. int csum_tree_block_size(struct extent_buffer *buf, u16 csum_sectorsize,
  41. int verify, u16 csum_type);
  42. #endif