linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz
Subject: [PATCH 5/5] btrfs-progs: Remove unnecessary parameter for btrfs_add_block_group
Date: Wed,  3 Jan 2018 15:13:06 +0800	[thread overview]
Message-ID: <20180103071306.11500-6-wqu@suse.com> (raw)
In-Reply-To: <20180103071306.11500-1-wqu@suse.com>

@chunk_objectid of btrfs_make_block_group() function is always fixed to
BTRFS_FIRST_FREE_OBJECTID, so there is no need to pass it as parameter
explicitly.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 cmds-check.c   |  4 ++--
 convert/main.c |  4 +---
 ctree.h        |  5 ++---
 extent-tree.c  | 14 +++++++-------
 mkfs/main.c    | 14 ++++----------
 5 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index a93ac2c88a38..635c1c44ff6f 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -13036,7 +13036,7 @@ static int repair_chunk_item(struct btrfs_trans_handle *trans,
 
 	if (err & REFERENCER_MISSING) {
 		ret = btrfs_make_block_group(trans, chunk_root->fs_info, 0,
-		     type, chunk_key.objectid, chunk_key.offset, length);
+					     type, chunk_key.offset, length);
 		if (ret) {
 			error("fail to add block group item[%llu %llu]",
 			      chunk_key.offset, length);
@@ -13637,7 +13637,7 @@ static int reset_block_groups(struct btrfs_fs_info *fs_info)
 		chunk = btrfs_item_ptr(leaf, path.slots[0], struct btrfs_chunk);
 		btrfs_add_block_group(fs_info, 0,
 				      btrfs_chunk_type(leaf, chunk),
-				      key.objectid, key.offset,
+				      key.offset,
 				      btrfs_chunk_length(leaf, chunk));
 		set_extent_dirty(&fs_info->free_space_cache, key.offset,
 				 key.offset + btrfs_chunk_length(leaf, chunk));
diff --git a/convert/main.c b/convert/main.c
index af2855316fee..4a510a786394 100644
--- a/convert/main.c
+++ b/convert/main.c
@@ -916,9 +916,7 @@ static int make_convert_data_block_groups(struct btrfs_trans_handle *trans,
 			if (ret < 0)
 				break;
 			ret = btrfs_make_block_group(trans, fs_info, 0,
-					BTRFS_BLOCK_GROUP_DATA,
-					BTRFS_FIRST_CHUNK_TREE_OBJECTID,
-					cur, len);
+					BTRFS_BLOCK_GROUP_DATA, cur, len);
 			if (ret < 0)
 				break;
 			cur += len;
diff --git a/ctree.h b/ctree.h
index 61d9f9fc9dff..5a04c0f1c912 100644
--- a/ctree.h
+++ b/ctree.h
@@ -2497,11 +2497,10 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info);
 int btrfs_read_block_groups(struct btrfs_root *root);
 struct btrfs_block_group_cache *
 btrfs_add_block_group(struct btrfs_fs_info *fs_info, u64 bytes_used, u64 type,
-		      u64 chunk_objectid, u64 chunk_offset, u64 size);
+		      u64 chunk_offset, u64 size);
 int btrfs_make_block_group(struct btrfs_trans_handle *trans,
 			   struct btrfs_fs_info *fs_info, u64 bytes_used,
-			   u64 type, u64 chunk_objectid, u64 chunk_offset,
-			   u64 size);
+			   u64 type, u64 chunk_offset, u64 size);
 int btrfs_make_block_groups(struct btrfs_trans_handle *trans,
 			    struct btrfs_fs_info *fs_info);
 int btrfs_update_block_group(struct btrfs_trans_handle *trans,
diff --git a/extent-tree.c b/extent-tree.c
index 58b64a21d226..db24da3a3a8c 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -1916,7 +1916,7 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,
 	BUG_ON(ret);
 
 	ret = btrfs_make_block_group(trans, fs_info, 0, space_info->flags,
-		     BTRFS_FIRST_CHUNK_TREE_OBJECTID, start, num_bytes);
+				     start, num_bytes);
 	BUG_ON(ret);
 	return 0;
 }
