linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: Anand Jain <anand.jain@oracle.com>
Subject: [PATCH 04/11] btrfs-progs: optimize device_list_add
Date: Wed,  7 Jun 2023 17:59:09 +0800	[thread overview]
Message-ID: <d56a56492b6436922a82dfebf79d3b35abd1a25f.1686131669.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1686131669.git.anand.jain@oracle.com>

Drop devid argument, instead it can be fetched from the disk_super
argument.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 kernel-shared/volumes.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c
index 95d5930b95d8..81abda3f7d1c 100644
--- a/kernel-shared/volumes.c
+++ b/kernel-shared/volumes.c
@@ -334,11 +334,12 @@ static struct btrfs_fs_devices *find_fsid(u8 *fsid, u8 *metadata_uuid)
 
 static int device_list_add(const char *path,
 			   struct btrfs_super_block *disk_super,
-			   u64 devid, struct btrfs_fs_devices **fs_devices_ret)
+			   struct btrfs_fs_devices **fs_devices_ret)
 {
 	struct btrfs_device *device;
 	struct btrfs_fs_devices *fs_devices;
 	u64 found_transid = btrfs_super_generation(disk_super);
+	u64 devid = btrfs_stack_device_id(&disk_super->dev_item);
 	bool metadata_uuid = (btrfs_super_incompat_flags(disk_super) &
 		BTRFS_FEATURE_INCOMPAT_METADATA_UUID);
 
@@ -545,18 +546,17 @@ int btrfs_scan_one_device(int fd, const char *path,
 {
 	struct btrfs_super_block disk_super;
 	int ret;
-	u64 devid;
 
 	ret = btrfs_read_dev_super(fd, &disk_super, super_offset, sbflags);
 	if (ret < 0)
 		return -EIO;
-	devid = btrfs_stack_device_id(&disk_super.dev_item);
+
 	if (btrfs_super_flags(&disk_super) & BTRFS_SUPER_FLAG_METADUMP)
 		*total_devs = 1;
 	else
 		*total_devs = btrfs_super_num_devices(&disk_super);
 
-	ret = device_list_add(path, &disk_super, devid, fs_devices_ret);
+	ret = device_list_add(path, &disk_super, fs_devices_ret);
 
 	return ret;
 }
-- 
2.31.1


  parent reply	other threads:[~2023-06-07 10:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  9:59 [PATCH 0/9] btrfs-progs: btrfstune: accept multiple devices and cleanup Anand Jain
2023-06-07  9:59 ` [PATCH 01/11] btrfs-progs: check_mounted_where declare is_btrfs as bool Anand Jain
2023-06-07  9:59 ` [PATCH 02/11] btrfs-progs: check_mounted_where pack varibles type by size Anand Jain
2023-06-07  9:59 ` [PATCH 03/11] btrfs-progs: rename struct open_ctree_flags to open_ctree_args Anand Jain
2023-06-07  9:59 ` Anand Jain [this message]
2023-06-07  9:59 ` [PATCH 05/11] btrfs-progs: simplify btrfs_scan_one_device() Anand Jain
2023-06-07  9:59 ` [PATCH 06/11] btrfs-progs: factor out btrfs_scan_stdin_devices Anand Jain
2023-06-07  9:59 ` [PATCH 07/11] btrfs-progs: tune: add stdin device list Anand Jain
2023-06-07  9:59 ` [PATCH 08/11] btrfs-progs: refactor check_where_mounted with noscan option Anand Jain
2023-06-07  9:59 ` [PATCH 09/11] btrfs-progs: tune: add " Anand Jain
2023-06-07  9:59 ` [PATCH 10/11] btrfs-progs: tune: add help for multiple devices and " Anand Jain
2023-06-07  9:59 ` [PATCH 11/11] btrfs-progs: Documentation: update btrfstune --noscan option Anand Jain
2023-06-07 10:43 ` [PATCH 0/9] btrfs-progs: btrfstune: accept multiple devices and cleanup Anand Jain
2023-06-07 11:06 ` Qu Wenruo
2023-06-08  0:20   ` Anand Jain
2023-06-08  1:42     ` Qu Wenruo
2023-06-08  4:26       ` Anand Jain

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=d56a56492b6436922a82dfebf79d3b35abd1a25f.1686131669.git.anand.jain@oracle.com \
    --to=anand.jain@oracle.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).