btrfs: migrate btrfs_trans_release_chunk_metadata
authorJosef Bacik <josef@toxicpanda.com>
Wed, 19 Jun 2019 19:11:59 +0000 (15:11 -0400)
committerDavid Sterba <dsterba@suse.com>
Thu, 4 Jul 2019 15:26:17 +0000 (17:26 +0200)
Move this into transaction.c with the rest of the transaction related
code.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/transaction.c
fs/btrfs/transaction.h

index 45d6fc7ed21f19dea29793097fdb93525ca5b06c..56e6746010fc6daeeb4f38312cc05d7425cd9247 100644 (file)
@@ -2768,7 +2768,6 @@ void btrfs_delalloc_release_space(struct inode *inode,
                                  u64 start, u64 len, bool qgroup_free);
 void btrfs_free_reserved_data_space_noquota(struct inode *inode, u64 start,
                                            u64 len);
-void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans);
 int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
                                     struct btrfs_block_rsv *rsv,
                                     int nitems, bool use_global_rsv);
index 413a8090467340086edb311dc07cb357ea420889..1987daf8e439c00d4795e5bd141c655a6ded5549 100644 (file)
@@ -4339,24 +4339,6 @@ static void btrfs_inode_rsv_release(struct btrfs_inode *inode, bool qgroup_free)
                                                   qgroup_to_release);
 }
 
-/*
- * To be called after all the new block groups attached to the transaction
- * handle have been created (btrfs_create_pending_block_groups()).
- */
-void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans)
-{
-       struct btrfs_fs_info *fs_info = trans->fs_info;
-
-       if (!trans->chunk_bytes_reserved)
-               return;
-
-       WARN_ON_ONCE(!list_empty(&trans->new_bgs));
-
-       btrfs_block_rsv_release(fs_info, &fs_info->chunk_block_rsv,
-                               trans->chunk_bytes_reserved);
-       trans->chunk_bytes_reserved = 0;
-}
-
 /*
  * btrfs_subvolume_reserve_metadata() - reserve space for subvolume operation
  * root: the root of the parent directory
index 3f6811cdf803bb0896af7d6dcda81b3ecc17dd90..3b8ae1a8f02df77769542a3c0a0782f452c8c791 100644 (file)
@@ -128,6 +128,24 @@ static inline int extwriter_counter_read(struct btrfs_transaction *trans)
        return atomic_read(&trans->num_extwriters);
 }
 
+/*
+ * To be called after all the new block groups attached to the transaction
+ * handle have been created (btrfs_create_pending_block_groups()).
+ */
+void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans)
+{
+       struct btrfs_fs_info *fs_info = trans->fs_info;
+
+       if (!trans->chunk_bytes_reserved)
+               return;
+
+       WARN_ON_ONCE(!list_empty(&trans->new_bgs));
+
+       btrfs_block_rsv_release(fs_info, &fs_info->chunk_block_rsv,
+                               trans->chunk_bytes_reserved);
+       trans->chunk_bytes_reserved = 0;
+}
+
 /*
  * either allocate a new transaction or hop into the existing one
  */
index 78c446c222b7d5556a98bbdad928a9d60775a5b6..527ea94b57d91a6c289cb4b4b67f6a07ecb85934 100644 (file)
@@ -224,5 +224,6 @@ void btrfs_put_transaction(struct btrfs_transaction *transaction);
 void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info);
 void btrfs_add_dropped_root(struct btrfs_trans_handle *trans,
                            struct btrfs_root *root);
+void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans);
 
 #endif