Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth...
[firefly-linux-kernel-4.4.55.git] / fs / btrfs / transaction.h
index 0fc45e2a5139add26c2c2a2d170b54ff781275c4..005b0375d18cfc6131a4480a9e67e0cbe44ed46a 100644 (file)
 #include "delayed-ref.h"
 #include "ctree.h"
 
+enum btrfs_trans_state {
+       TRANS_STATE_RUNNING             = 0,
+       TRANS_STATE_BLOCKED             = 1,
+       TRANS_STATE_COMMIT_START        = 2,
+       TRANS_STATE_COMMIT_DOING        = 3,
+       TRANS_STATE_UNBLOCKED           = 4,
+       TRANS_STATE_COMPLETED           = 5,
+       TRANS_STATE_MAX                 = 6,
+};
+
 struct btrfs_transaction {
        u64 transid;
        /*
@@ -37,10 +47,8 @@ struct btrfs_transaction {
        atomic_t num_writers;
        atomic_t use_count;
 
-       spinlock_t commit_lock;
-       int in_commit;
-       int commit_done;
-       int blocked;
+       /* Be protected by fs_info->trans_lock when we want to change it. */
+       enum btrfs_trans_state state;
        struct list_head list;
        struct extent_io_tree dirty_pages;
        unsigned long start_time;
@@ -48,6 +56,7 @@ struct btrfs_transaction {
        wait_queue_head_t commit_wait;
        struct list_head pending_snapshots;
        struct list_head ordered_operations;
+       struct list_head pending_chunks;
        struct btrfs_delayed_ref_root delayed_refs;
        int aborted;
 };