blob: 5771bb90acb21678c452e7d1229bafe193291a2b [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);
18int write_tree_block(struct btrfs_root *root, struct btrfs_buffer *buf);
19int dirty_tree_block(struct btrfs_root *root, struct btrfs_buffer *buf);
20int clean_tree_block(struct btrfs_root *root, struct btrfs_buffer *buf);
21int btrfs_commit_transaction(struct btrfs_root *root,
22 struct btrfs_super_block *s);
23struct btrfs_root *open_ctree(char *filename, struct btrfs_super_block *s);
24int close_ctree(struct btrfs_root *root, struct btrfs_super_block *s);
25void btrfs_block_release(struct btrfs_root *root, struct btrfs_buffer *buf);
26int write_ctree_super(struct btrfs_root *root, struct btrfs_super_block *s);
Chris Mason123abc82007-03-14 14:14:43 -040027int mkfs(int fd, u64 num_blocks, u32 blocksize);
Chris Mason3768f362007-03-13 16:47:54 -040028
Chris Mason123abc82007-03-14 14:14:43 -040029#define BTRFS_SUPER_INFO_OFFSET (16 * 1024)
Chris Masoneb60cea2007-02-02 09:18:22 -050030
31#endif