disk-io.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef __DISKIO__
  2. #define __DISKIO__
  3. #include <linux/buffer_head.h>
  4. #define BTRFS_SUPER_INFO_OFFSET (16 * 1024)
  5. enum btrfs_bh_state_bits {
  6. BH_Checked = BH_PrivateStart,
  7. };
  8. BUFFER_FNS(Checked, checked);
  9. static inline struct btrfs_node *btrfs_buffer_node(struct buffer_head *bh)
  10. {
  11. return (struct btrfs_node *)bh->b_data;
  12. }
  13. static inline struct btrfs_leaf *btrfs_buffer_leaf(struct buffer_head *bh)
  14. {
  15. return (struct btrfs_leaf *)bh->b_data;
  16. }
  17. static inline struct btrfs_header *btrfs_buffer_header(struct buffer_head *bh)
  18. {
  19. return &((struct btrfs_node *)bh->b_data)->header;
  20. }
  21. struct buffer_head *read_tree_block(struct btrfs_root *root, u64 blocknr);
  22. int readahead_tree_block(struct btrfs_root *root, u64 blocknr);
  23. struct buffer_head *btrfs_find_create_tree_block(struct btrfs_root *root,
  24. u64 blocknr);
  25. int write_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
  26. struct buffer_head *buf);
  27. int dirty_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
  28. struct buffer_head *buf);
  29. int clean_tree_block(struct btrfs_trans_handle *trans,
  30. struct btrfs_root *root, struct buffer_head *buf);
  31. int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
  32. struct btrfs_root *root);
  33. struct btrfs_root *open_ctree(struct super_block *sb);
  34. int close_ctree(struct btrfs_root *root);
  35. void btrfs_block_release(struct btrfs_root *root, struct buffer_head *buf);
  36. int write_ctree_super(struct btrfs_trans_handle *trans,
  37. struct btrfs_root *root);
  38. struct buffer_head *btrfs_find_tree_block(struct btrfs_root *root, u64 blocknr);
  39. int btrfs_csum_data(struct btrfs_root * root, char *data, size_t len,
  40. char *result);
  41. struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
  42. struct btrfs_key *location);
  43. u64 bh_blocknr(struct buffer_head *bh);
  44. int btrfs_insert_dev_radix(struct btrfs_root *root,
  45. struct block_device *bdev,
  46. u64 device_id,
  47. u64 block_start,
  48. u64 num_blocks);
  49. int btrfs_map_bh_to_logical(struct btrfs_root *root, struct buffer_head *bh,
  50. u64 logical);
  51. int btrfs_releasepage(struct page *page, gfp_t flags);
  52. void btrfs_btree_balance_dirty(struct btrfs_root *root);
  53. #endif