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 4/5] btrfs-progs: volumes: Remove unnecessary parameters when allocating device extent
Date: Wed,  3 Jan 2018 15:13:05 +0800	[thread overview]
Message-ID: <20180103071306.11500-5-wqu@suse.com> (raw)
In-Reply-To: <20180103071306.11500-1-wqu@suse.com>

@chunk_tree and @chunk_objectid of device extent is fixed to
BTRFS_CHUNK_TREE_OBJECTID and BTRFS_FIRST_CHUNK_TREE_OBJECTID
respectively.

There is no need to pass them as parameter explicitly.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 volumes.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/volumes.c b/volumes.c
index f6c6447fe925..fa3c6de023f9 100644
--- a/volumes.c
+++ b/volumes.c
@@ -466,9 +466,8 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes,
 
 static int btrfs_alloc_dev_extent(struct btrfs_trans_handle *trans,
 				  struct btrfs_device *device,
-				  u64 chunk_tree, u64 chunk_objectid,
-				  u64 chunk_offset,
-				  u64 num_bytes, u64 *start, int convert)
+				  u64 chunk_offset, u64 num_bytes, u64 *start,
+				  int convert)
 {
 	int ret;
 	struct btrfs_path *path;
@@ -501,8 +500,9 @@ static int btrfs_alloc_dev_extent(struct btrfs_trans_handle *trans,
 	leaf = path->nodes[0];
 	extent = btrfs_item_ptr(leaf, path->slots[0],
 				struct btrfs_dev_extent);
-	btrfs_set_dev_extent_chunk_tree(leaf, extent, chunk_tree);
-	btrfs_set_dev_extent_chunk_objectid(leaf, extent, chunk_objectid);
+	btrfs_set_dev_extent_chunk_tree(leaf, extent, BTRFS_CHUNK_TREE_OBJECTID);
+	btrfs_set_dev_extent_chunk_objectid(leaf, extent,
+					    BTRFS_FIRST_CHUNK_TREE_OBJECTID);
 	btrfs_set_dev_extent_chunk_offset(leaf, extent, chunk_offset);
 
 	write_extent_buffer(leaf, root->fs_info->chunk_tree_uuid,
@@ -1039,9 +1039,7 @@ again:
 		    (index == num_stripes - 1))
 			list_move_tail(&device->dev_list, dev_list);
 
-		ret = btrfs_alloc_dev_extent(trans, device,
-			     info->chunk_root->root_key.objectid,
-			     BTRFS_FIRST_CHUNK_TREE_OBJECTID, key.offset,
+		ret = btrfs_alloc_dev_extent(trans, device, key.offset,
 			     calc_size, &dev_offset, 0);
 		if (ret < 0)
 			goto out_chunk_map;
@@ -1176,9 +1174,7 @@ int btrfs_alloc_data_chunk(struct btrfs_trans_handle *trans,
 	while (index < num_stripes) {
 		struct btrfs_stripe *stripe;
 
-		ret = btrfs_alloc_dev_extent(trans, device,
-			     info->chunk_root->root_key.objectid,
-			     BTRFS_FIRST_CHUNK_TREE_OBJECTID, key.offset,
+		ret = btrfs_alloc_dev_extent(trans, device, key.offset,
 			     calc_size, &dev_offset, convert);
 		BUG_ON(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 ` Qu Wenruo [this message]
2018-01-03  7:13 ` [PATCH 5/5] btrfs-progs: Remove unnecessary parameter for btrfs_add_block_group Qu Wenruo
2018-01-23 18:31   ` 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-5-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).