^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2007 Oracle. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef BTRFS_TRANSACTION_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define BTRFS_TRANSACTION_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/refcount.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "btrfs_inode.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "delayed-ref.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "ctree.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) enum btrfs_trans_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) TRANS_STATE_RUNNING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) TRANS_STATE_COMMIT_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) TRANS_STATE_COMMIT_DOING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) TRANS_STATE_UNBLOCKED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) TRANS_STATE_COMPLETED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) TRANS_STATE_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define BTRFS_TRANS_HAVE_FREE_BGS 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define BTRFS_TRANS_DIRTY_BG_RUN 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define BTRFS_TRANS_CACHE_ENOSPC 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct btrfs_transaction {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) u64 transid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * total external writers(USERSPACE/START/ATTACH) in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * transaction, it must be zero before the transaction is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * being committed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) atomic_t num_extwriters;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * total writers in this transaction, it must be zero before the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * transaction can end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) atomic_t num_writers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) refcount_t use_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /* Be protected by fs_info->trans_lock when we want to change it. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) enum btrfs_trans_state state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) int aborted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct extent_io_tree dirty_pages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) time64_t start_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) wait_queue_head_t writer_wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) wait_queue_head_t commit_wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct list_head pending_snapshots;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct list_head dev_update_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct list_head switch_commits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct list_head dirty_bgs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * There is no explicit lock which protects io_bgs, rather its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * consistency is implied by the fact that all the sites which modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * it do so under some form of transaction critical section, namely:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * - btrfs_start_dirty_block_groups - This function can only ever be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * run by one of the transaction committers. Refer to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * BTRFS_TRANS_DIRTY_BG_RUN usage in btrfs_commit_transaction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * - btrfs_write_dirty_blockgroups - this is called by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * commit_cowonly_roots from transaction critical section
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * (TRANS_STATE_COMMIT_DOING)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * - btrfs_cleanup_dirty_bgs - called on transaction abort
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) struct list_head io_bgs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct list_head dropped_roots;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct extent_io_tree pinned_extents;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * we need to make sure block group deletion doesn't race with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * free space cache writeout. This mutex keeps them from stomping
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * on each other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) struct mutex cache_write_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) spinlock_t dirty_bgs_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* Protected by spin lock fs_info->unused_bgs_lock. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) struct list_head deleted_bgs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) spinlock_t dropped_roots_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct btrfs_delayed_ref_root delayed_refs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct btrfs_fs_info *fs_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * Number of ordered extents the transaction must wait for before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * committing. These are ordered extents started by a fast fsync.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) atomic_t pending_ordered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) wait_queue_head_t pending_wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #define __TRANS_FREEZABLE (1U << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define __TRANS_START (1U << 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define __TRANS_ATTACH (1U << 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define __TRANS_JOIN (1U << 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define __TRANS_JOIN_NOLOCK (1U << 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define __TRANS_DUMMY (1U << 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #define __TRANS_JOIN_NOSTART (1U << 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #define TRANS_START (__TRANS_START | __TRANS_FREEZABLE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #define TRANS_ATTACH (__TRANS_ATTACH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #define TRANS_JOIN (__TRANS_JOIN | __TRANS_FREEZABLE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #define TRANS_JOIN_NOLOCK (__TRANS_JOIN_NOLOCK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #define TRANS_JOIN_NOSTART (__TRANS_JOIN_NOSTART)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define TRANS_EXTWRITERS (__TRANS_START | __TRANS_ATTACH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #define BTRFS_SEND_TRANS_STUB ((void *)1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define BTRFS_DIO_SYNC_STUB ((void *)2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) struct btrfs_trans_handle {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) u64 transid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) u64 bytes_reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) u64 chunk_bytes_reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) unsigned long delayed_ref_updates;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct btrfs_transaction *transaction;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct btrfs_block_rsv *block_rsv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) struct btrfs_block_rsv *orig_rsv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) refcount_t use_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) unsigned int type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * Error code of transaction abort, set outside of locks and must use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * the READ_ONCE/WRITE_ONCE access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) short aborted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) bool adding_csums;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) bool allocating_chunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) bool can_flush_pending_bgs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) bool reloc_reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) bool dirty;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct btrfs_root *root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) struct btrfs_fs_info *fs_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) struct list_head new_bgs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * The abort status can be changed between calls and is not protected by locks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * This accepts btrfs_transaction and btrfs_trans_handle as types. Once it's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * set to a non-zero value it does not change, so the macro should be in checks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * but is not necessary for further reads of the value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #define TRANS_ABORTED(trans) (unlikely(READ_ONCE((trans)->aborted)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) struct btrfs_pending_snapshot {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) struct dentry *dentry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct inode *dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct btrfs_root *root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) struct btrfs_root_item *root_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) struct btrfs_root *snap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) struct btrfs_qgroup_inherit *inherit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct btrfs_path *path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /* block reservation for the operation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) struct btrfs_block_rsv block_rsv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) /* extra metadata reservation for relocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) /* Preallocated anonymous block device number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) dev_t anon_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) bool readonly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) struct btrfs_inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) spin_lock(&inode->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) inode->last_trans = trans->transaction->transid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) inode->last_sub_trans = inode->root->log_transid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) inode->last_log_commit = inode->last_sub_trans - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) spin_unlock(&inode->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * Make qgroup codes to skip given qgroupid, means the old/new_roots for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * qgroup won't contain the qgroupid in it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) static inline void btrfs_set_skip_qgroup(struct btrfs_trans_handle *trans,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) u64 qgroupid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) struct btrfs_delayed_ref_root *delayed_refs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) delayed_refs = &trans->transaction->delayed_refs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) WARN_ON(delayed_refs->qgroup_to_skip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) delayed_refs->qgroup_to_skip = qgroupid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) static inline void btrfs_clear_skip_qgroup(struct btrfs_trans_handle *trans)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) struct btrfs_delayed_ref_root *delayed_refs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) delayed_refs = &trans->transaction->delayed_refs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) WARN_ON(!delayed_refs->qgroup_to_skip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) delayed_refs->qgroup_to_skip = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) int btrfs_end_transaction(struct btrfs_trans_handle *trans);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) unsigned int num_items);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) struct btrfs_trans_handle *btrfs_start_transaction_fallback_global_rsv(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) struct btrfs_root *root,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) unsigned int num_items);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) struct btrfs_trans_handle *btrfs_join_transaction_spacecache(struct btrfs_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) struct btrfs_trans_handle *btrfs_join_transaction_nostart(struct btrfs_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) struct btrfs_trans_handle *btrfs_attach_transaction(struct btrfs_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) struct btrfs_trans_handle *btrfs_attach_transaction_barrier(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) struct btrfs_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) int btrfs_wait_for_commit(struct btrfs_fs_info *fs_info, u64 transid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) void btrfs_add_dead_root(struct btrfs_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) int btrfs_defrag_root(struct btrfs_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) int btrfs_commit_transaction(struct btrfs_trans_handle *trans);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) int wait_for_unblock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) int btrfs_should_end_transaction(struct btrfs_trans_handle *trans);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) void btrfs_throttle(struct btrfs_fs_info *fs_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) struct btrfs_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) int btrfs_write_marked_extents(struct btrfs_fs_info *fs_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) struct extent_io_tree *dirty_pages, int mark);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) int btrfs_wait_tree_log_extents(struct btrfs_root *root, int mark);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) int btrfs_transaction_blocked(struct btrfs_fs_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) int btrfs_transaction_in_commit(struct btrfs_fs_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) void btrfs_put_transaction(struct btrfs_transaction *transaction);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) void btrfs_add_dropped_root(struct btrfs_trans_handle *trans,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) struct btrfs_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) #endif