btrfs: extent-tree: Make btrfs_inode_rsv_refill function static
[sfrench/cifs-2.6.git] / fs / btrfs / extent-tree.c
index 2f4328511ac84e11b8148952b09b25f3b4bb4e9d..696275b7b66a073f27d33bb773f60a093c3df1ef 100644 (file)
@@ -2894,7 +2894,7 @@ int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans,
        struct btrfs_block_rsv *global_rsv;
        u64 num_heads = trans->transaction->delayed_refs.num_heads_ready;
        u64 csum_bytes = trans->transaction->delayed_refs.pending_csums;
-       u64 num_dirty_bgs = trans->transaction->num_dirty_bgs;
+       unsigned int num_dirty_bgs = trans->transaction->num_dirty_bgs;
        u64 num_bytes, num_dirty_bgs_bytes;
        int ret = 0;
 
@@ -4945,12 +4945,12 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info,
                bytes = 0;
        else
                bytes -= delayed_rsv->size;
+       spin_unlock(&delayed_rsv->lock);
+
        if (percpu_counter_compare(&space_info->total_bytes_pinned,
                                   bytes) < 0) {
-               spin_unlock(&delayed_rsv->lock);
                return -ENOSPC;
        }
-       spin_unlock(&delayed_rsv->lock);
 
 commit:
        trans = btrfs_join_transaction(fs_info->extent_root);
@@ -5738,8 +5738,8 @@ int btrfs_block_rsv_refill(struct btrfs_root *root,
  * or return if we already have enough space.  This will also handle the resreve
  * tracepoint for the reserved amount.
  */
-int btrfs_inode_rsv_refill(struct btrfs_inode *inode,
-                          enum btrfs_reserve_flush_enum flush)
+static int btrfs_inode_rsv_refill(struct btrfs_inode *inode,
+                                 enum btrfs_reserve_flush_enum flush)
 {
        struct btrfs_root *root = inode->root;
        struct btrfs_block_rsv *block_rsv = &inode->block_rsv;