• Home
  • Raw
  • Download

Lines Matching full:transaction

16 #include "transaction.h"
29 * Transaction states and transitions
31 * No running transaction (fs tree blocks are not modified)
36 * Transaction N [[TRANS_STATE_RUNNING]]
38 * | New trans handles can be attached to transaction N by calling all
43 * | transaction N
45 * Transaction N [[TRANS_STATE_COMMIT_START]]
47 * | Will wait for previous running transaction to completely finish if there
53 * | - Wait for current transaction to be committed by others.
57 * | to this running transaction.
59 * | transaction N+1.
62 * | Caller is chosen to commit transaction N, and all other trans handle
65 * Transaction N [[TRANS_STATE_COMMIT_DOING]]
67 * | The heavy lifting transaction work is started.
74 * | transaction to finish and attach to transaction N+1.
79 * Transaction N [[TRANS_STATE_UNBLOCKED]]
80 * | Transaction N+1
85 * | At this stage, new transaction is allowed to |
94 * Transaction N [[TRANS_STATE_COMPLETED]] V
95 * All tree blocks and super blocks are written. Transaction N+1
96 * This transaction is finished and all its [[TRANS_STATE_COMMIT_START]]
118 void btrfs_put_transaction(struct btrfs_transaction *transaction) in btrfs_put_transaction() argument
120 WARN_ON(refcount_read(&transaction->use_count) == 0); in btrfs_put_transaction()
121 if (refcount_dec_and_test(&transaction->use_count)) { in btrfs_put_transaction()
122 BUG_ON(!list_empty(&transaction->list)); in btrfs_put_transaction()
124 &transaction->delayed_refs.href_root.rb_root)); in btrfs_put_transaction()
126 &transaction->delayed_refs.dirty_extent_root)); in btrfs_put_transaction()
127 if (transaction->delayed_refs.pending_csums) in btrfs_put_transaction()
128 btrfs_err(transaction->fs_info, in btrfs_put_transaction()
130 transaction->delayed_refs.pending_csums); in btrfs_put_transaction()
133 * because the transaction was aborted and a commit did not in btrfs_put_transaction()
138 while (!list_empty(&transaction->deleted_bgs)) { in btrfs_put_transaction()
141 cache = list_first_entry(&transaction->deleted_bgs, in btrfs_put_transaction()
148 WARN_ON(!list_empty(&transaction->dev_update_list)); in btrfs_put_transaction()
149 kfree(transaction); in btrfs_put_transaction()
155 struct btrfs_transaction *cur_trans = trans->transaction; in switch_commit_roots()
252 * To be called after all the new block groups attached to the transaction
270 * either allocate a new transaction or hop into the existing one
304 * If we are ATTACH, we just want to catch the current transaction, in join_transaction()
305 * and commit it. If there is no transaction, just return ENOENT. in join_transaction()
311 * JOIN_NOLOCK only happens during the transaction commit, so in join_transaction()
323 * someone started a transaction after we unlocked. Make sure in join_transaction()
344 * commit the transaction. in join_transaction()
357 * although the tree mod log is per file system and not per transaction, in join_transaction()
358 * the log must never go across transaction boundaries. in join_transaction()
362 WARN(1, KERN_ERR "BTRFS: tree_mod_seq_list not empty when creating a fresh transaction\n"); in join_transaction()
364 WARN(1, KERN_ERR "BTRFS: tree_mod_log rb tree not empty when creating a fresh transaction\n"); in join_transaction()
395 * is properly recorded in a given transaction. This is required to make sure
396 * the old root from before we joined the transaction is deleted when the
397 * transaction commits.
436 * this transaction. in record_root_in_trans()
464 struct btrfs_transaction *cur_trans = trans->transaction; in btrfs_add_dropped_root()
466 /* Add ourselves to the transaction dropped list */ in btrfs_add_dropped_root()
510 /* wait for commit against the current transaction to become unblocked
511 * when this is done, it is safe to start a new transaction, but the current
512 * transaction might not be fully on disk.
589 * Do the reservation before we join the transaction so we can do all in start_transaction()
604 * we only do 1 enospc flushing cycle per transaction start. We in start_transaction()
656 * If we are JOIN_NOLOCK we're already committing a transaction and in start_transaction()
663 * transaction and commit it, so we needn't do sb_start_intwrite(). in start_transaction()
687 h->transaction = cur_trans; in start_transaction()
705 trace_btrfs_space_reservation(fs_info, "transaction", in start_transaction()
732 * transaction. in start_transaction()
782 * Similar to regular join but it never starts a transaction when none is
792 * btrfs_attach_transaction() - catch the running transaction
794 * It is used when we want to commit the current the transaction, but
798 * running transaction. But it is possible that the inactive transaction
800 * inactive transaction in the fs when -ENOENT is returned, you should
811 * btrfs_attach_transaction_barrier() - catch the running transaction
830 /* wait for a transaction commit to be fully complete */
845 /* find specified transaction */ in btrfs_wait_for_commit()
862 * The specified transaction doesn't exist, or we in btrfs_wait_for_commit()
871 /* find newest transaction that is committing | committed */ in btrfs_wait_for_commit()
911 struct btrfs_transaction *cur_trans = trans->transaction; in btrfs_should_end_transaction()
935 trace_btrfs_space_reservation(fs_info, "transaction", in btrfs_trans_release_metadata()
946 struct btrfs_transaction *cur_trans = trans->transaction; in __btrfs_end_transaction()
1036 * the transaction (through extent_io_tree_release()). in btrfs_write_marked_extents()
1060 * those extents are on disk for transaction or log commit. We wait
1077 * When committing the transaction, we'll remove any entries in __btrfs_wait_marked_extents()
1080 * concurrently - we do it only at transaction commit time when in __btrfs_wait_marked_extents()
1141 * This function ensures such extents are persisted on disk for transaction or
1144 * @trans: transaction whose dirty pages we'd like to write
1150 struct extent_io_tree *dirty_pages = &trans->transaction->dirty_pages; in btrfs_write_and_wait_transaction()
1159 extent_io_tree_release(&trans->transaction->dirty_pages); in btrfs_write_and_wait_transaction()
1219 struct list_head *dirty_bgs = &trans->transaction->dirty_bgs; in commit_cowonly_roots()
1220 struct list_head *io_bgs = &trans->transaction->io_bgs; in commit_cowonly_roots()
1266 &trans->transaction->switch_commits); in commit_cowonly_roots()
1288 &trans->transaction->switch_commits); in commit_cowonly_roots()
1352 &trans->transaction->switch_commits); in commit_fs_roots()
1413 * roots inside one transaction and write all btree into disk, to make
1442 * We are going to commit transaction, see btrfs_commit_transaction() in qgroup_account_snapshot()
1461 * Now we do a simplified commit transaction, which will: in qgroup_account_snapshot()
1479 "Error while writing out transaction for qgroup"); in qgroup_account_snapshot()
1497 * transaction commit. This does the actual creation.
1500 * If the error which may affect the commitment of the current transaction
1562 trace_btrfs_space_reservation(fs_info, "transaction", in create_pending_snapshot()
1600 if (ret) { /* Transaction aborted */ in create_pending_snapshot()
1777 struct list_head *head = &trans->transaction->pending_snapshots; in create_pending_snapshots()
1838 * wait for the current transaction commit to start and block subsequent
1839 * transaction joins
1850 * wait for the current transaction to start and then become unblocked.
1864 * returns, any subsequent transaction will not be allowed to join.
1877 * We've got freeze protection passed with the transaction. in do_async_commit()
1908 /* take transaction reference */ in btrfs_commit_transaction_async()
1909 cur_trans = trans->transaction; in btrfs_commit_transaction_async()
1923 /* wait for transaction to start and unblock */ in btrfs_commit_transaction_async()
1940 struct btrfs_transaction *cur_trans = trans->transaction; in cleanup_transaction()
1949 * If the transaction is removed from the list, it means this in cleanup_transaction()
1950 * transaction has been committed successfully, so it is impossible in cleanup_transaction()
1965 * Now that we know no one else is still using the transaction we can in cleanup_transaction()
1966 * remove the transaction from the list of transactions. This avoids in cleanup_transaction()
1967 * the transaction kthread from cleaning up the transaction while some in cleanup_transaction()
1969 * on things like log trees, as it forces the transaction kthread to in cleanup_transaction()
1970 * wait for this transaction to be cleaned up by us. in cleanup_transaction()
1976 btrfs_cleanup_one_transaction(trans->transaction, fs_info); in cleanup_transaction()
1999 * transaction and remove them from the list
2022 * from already being in a transaction and our join_transaction doesn't in btrfs_start_delalloc_flush()
2029 struct list_head *head = &trans->transaction->pending_snapshots; in btrfs_start_delalloc_flush()
2057 struct list_head *head = &trans->transaction->pending_snapshots; in btrfs_wait_delalloc_flush()
2074 struct btrfs_transaction *cur_trans = trans->transaction; in btrfs_commit_transaction()
2081 * Some places just start a transaction to commit it. We need to make in btrfs_commit_transaction()
2083 * transaction as failed, so set trans->dirty to make the abort code do in btrfs_commit_transaction()
2107 cur_trans = trans->transaction; in btrfs_commit_transaction()
2110 * set the flushing flag so procs in this transaction have to in btrfs_commit_transaction()
2132 * will wait for the transaction to commit if it in btrfs_commit_transaction()
2193 * The previous transaction was aborted and was already removed in btrfs_commit_transaction()
2226 * transaction. Otherwise if this transaction commits before the ordered in btrfs_commit_transaction()
2235 * commit the transaction. We could have started a join before setting in btrfs_commit_transaction()
2288 WARN_ON(cur_trans != trans->transaction); in btrfs_commit_transaction()
2310 * Since the transaction is done, we can apply the pending changes in btrfs_commit_transaction()
2311 * before the next transaction. in btrfs_commit_transaction()
2390 "Error while writing out transaction"); in btrfs_commit_transaction()
2453 btrfs_warn(fs_info, "Skipping commit of aborted transaction."); in btrfs_commit_transaction()