blob: 24a9e77c831176e93d54bc70c85ab1c58309d705 [file] [log] [blame]
Chris Masoneb60cea2007-02-02 09:18:22 -05001#ifndef __DISKIO__
2#define __DISKIO__
Chris Masoned2ff2c2007-03-01 18:59:40 -05003#include "list.h"
Chris Masoneb60cea2007-02-02 09:18:22 -05004
Chris Mason234b63a2007-03-13 10:46:10 -04005struct btrfs_buffer {
Chris Masoneb60cea2007-02-02 09:18:22 -05006 u64 blocknr;
7 int count;
Chris Mason123abc82007-03-14 14:14:43 -04008 struct list_head dirty;
9 struct list_head cache;
Chris Masoneb60cea2007-02-02 09:18:22 -050010 union {
Chris Mason234b63a2007-03-13 10:46:10 -040011 struct btrfs_node node;
12 struct btrfs_leaf leaf;
Chris Masoneb60cea2007-02-02 09:18:22 -050013 };
14};
15
Chris Mason234b63a2007-03-13 10:46:10 -040016struct btrfs_buffer *read_tree_block(struct btrfs_root *root, u64 blocknr);
17struct btrfs_buffer *find_tree_block(struct btrfs_root *root, u64 blocknr);
Chris Masone089f052007-03-16 16:20:31 -040018int write_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
19 struct btrfs_buffer *buf);
20int dirty_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
21 struct btrfs_buffer *buf);
22int clean_tree_block(struct btrfs_trans_handle *trans,
23 struct btrfs_root *root, struct btrfs_buffer *buf);
24int btrfs_commit_transaction(struct btrfs_trans_handle *trans, struct btrfs_root
25 *root, struct btrfs_super_block *s);
Chris Mason234b63a2007-03-13 10:46:10 -040026struct btrfs_root *open_ctree(char *filename, struct btrfs_super_block *s);
27int close_ctree(struct btrfs_root *root, struct btrfs_super_block *s);
28void btrfs_block_release(struct btrfs_root *root, struct btrfs_buffer *buf);
Chris Masone089f052007-03-16 16:20:31 -040029int write_ctree_super(struct btrfs_trans_handle *trans, struct btrfs_root *root,
30 struct btrfs_super_block *s);
Chris Mason123abc82007-03-14 14:14:43 -040031int mkfs(int fd, u64 num_blocks, u32 blocksize);
Chris Mason3768f362007-03-13 16:47:54 -040032
Chris Mason123abc82007-03-14 14:14:43 -040033#define BTRFS_SUPER_INFO_OFFSET (16 * 1024)
Chris Masoneb60cea2007-02-02 09:18:22 -050034
35#endif