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