@@ -570,6 +570,14 @@ struct btrfs_trans_handle *btrfs_start_transaction_lflush(
BTRFS_RESERVE_FLUSH_LIMIT);
}
+/* Only used in btrfs_freeze() */
+struct btrfs_trans_handle *btrfs_start_transaction_freeze(
+ struct btrfs_root *root, int num_items)
+{
+ return start_transaction(root, num_items, __TRANS_START,
+ BTRFS_RESERVE_FLUSH_ALL);
+}
+
struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root)
{
return start_transaction(root, 0, TRANS_JOIN, 0);
@@ -140,6 +140,8 @@ struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
int num_items);
struct btrfs_trans_handle *btrfs_start_transaction_lflush(
struct btrfs_root *root, int num_items);
+struct btrfs_trans_handle *btrfs_start_transaction_freeze(
+ struct btrfs_root *root, int num_items);
struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root);
struct btrfs_trans_handle *btrfs_join_transaction_nolock(struct btrfs_root *root);
struct btrfs_trans_handle *btrfs_attach_transaction(struct btrfs_root *root);
Add btrfs_start_transaction_freeze() function. This is needed for btrfs_freeze() to handle the pending changes. If there is no running transaction when btrfs_freeze() is called, btrfs_freeze() needs to start a transaction to handle the pending changes, and it can't initial a sb_start_intwrite() call. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> --- fs/btrfs/transaction.c | 8 ++++++++ fs/btrfs/transaction.h | 2 ++ 2 files changed, 10 insertions(+)