From: jeffm@suse.com
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 26/31] btrfs: root->fs_info cleanup, update_block_group{,flags}
Date: Fri, 24 Jun 2016 18:15:19 -0400 [thread overview]
Message-ID: <1466806524-27508-27-git-send-email-jeffm@suse.com> (raw)
In-Reply-To: <1466806524-27508-1-git-send-email-jeffm@suse.com>
From: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/btrfs/extent-tree.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 14f4d05..bc56e04 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -76,7 +76,7 @@ enum {
};
static int update_block_group(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u64 bytenr,
+ struct btrfs_fs_info *fs_info, u64 bytenr,
u64 num_bytes, int alloc);
static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
@@ -5971,11 +5971,10 @@ void btrfs_delalloc_release_space(struct inode *inode, u64 start, u64 len)
}
static int update_block_group(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u64 bytenr,
+ struct btrfs_fs_info *info, u64 bytenr,
u64 num_bytes, int alloc)
{
struct btrfs_block_group_cache *cache = NULL;
- struct btrfs_fs_info *info = root->fs_info;
u64 total = num_bytes;
u64 old_val;
u64 byte_in_group;
@@ -6016,7 +6015,7 @@ static int update_block_group(struct btrfs_trans_handle *trans,
spin_lock(&cache->space_info->lock);
spin_lock(&cache->lock);
- if (btrfs_test_opt(root->fs_info, SPACE_CACHE) &&
+ if (btrfs_test_opt(info, SPACE_CACHE) &&
cache->disk_cache_state < BTRFS_DC_CLEAR)
cache->disk_cache_state = BTRFS_DC_CLEAR;
@@ -6848,7 +6847,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
goto out;
}
- ret = update_block_group(trans, root, bytenr, num_bytes, 0);
+ ret = update_block_group(trans, root->fs_info, bytenr,
+ num_bytes, 0);
if (ret) {
btrfs_abort_transaction(trans, ret);
goto out;
@@ -7866,7 +7866,7 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
if (ret)
return ret;
- ret = update_block_group(trans, root, ins->objectid, ins->offset, 1);
+ ret = update_block_group(trans, fs_info, ins->objectid, ins->offset, 1);
if (ret) { /* -ENOENT, logic error */
btrfs_err(fs_info, "update block group failed for %llu %llu",
ins->objectid, ins->offset);
@@ -7952,9 +7952,8 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
if (ret)
return ret;
- ret = update_block_group(trans, root, ins->objectid,
- root->fs_info->nodesize,
- 1);
+ ret = update_block_group(trans, fs_info, ins->objectid,
+ fs_info->nodesize, 1);
if (ret) { /* -ENOENT, logic error */
btrfs_err(fs_info, "update block group failed for %llu %llu",
ins->objectid, ins->offset);
@@ -9262,7 +9261,7 @@ int btrfs_drop_subtree(struct btrfs_trans_handle *trans,
return ret;
}
-static u64 update_block_group_flags(struct btrfs_root *root, u64 flags)
+static u64 update_block_group_flags(struct btrfs_fs_info *fs_info, u64 flags)
{
u64 num_devices;
u64 stripped;
@@ -9271,11 +9270,11 @@ static u64 update_block_group_flags(struct btrfs_root *root, u64 flags)
* if restripe for this chunk_type is on pick target profile and
* return, otherwise do the usual balance
*/
- stripped = get_restripe_target(root->fs_info, flags);
+ stripped = get_restripe_target(fs_info, flags);
if (stripped)
return extended_to_chunk(stripped);
- num_devices = root->fs_info->fs_devices->rw_devices;
+ num_devices = fs_info->fs_devices->rw_devices;
stripped = BTRFS_BLOCK_GROUP_RAID0 |
BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 |
@@ -9391,7 +9390,7 @@ again:
* if we are changing raid levels, try to allocate a corresponding
* block group with the new raid level.
*/
- alloc_flags = update_block_group_flags(root, cache->flags);
+ alloc_flags = update_block_group_flags(root->fs_info, cache->flags);
if (alloc_flags != cache->flags) {
ret = do_chunk_alloc(trans, root, alloc_flags,
CHUNK_ALLOC_FORCE);
@@ -9417,7 +9416,8 @@ again:
ret = inc_block_group_ro(cache, 0);
out:
if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM) {
- alloc_flags = update_block_group_flags(root, cache->flags);
+ alloc_flags = update_block_group_flags(root->fs_info,
+ cache->flags);
lock_chunks(root->fs_info);
check_system_chunk(trans, root, alloc_flags);
unlock_chunks(root->fs_info);
--
2.7.1
next prev parent reply other threads:[~2016-06-24 22:15 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-24 22:14 [PATCH 00/31] btrfs: simplify use of struct btrfs_root pointers jeffm
2016-06-24 22:14 ` [PATCH 01/31] btrfs: plumb fs_info into btrfs_work jeffm
2016-06-24 22:14 ` [PATCH 02/31] btrfs: prefix fsid to all trace events jeffm
2016-06-27 1:50 ` Qu Wenruo
2016-06-24 22:14 ` [PATCH 03/31] btrfs: btrfs_test_opt and friends should take a btrfs_fs_info jeffm
2016-06-27 2:14 ` Qu Wenruo
2016-06-27 2:21 ` Jeff Mahoney
2016-06-27 2:24 ` Qu Wenruo
2016-06-24 22:14 ` [PATCH 04/31] btrfs: tests, move initialization into tests/ jeffm
2016-06-27 2:17 ` Qu Wenruo
2016-06-27 2:28 ` Jeff Mahoney
2016-06-24 22:14 ` [PATCH 05/31] btrfs: tests, require fs_info for root jeffm
2016-07-08 1:32 ` Jeff Mahoney
2016-07-08 11:20 ` David Sterba
2016-06-24 22:14 ` [PATCH 06/31] btrfs: tests, use BTRFS_FS_STATE_DUMMY_FS_INFO instead of dummy root jeffm
2016-06-24 22:15 ` [PATCH 07/31] btrfs: simpilify btrfs_subvol_inherit_props jeffm
2016-06-24 22:15 ` [PATCH 08/31] btrfs: copy_to_sk drop unused root parameter jeffm
2016-06-24 22:15 ` [PATCH 09/31] btrfs: cleanup, remove prototype for btrfs_find_root_ref jeffm
2016-06-24 22:15 ` [PATCH 10/31] btrfs: introduce BTRFS_MAX_ITEM_SIZE jeffm
2016-06-24 22:15 ` [PATCH 11/31] btrfs: convert nodesize macros to static inlines jeffm
2016-06-24 22:15 ` [PATCH 12/31] btrfs: btrfs_relocate_chunk pass extent_root to btrfs_end_transaction jeffm
2016-06-24 22:15 ` [PATCH 13/31] btrfs: add btrfs_trans_handle->fs_info pointer jeffm
2016-06-24 22:15 ` [PATCH 14/31] btrfs: btrfs_abort_transaction, drop root parameter jeffm
2016-06-24 22:15 ` [PATCH 15/31] btrfs: call functions that overwrite their root parameter with fs_info jeffm
2016-09-06 17:40 ` David Sterba
2016-06-24 22:15 ` [PATCH 16/31] btrfs: call functions that always use the same root with fs_info instead jeffm
2016-06-24 22:15 ` [PATCH 17/31] btrfs: btrfs_init_new_device should use fs_info->dev_root jeffm
2016-06-24 22:15 ` [PATCH 18/31] btrfs: alloc_reserved_file_extent trace point should use extent_root jeffm
2016-06-24 22:15 ` [PATCH 19/31] btrfs: struct btrfsic_state->root should be an fs_info jeffm
2016-06-24 22:15 ` [PATCH 20/31] btrfs: struct reada_control.root -> reada_control.fs_info jeffm
2016-06-24 22:15 ` [PATCH 21/31] btrfs: root->fs_info cleanup, use fs_info->dev_root everywhere jeffm
2016-06-24 22:15 ` [PATCH 22/31] btrfs: root->fs_info cleanup, io_ctl_init jeffm
2016-06-24 22:15 ` [PATCH 24/31] btrfs: root->fs_info cleanup, btrfs_calc_{trans,trunc}_metadata_size jeffm
2016-06-24 22:15 ` [PATCH 25/31] btrfs: root->fs_info cleanup, lock/unlock_chunks jeffm
2016-06-24 22:15 ` jeffm [this message]
2016-06-24 22:15 ` [PATCH 28/31] btrfs: root->fs_info cleanup, access fs_info->delayed_root directly jeffm
2016-06-24 22:15 ` [PATCH 30/31] btrfs: root->fs_info cleanup, btrfs_commit_transaction already has root jeffm
2016-06-24 22:15 ` [PATCH 31/31] btrfs: root->fs_info cleanup, btrfs_end_transaction{,_throttle} use trans->fs_info instead of parameter jeffm
2016-06-26 13:50 ` [PATCH 00/31] btrfs: simplify use of struct btrfs_root pointers Jeff Mahoney
2016-06-27 1:34 ` Qu Wenruo
2016-07-07 14:07 ` David Sterba
2016-07-08 1:48 ` Jeff Mahoney
2016-07-08 2:19 ` Jeff Mahoney
2016-07-08 12:50 ` 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=1466806524-27508-27-git-send-email-jeffm@suse.com \
--to=jeffm@suse.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).