disk-io.h 1.3 KB
Newer Older
1 2
#ifndef __DISKIO__
#define __DISKIO__
3
#include "list.h"
4

C
Chris Mason 已提交
5
struct btrfs_buffer {
6 7
	u64 blocknr;
	int count;
C
Chris Mason 已提交
8 9
	struct list_head dirty;
	struct list_head cache;
10
	union {
C
Chris Mason 已提交
11 12
		struct btrfs_node node;
		struct btrfs_leaf leaf;
13 14 15
	};
};

C
Chris Mason 已提交
16 17
struct btrfs_buffer *read_tree_block(struct btrfs_root *root, u64 blocknr);
struct btrfs_buffer *find_tree_block(struct btrfs_root *root, u64 blocknr);
18 19 20 21 22 23 24 25
int write_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
		     struct btrfs_buffer *buf);
int dirty_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
		     struct btrfs_buffer *buf);
int clean_tree_block(struct btrfs_trans_handle *trans,
		     struct btrfs_root *root, struct btrfs_buffer *buf);
int btrfs_commit_transaction(struct btrfs_trans_handle *trans, struct btrfs_root
			     *root, struct btrfs_super_block *s);
C
Chris Mason 已提交
26
struct btrfs_root *open_ctree(char *filename, struct btrfs_super_block *s);
27
struct btrfs_root *open_ctree_fd(int fp, struct btrfs_super_block *super);
C
Chris Mason 已提交
28 29
int close_ctree(struct btrfs_root *root, struct btrfs_super_block *s);
void btrfs_block_release(struct btrfs_root *root, struct btrfs_buffer *buf);
30 31
int write_ctree_super(struct btrfs_trans_handle *trans, struct btrfs_root *root,
		      struct btrfs_super_block *s);
C
Chris Mason 已提交
32
int mkfs(int fd, u64 num_blocks, u32 blocksize);
33

C
Chris Mason 已提交
34
#define BTRFS_SUPER_INFO_OFFSET (16 * 1024)
35 36

#endif