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

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

C
Chris Mason 已提交
16 17 18 19 20 21 22 23 24 25 26
struct btrfs_buffer *read_tree_block(struct btrfs_root *root, u64 blocknr);
struct btrfs_buffer *find_tree_block(struct btrfs_root *root, u64 blocknr);
int write_tree_block(struct btrfs_root *root, struct btrfs_buffer *buf);
int dirty_tree_block(struct btrfs_root *root, struct btrfs_buffer *buf);
int clean_tree_block(struct btrfs_root *root, struct btrfs_buffer *buf);
int btrfs_commit_transaction(struct btrfs_root *root,
			     struct btrfs_super_block *s);
struct btrfs_root *open_ctree(char *filename, struct btrfs_super_block *s);
int close_ctree(struct btrfs_root *root, struct btrfs_super_block *s);
void btrfs_block_release(struct btrfs_root *root, struct btrfs_buffer *buf);
int write_ctree_super(struct btrfs_root *root, struct btrfs_super_block *s);
27 28
int mkfs(int fd);

C
Chris Mason 已提交
29
#define BTRFS_SUPER_INFO_OFFSET(bs) (16 * (bs))
30 31

#endif