@@ -3312,7 +3312,7 @@ error:
 
 struct btrfs_block_group_cache *
 btrfs_add_block_group(struct btrfs_fs_info *fs_info, u64 bytes_used, u64 type,
-		      u64 chunk_objectid, u64 chunk_offset, u64 size)
+		      u64 chunk_offset, u64 size)
 {
 	int ret;
 	int bit = 0;
@@ -3328,7 +3328,8 @@ btrfs_add_block_group(struct btrfs_fs_info *fs_info, u64 bytes_used, u64 type,
 
 	cache->key.type = BTRFS_BLOCK_GROUP_ITEM_KEY;
 	btrfs_set_block_group_used(&cache->item, bytes_used);
-	btrfs_set_block_group_chunk_objectid(&cache->item, chunk_objectid);
+	btrfs_set_block_group_chunk_objectid(&cache->item,
+			BTRFS_FIRST_CHUNK_TREE_OBJECTID);
 	cache->flags = type;
 	btrfs_set_block_group_flags(&cache->item, type);
 
@@ -3353,15 +3354,14 @@ btrfs_add_block_group(struct btrfs_fs_info *fs_info, u64 bytes_used, u64 type,
 
 int btrfs_make_block_group(struct btrfs_trans_handle *trans,
 			   struct btrfs_fs_info *fs_info, u64 bytes_used,
-			   u64 type, u64 chunk_objectid, u64 chunk_offset,
-			   u64 size)
+			   u64 type, u64 chunk_offset, u64 size)
 {
 	int ret;
 	struct btrfs_root *extent_root = fs_info->extent_root;
 	struct btrfs_block_group_cache *cache;
 
-	cache = btrfs_add_block_group(fs_info, bytes_used, type,
-				      chunk_objectid, chunk_offset, size);
+	cache = btrfs_add_block_group(fs_info, bytes_used, type, chunk_offset,
+				      size);
 	ret = btrfs_insert_item(trans, extent_root, &cache->key, &cache->item,
 				sizeof(cache->item));
 	BUG_ON(ret);
diff --git a/mkfs/main.c b/mkfs/main.c
index a69a699fa3fd..938025bfd32e 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -83,7 +83,6 @@ static int create_metadata_block_groups(struct btrfs_root *root, int mixed,
 	root->fs_info->system_allocs = 1;
 	ret = btrfs_make_block_group(trans, fs_info, bytes_used,
 				     BTRFS_BLOCK_GROUP_SYSTEM,
-				     BTRFS_FIRST_CHUNK_TREE_OBJECTID,
 				     0, BTRFS_MKFS_SYSTEM_GROUP_SIZE);
 	allocation->system += BTRFS_MKFS_SYSTEM_GROUP_SIZE;
 	if (ret)
@@ -103,7 +102,6 @@ static int create_metadata_block_groups(struct btrfs_root *root, int mixed,
 		ret = btrfs_make_block_group(trans, fs_info, 0,
 					     BTRFS_BLOCK_GROUP_METADATA |
 					     BTRFS_BLOCK_GROUP_DATA,
-					     BTRFS_FIRST_CHUNK_TREE_OBJECTID,
 					     chunk_start, chunk_size);
 		if (ret)
 			return ret;
@@ -120,7 +118,6 @@ static int create_metadata_block_groups(struct btrfs_root *root, int mixed,
 			return ret;
 		ret = btrfs_make_block_group(trans, fs_info, 0,
 					     BTRFS_BLOCK_GROUP_METADATA,
-					     BTRFS_FIRST_CHUNK_TREE_OBJECTID,
 					     chunk_start, chunk_size);
 		allocation->metadata += chunk_size;
 		if (ret)
@@ -155,7 +152,6 @@ static int create_data_block_groups(struct btrfs_trans_handle *trans,
 			return ret;
 		ret = btrfs_make_block_group(trans, fs_info, 0,
 					     BTRFS_BLOCK_GROUP_DATA,
-					     BTRFS_FIRST_CHUNK_TREE_OBJECTID,
 					     chunk_start, chunk_size);
 		allocation->data += chunk_size;
 		if (ret)
@@ -264,8 +260,7 @@ static int create_one_raid_group(struct btrfs_trans_handle *trans,
 		return ret;
 
 	ret = btrfs_make_block_group(trans, fs_info, 0,
-				     type, BTRFS_FIRST_CHUNK_TREE_OBJECTID,
-				     chunk_start, chunk_size);
+				     type, chunk_start, chunk_size);
 
 	type &= BTRFS_BLOCK_GROUP_TYPE_MASK;
 	if (type == BTRFS_BLOCK_GROUP_DATA) {
@@ -1012,8 +1007,8 @@ static int create_chunks(struct btrfs_trans_handle *trans,
 		if (ret)
 			return ret;
 		ret = btrfs_make_block_group(trans, fs_info, 0,
-					     meta_type, BTRFS_FIRST_CHUNK_TREE_OBJECTID,
-					     chunk_start, chunk_size);
+					     meta_type, chunk_start,
+					     chunk_size);
 		allocation->metadata += chunk_size;
 		if (ret)
 			return ret;
@@ -1029,8 +1024,7 @@ static int create_chunks(struct btrfs_trans_handle *trans,
 	if (ret)
 		return ret;
 	ret = btrfs_make_block_group(trans, fs_info, 0,
-				     data_type, BTRFS_FIRST_CHUNK_TREE_OBJECTID,
-				     chunk_start, size_of_data);
+				     data_type, chunk_start, size_of_data);
 	allocation->data += size_of_data;
 	if (ret)
 		return ret;
-- 
2.15.1


  parent reply	other threads:[~2018-01-03  7:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03  7:13 [PATCH 0/5] Cleanups for later btrfs_alloc_chunk() rework Qu Wenruo
2018-01-03  7:13 ` [PATCH 1/5] btrfs-progs: Use bool parameter to determine if we're allocating data extent Qu Wenruo
2018-01-03  7:13 ` [PATCH 2/5] btrfs-progs: volumes: Make find_free_dev_extent_start static Qu Wenruo
2018-01-03  7:13 ` [PATCH 3/5] btrfs-progs: volumes: Remove unnecessary trans parameter Qu Wenruo
2018-01-03  7:13 ` [PATCH 4/5] btrfs-progs: volumes: Remove unnecessary parameters when allocating device extent Qu Wenruo
2018-01-03  7:13 ` Qu Wenruo [this message]
2018-01-23 18:31   ` [PATCH 5/5] btrfs-progs: Remove unnecessary parameter for btrfs_add_block_group David Sterba
2018-01-03  9:17 ` [PATCH 0/5] Cleanups for later btrfs_alloc_chunk() rework Su Yue
2018-01-04 13:54 ` Nikolay Borisov

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=20180103071306.11500-6-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=dsterba@suse.cz \
    --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).