blob: b5dee2fae4daa6297355687a30205f592a9ef493 [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
5struct tree_buffer {
6 u64 blocknr;
7 int count;
8 union {
9 struct node node;
10 struct leaf leaf;
11 };
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
16struct tree_buffer *read_tree_block(struct ctree_root *root, u64 blocknr);
Chris Mason9a8dd152007-02-23 08:38:36 -050017struct tree_buffer *find_tree_block(struct ctree_root *root, u64 blocknr);
Chris Masoneb60cea2007-02-02 09:18:22 -050018int write_tree_block(struct ctree_root *root, struct tree_buffer *buf);
Chris Masoned2ff2c2007-03-01 18:59:40 -050019int dirty_tree_block(struct ctree_root *root, struct tree_buffer *buf);
20int clean_tree_block(struct ctree_root *root, struct tree_buffer *buf);
21int commit_transaction(struct ctree_root *root);
Chris Masoncfaa7292007-02-21 17:04:57 -050022struct ctree_root *open_ctree(char *filename, struct ctree_super_block *s);
Chris Masoneb60cea2007-02-02 09:18:22 -050023int close_ctree(struct ctree_root *root);
24void tree_block_release(struct ctree_root *root, struct tree_buffer *buf);
Chris Masoncfaa7292007-02-21 17:04:57 -050025int write_ctree_super(struct ctree_root *root, struct ctree_super_block *s);
Chris Masond97e63b2007-02-20 16:40:44 -050026int mkfs(int fd);
27
28#define CTREE_SUPER_INFO_OFFSET(bs) (16 * (bs))
Chris Masoneb60cea2007-02-02 09:18:22 -050029
30#endif