linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 08/11] btrfs: export block_rsv_use_bytes
Date: Tue, 18 Jun 2019 16:09:23 -0400	[thread overview]
Message-ID: <20190618200926.3352-9-josef@toxicpanda.com> (raw)
In-Reply-To: <20190618200926.3352-1-josef@toxicpanda.com>

We are going to need this to move the metadata reservation stuff to
space_info.c.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/ctree.h       |  2 ++
 fs/btrfs/extent-tree.c | 14 ++++++--------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index cceb1b5fab33..2aeb323cc86e 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2828,6 +2828,8 @@ int btrfs_block_rsv_refill(struct btrfs_root *root,
 int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv,
 			    struct btrfs_block_rsv *dst_rsv, u64 num_bytes,
 			    bool update_size);
+int btrfs_block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv,
+			      u64 num_bytes);
 int btrfs_cond_migrate_bytes(struct btrfs_fs_info *fs_info,
 			     struct btrfs_block_rsv *dest, u64 num_bytes,
 			     int min_factor);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 86f5b26c0bf1..d21ee7af1e3e 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -53,8 +53,6 @@ static int find_next_key(struct btrfs_path *path, int level,
 static void dump_space_info(struct btrfs_fs_info *fs_info,
 			    struct btrfs_space_info *info, u64 bytes,
 			    int dump_block_groups);
-static int block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv,
-			       u64 num_bytes);
 
 static noinline int
 block_group_cache_done(struct btrfs_block_group_cache *cache)
@@ -5033,7 +5031,7 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
 	if (ret == -ENOSPC &&
 	    unlikely(root->orphan_cleanup_state == ORPHAN_CLEANUP_STARTED)) {
 		if (block_rsv != global_rsv &&
-		    !block_rsv_use_bytes(global_rsv, orig_bytes))
+		    !btrfs_block_rsv_use_bytes(global_rsv, orig_bytes))
 			ret = 0;
 	}
 	if (ret == -ENOSPC) {
@@ -5069,8 +5067,8 @@ static struct btrfs_block_rsv *get_block_rsv(
 	return block_rsv;
 }
 
-static int block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv,
-			       u64 num_bytes)
+int btrfs_block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv,
+			      u64 num_bytes)
 {
 	int ret = -ENOSPC;
 	spin_lock(&block_rsv->lock);
@@ -5268,7 +5266,7 @@ int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src,
 {
 	int ret;
 
-	ret = block_rsv_use_bytes(src, num_bytes);
+	ret = btrfs_block_rsv_use_bytes(src, num_bytes);
 	if (ret)
 		return ret;
 
@@ -8142,7 +8140,7 @@ use_block_rsv(struct btrfs_trans_handle *trans,
 	if (unlikely(block_rsv->size == 0))
 		goto try_reserve;
 again:
-	ret = block_rsv_use_bytes(block_rsv, blocksize);
+	ret = btrfs_block_rsv_use_bytes(block_rsv, blocksize);
 	if (!ret)
 		return block_rsv;
 
@@ -8180,7 +8178,7 @@ use_block_rsv(struct btrfs_trans_handle *trans,
 	 */
 	if (block_rsv->type != BTRFS_BLOCK_RSV_GLOBAL &&
 	    block_rsv->space_info == global_rsv->space_info) {
-		ret = block_rsv_use_bytes(global_rsv, blocksize);
+		ret = btrfs_block_rsv_use_bytes(global_rsv, blocksize);
 		if (!ret)
 			return global_rsv;
 	}
-- 
2.14.3


  parent reply	other threads:[~2019-06-18 20:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18 20:09 [PATCH 00/11] btrfs: move the space_info code out of extent-tree.c Josef Bacik
2019-06-18 20:09 ` [PATCH 01/11] btrfs: move space_info to space_info.h Josef Bacik
2019-06-18 20:09 ` [PATCH 02/11] btrfs: rename do_chunk_alloc to btrfs_chunk_alloc Josef Bacik
2019-06-18 20:09 ` [PATCH 03/11] btrfs: export space_info_add_*_bytes Josef Bacik
2019-06-18 20:09 ` [PATCH 04/11] btrfs: move the space_info handling code to space-info.c Josef Bacik
2019-06-25 11:58   ` David Sterba
2019-06-25 12:54     ` Josef Bacik
2019-06-25 16:42       ` David Sterba
2019-06-18 20:09 ` [PATCH 05/11] btrfs: move and export can_overcommit Josef Bacik
2019-06-18 20:09 ` [PATCH 06/11] btrfs: move the space info update macro to space-info.h Josef Bacik
2019-06-18 20:09 ` [PATCH 07/11] btrfs: move btrfs_space_info_add_*_bytes to space-info.c Josef Bacik
2019-06-18 20:09 ` Josef Bacik [this message]
2019-06-18 20:09 ` [PATCH 09/11] btrfs: move dump_space_info " Josef Bacik
2019-06-18 20:09 ` [PATCH 10/11] btrfs: move reserve_metadata_bytes and supporting code " Josef Bacik
2019-06-18 20:09 ` [PATCH 11/11] btrfs: unexport can_overcommit Josef Bacik
2019-06-20  7:42 ` [PATCH 00/11] btrfs: move the space_info code out of extent-tree.c Nikolay Borisov
2019-06-25 16:44 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190618200926.3352-9-josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).