Lines Matching refs:transaction

18 #include "transaction.h"
43 * No running transaction (fs tree blocks are not modified)
50 * | New trans handles can be attached to transaction N by calling all
55 * | transaction N
60 * | the race and the rest will wait for the winner to commit the transaction.
62 * | The winner will wait for previous running transaction to completely finish
70 * | - Wait for current transaction to be committed by others.
74 * | to this running transaction.
76 * | transaction N+1.
79 * | Caller is chosen to commit transaction N, and all other trans handle
84 * | The heavy lifting transaction work is started.
91 * | transaction to finish and attach to transaction N+1.
102 * | At this stage, new transaction is allowed to |
113 * This transaction is finished and all its [[TRANS_STATE_COMMIT_START]]
141 void btrfs_put_transaction(struct btrfs_transaction *transaction)
143 WARN_ON(refcount_read(&transaction->use_count) == 0);
144 if (refcount_dec_and_test(&transaction->use_count)) {
145 BUG_ON(!list_empty(&transaction->list));
147 &transaction->delayed_refs.href_root.rb_root));
149 &transaction->delayed_refs.dirty_extent_root));
150 if (transaction->delayed_refs.pending_csums)
151 btrfs_err(transaction->fs_info,
153 transaction->delayed_refs.pending_csums);
156 * because the transaction was aborted and a commit did not
161 while (!list_empty(&transaction->deleted_bgs)) {
164 cache = list_first_entry(&transaction->deleted_bgs,
171 WARN_ON(!list_empty(&transaction->dev_update_list));
172 kfree(transaction);
178 struct btrfs_transaction *cur_trans = trans->transaction;
183 * At this point no one can be using this transaction to modify any tree
184 * and no one can start another transaction to modify any tree either.
263 * either allocate a new transaction or hop into the existing one
300 * current transaction, and commit it. If there is no transaction, just
307 * JOIN_NOLOCK only happens during the transaction commit, so
322 * someone started a transaction after we unlocked. Make sure
347 * commit the transaction.
360 * although the tree mod log is per file system and not per transaction,
361 * the log must never go across transaction boundaries.
365 WARN(1, KERN_ERR "BTRFS: tree_mod_seq_list not empty when creating a fresh transaction\n");
367 WARN(1, KERN_ERR "BTRFS: tree_mod_log rb tree not empty when creating a fresh transaction\n");
398 * is properly recorded in a given transaction. This is required to make sure
399 * the old root from before we joined the transaction is deleted when the
400 * transaction commits.
439 * this transaction.
467 struct btrfs_transaction *cur_trans = trans->transaction;
469 /* Add ourselves to the transaction dropped list */
514 /* wait for commit against the current transaction to become unblocked
515 * when this is done, it is safe to start a new transaction, but the current
516 * transaction might not be fully on disk.
591 * Do the reservation before we join the transaction so we can do all
601 * transaction that could free this reserved space prematurely
611 * we only do 1 enospc flushing cycle per transaction start. We
664 * If we are JOIN_NOLOCK we're already committing a transaction and
671 * transaction and commit it, so we needn't do sb_start_intwrite().
695 h->transaction = cur_trans;
711 trace_btrfs_space_reservation(fs_info, "transaction",
719 * Now that we have found a transaction to be a part of, convert the
720 * qgroup reservation from prealloc to pertrans. A different transaction
746 * transaction.
754 * The transaction handle is fully initialized and linked with
805 * Similar to regular join but it never starts a transaction when none is
808 * happen if the transaction commit already started but it's not yet in the
818 * btrfs_attach_transaction() - catch the running transaction
820 * It is used when we want to commit the current the transaction, but
824 * running transaction. But it is possible that the inactive transaction
826 * inactive transaction in the fs when -ENOENT is returned, you should
837 * btrfs_attach_transaction_barrier() - catch the running transaction
861 /* Wait for a transaction commit to reach at least the given state. */
887 * A transaction isn't really completed until all of the
890 * transaction. Wait for those.
916 /* find specified transaction */
933 * The specified transaction doesn't exist, or we
942 /* find newest transaction that is committing | committed */
973 struct btrfs_transaction *cur_trans = trans->transaction;
999 trace_btrfs_space_reservation(fs_info, "transaction",
1010 struct btrfs_transaction *cur_trans = trans->transaction;
1102 * the transaction (through extent_io_tree_release()).
1125 * those extents are on disk for transaction or log commit. We wait
1142 * When committing the transaction, we'll remove any entries
1145 * concurrently - we do it only at transaction commit time when
1206 * This function ensures such extents are persisted on disk for transaction or
1209 * @trans: transaction whose dirty pages we'd like to write
1215 struct extent_io_tree *dirty_pages = &trans->transaction->dirty_pages;
1224 extent_io_tree_release(&trans->transaction->dirty_pages);
1284 struct list_head *dirty_bgs = &trans->transaction->dirty_bgs;
1285 struct list_head *io_bgs = &trans->transaction->io_bgs;
1291 * At this point no one can be using this transaction to modify any tree
1292 * and no one can start another transaction to modify any tree either.
1294 ASSERT(trans->transaction->state == TRANS_STATE_COMMIT_DOING);
1328 &trans->transaction->switch_commits);
1425 * At this point no one can be using this transaction to modify any tree
1426 * and no one can start another transaction to modify any tree either.
1428 ASSERT(trans->transaction->state == TRANS_STATE_COMMIT_DOING);
1466 &trans->transaction->switch_commits);
1527 * roots inside one transaction and write all btree into disk, to make
1588 * Now we do a simplified commit transaction, which will:
1606 "Error while writing out transaction for qgroup");
1622 * transaction commit. This does the actual creation.
1625 * If the error which may affect the commitment of the current transaction
1661 * We're inside a transaction and must make sure that any potential
1701 trace_btrfs_space_reservation(fs_info, "transaction",
1908 struct list_head *head = &trans->transaction->pending_snapshots;
1975 /* Kick the transaction kthread. */
1979 /* take transaction reference */
1980 cur_trans = trans->transaction;
1986 * Wait for the current transaction commit to start and block
1987 * subsequent transaction joins
1999 struct btrfs_transaction *cur_trans = trans->transaction;
2008 * If the transaction is removed from the list, it means this
2009 * transaction has been committed successfully, so it is impossible
2030 * Now that we know no one else is still using the transaction we can
2031 * remove the transaction from the list of transactions. This avoids
2032 * the transaction kthread from cleaning up the transaction while some
2034 * on things like log trees, as it forces the transaction kthread to
2035 * wait for this transaction to be cleaned up by us.
2041 btrfs_cleanup_one_transaction(trans->transaction, fs_info);
2061 * pauses scrub, then starts and commits a transaction before unpausing
2062 * scrub. If the transaction commit is being done by the relocation
2077 * transaction and remove them from the list
2098 * from already being in a transaction and our join_transaction doesn't
2121 * Add a pending snapshot associated with the given transaction handle to the
2122 * respective handle. This must be called after the transaction commit started
2130 struct btrfs_transaction *cur_trans = trans->transaction;
2153 struct btrfs_transaction *cur_trans = trans->transaction;
2174 * We only want one transaction commit doing the flushing so we do not
2198 * will wait for the transaction to commit if it
2271 * The previous transaction was aborted and was already removed
2304 * The thread has started/joined the transaction thus it holds the
2324 * transaction. Otherwise if this transaction commits before the ordered
2334 * commit the transaction. We could have started a join before setting
2343 * The thread has started/joined the transaction thus it holds the
2364 * do an async commit but somebody else started before the transaction
2414 WARN_ON(cur_trans != trans->transaction);
2484 * Before changing the transaction state to TRANS_STATE_UNBLOCKED and
2487 * start a new transaction and commit a log tree before we commit our
2510 "Error while writing out transaction");
2583 btrfs_warn(fs_info, "Skipping commit of aborted transaction.");
2641 * We only mark the transaction aborted and then set the file system read-only.
2647 * further cleanup. The transaction should complete as it normally would
2660 WRITE_ONCE(trans->transaction->aborted, errno);
2663 /* Wake up anybody who may be waiting on this transaction */