transaction.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef __TRANSACTION__
  2. #define __TRANSACTION__
  3. #include "btrfs_inode.h"
  4. struct btrfs_transaction {
  5. u64 transid;
  6. unsigned long num_writers;
  7. int in_commit;
  8. int use_count;
  9. int commit_done;
  10. struct list_head list;
  11. struct radix_tree_root dirty_pages;
  12. unsigned long start_time;
  13. wait_queue_head_t writer_wait;
  14. wait_queue_head_t commit_wait;
  15. };
  16. struct btrfs_trans_handle {
  17. u64 transid;
  18. unsigned long blocks_reserved;
  19. unsigned long blocks_used;
  20. struct btrfs_transaction *transaction;
  21. struct btrfs_block_group_cache *block_group;
  22. };
  23. static inline void btrfs_set_trans_block_group(struct btrfs_trans_handle *trans,
  24. struct inode *inode)
  25. {
  26. trans->block_group = BTRFS_I(inode)->block_group;
  27. }
  28. static inline void btrfs_update_inode_block_group(struct
  29. btrfs_trans_handle *trans,
  30. struct inode *inode)
  31. {
  32. BTRFS_I(inode)->block_group = trans->block_group;
  33. }
  34. int btrfs_end_transaction(struct btrfs_trans_handle *trans,
  35. struct btrfs_root *root);
  36. struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
  37. int num_blocks);
  38. int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
  39. struct btrfs_root *root);
  40. int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans,
  41. struct btrfs_root *root);
  42. void btrfs_transaction_cleaner(struct work_struct *work);
  43. void btrfs_transaction_flush_work(struct btrfs_root *root);
  44. void btrfs_transaction_queue_work(struct btrfs_root *root, int delay);
  45. void btrfs_init_transaction_sys(void);
  46. void btrfs_exit_transaction_sys(void);
  47. #endif