blob: b391335864b1f0c91e5bb5cf572337cf532f98fb [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;
8 union {
Chris Mason234b63a2007-03-13 10:46:10 -04009 struct btrfs_node node;
10 struct btrfs_leaf leaf;
Chris Masoneb60cea2007-02-02 09:18:22 -050011 };
Chris Masoned2ff2c2007-03-01 18:59:40 -050012 struct list_head dirty;
13 struct list_head cache;
Chris Masoneb60cea2007-02-02 09:18:22 -050014};
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 Masond97e63b2007-02-20 16:40:44 -050027int mkfs(int fd);
28
Chris Mason234b63a2007-03-13 10:46:10 -040029#define BTRFS_SUPER_INFO_OFFSET(bs) (16 * (bs))
Chris Masoneb60cea2007-02-02 09:18:22 -050030
31#endif