disk-io.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef __DISKIO__
  2. #define __DISKIO__
  3. #include <linux/buffer_head.h>
  4. #define BTRFS_SUPER_INFO_OFFSET (16 * 1024)
  5. static inline struct btrfs_node *btrfs_buffer_node(struct buffer_head *bh)
  6. {
  7. return (struct btrfs_node *)bh->b_data;
  8. }
  9. static inline struct btrfs_leaf *btrfs_buffer_leaf(struct buffer_head *bh)
  10. {
  11. return (struct btrfs_leaf *)bh->b_data;
  12. }
  13. static inline struct btrfs_header *btrfs_buffer_header(struct buffer_head *bh)
  14. {
  15. return &((struct btrfs_node *)bh->b_data)->header;
  16. }
  17. struct buffer_head *read_tree_block(struct btrfs_root *root, u64 blocknr);
  18. struct buffer_head *btrfs_find_create_tree_block(struct btrfs_root *root,
  19. u64 blocknr);
  20. int write_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
  21. struct buffer_head *buf);
  22. int dirty_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
  23. struct buffer_head *buf);
  24. int clean_tree_block(struct btrfs_trans_handle *trans,
  25. struct btrfs_root *root, struct buffer_head *buf);
  26. int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
  27. struct btrfs_root *root);
  28. struct btrfs_root *open_ctree(struct super_block *sb);
  29. int close_ctree(struct btrfs_root *root);
  30. void btrfs_block_release(struct btrfs_root *root, struct buffer_head *buf);
  31. int write_ctree_super(struct btrfs_trans_handle *trans,
  32. struct btrfs_root *root);
  33. struct buffer_head *btrfs_find_tree_block(struct btrfs_root *root, u64 blocknr);
  34. int btrfs_csum_data(struct btrfs_root * root, char *data, size_t len,
  35. char *result);
  36. struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
  37. struct btrfs_key *location);
  38. u64 bh_blocknr(struct buffer_head *bh);
  39. #endif