diff mbox series

[2/6] btrfs-progs: rename struct open_ctree_flags to open_ctree_args

Message ID 452c6fb3507f8e9b864efbcfccc8a759040f356e.1686484067.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: cleanup and preparatory around device scan | expand

Commit Message

Anand Jain June 13, 2023, 10:26 a.m. UTC
The struct open_ctree_flags currently holds arguments for
open_ctree_fs_info(), it can be confusing when mixed with a local variable
named open_ctree_flags as below in the function cmd_inspect_dump_tree().

	cmd_inspect_dump_tree()
	::
	struct open_ctree_flags ocf = { 0 };
	::
	unsigned open_ctree_flags;

So rename struct open_ctree_flags to struct open_ctree_args.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v3: Also rename struct open_ctree_args' variable to oca.

 btrfs-find-root.c        |  8 +++----
 check/main.c             | 14 +++++------
 cmds/filesystem.c        |  8 +++----
 cmds/inspect-dump-tree.c |  8 +++----
 cmds/rescue.c            | 16 ++++++-------
 cmds/restore.c           | 12 +++++-----
 image/main.c             | 16 ++++++-------
 kernel-shared/disk-io.c  | 50 ++++++++++++++++++++--------------------
 kernel-shared/disk-io.h  |  4 ++--
 mkfs/main.c              |  8 +++----
 10 files changed, 72 insertions(+), 72 deletions(-)

Comments

Qu Wenruo June 13, 2023, 10:40 a.m. UTC | #1
On 2023/6/13 18:26, Anand Jain wrote:
> The struct open_ctree_flags currently holds arguments for
> open_ctree_fs_info(), it can be confusing when mixed with a local variable
> named open_ctree_flags as below in the function cmd_inspect_dump_tree().
>
> 	cmd_inspect_dump_tree()
> 	::
> 	struct open_ctree_flags ocf = { 0 };
> 	::
> 	unsigned open_ctree_flags;
>
> So rename struct open_ctree_flags to struct open_ctree_args.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
> v3: Also rename struct open_ctree_args' variable to oca.
>
>   btrfs-find-root.c        |  8 +++----
>   check/main.c             | 14 +++++------
>   cmds/filesystem.c        |  8 +++----
>   cmds/inspect-dump-tree.c |  8 +++----
>   cmds/rescue.c            | 16 ++++++-------
>   cmds/restore.c           | 12 +++++-----
>   image/main.c             | 16 ++++++-------
>   kernel-shared/disk-io.c  | 50 ++++++++++++++++++++--------------------
>   kernel-shared/disk-io.h  |  4 ++--
>   mkfs/main.c              |  8 +++----
>   10 files changed, 72 insertions(+), 72 deletions(-)
>
> diff --git a/btrfs-find-root.c b/btrfs-find-root.c
> index 398d7f216ee7..e5a60c2023df 100644
> --- a/btrfs-find-root.c
> +++ b/btrfs-find-root.c
> @@ -335,7 +335,7 @@ int main(int argc, char **argv)
>   	struct btrfs_find_root_filter filter = {0};
>   	struct cache_tree result;
>   	struct cache_extent *found;
> -	struct open_ctree_flags ocf = { 0 };
> +	struct open_ctree_args oca = { 0 };
>   	int ret;
>
>   	/* Default to search root tree */
> @@ -378,9 +378,9 @@ int main(int argc, char **argv)
>   	if (check_argc_min(argc - optind, 1))
>   		return 1;
>
> -	ocf.filename = argv[optind];
> -	ocf.flags = OPEN_CTREE_CHUNK_ROOT_ONLY | OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR;
> -	fs_info = open_ctree_fs_info(&ocf);
> +	oca.filename = argv[optind];
> +	oca.flags = OPEN_CTREE_CHUNK_ROOT_ONLY | OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR;
> +	fs_info = open_ctree_fs_info(&oca);
>   	if (!fs_info) {
>   		error("open ctree failed");
>   		return 1;
> diff --git a/check/main.c b/check/main.c
> index 77bb50a0e21e..2f4fa5ada339 100644
> --- a/check/main.c
> +++ b/check/main.c
> @@ -9983,7 +9983,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
>   {
>   	struct cache_tree root_cache;
>   	struct btrfs_root *root;
> -	struct open_ctree_flags ocf = { 0 };
> +	struct open_ctree_args oca = { 0 };
>   	u64 bytenr = 0;
>   	u64 subvolid = 0;
>   	u64 tree_root_bytenr = 0;
> @@ -10204,12 +10204,12 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
>   	if (opt_check_repair)
>   		ctree_flags |= OPEN_CTREE_PARTIAL;
>
> -	ocf.filename = argv[optind];
> -	ocf.sb_bytenr = bytenr;
> -	ocf.root_tree_bytenr = tree_root_bytenr;
> -	ocf.chunk_tree_bytenr = chunk_root_bytenr;
> -	ocf.flags = ctree_flags;
> -	gfs_info = open_ctree_fs_info(&ocf);
> +	oca.filename = argv[optind];
> +	oca.sb_bytenr = bytenr;
> +	oca.root_tree_bytenr = tree_root_bytenr;
> +	oca.chunk_tree_bytenr = chunk_root_bytenr;
> +	oca.flags = ctree_flags;
> +	gfs_info = open_ctree_fs_info(&oca);
>   	if (!gfs_info) {
>   		error("cannot open file system");
>   		ret = -EIO;
> diff --git a/cmds/filesystem.c b/cmds/filesystem.c
> index 47fd2377f5f4..79f3e799250a 100644
> --- a/cmds/filesystem.c
> +++ b/cmds/filesystem.c
> @@ -636,7 +636,7 @@ static int map_seed_devices(struct list_head *all_uuids)
>   	fs_uuids = btrfs_scanned_uuids();
>
>   	list_for_each_entry(cur_fs, all_uuids, list) {
> -		struct open_ctree_flags ocf = { 0 };
> +		struct open_ctree_args oca = { 0 };
>
>   		device = list_first_entry(&cur_fs->devices,
>   						struct btrfs_device, dev_list);
> @@ -650,9 +650,9 @@ static int map_seed_devices(struct list_head *all_uuids)
>   		/*
>   		 * open_ctree_* detects seed/sprout mapping
>   		 */
> -		ocf.filename = device->name;
> -		ocf.flags = OPEN_CTREE_PARTIAL;
> -		fs_info = open_ctree_fs_info(&ocf);
> +		oca.filename = device->name;
> +		oca.flags = OPEN_CTREE_PARTIAL;
> +		fs_info = open_ctree_fs_info(&oca);
>   		if (!fs_info)
>   			continue;
>
> diff --git a/cmds/inspect-dump-tree.c b/cmds/inspect-dump-tree.c
> index bfc0fff148dd..4c65f55db014 100644
> --- a/cmds/inspect-dump-tree.c
> +++ b/cmds/inspect-dump-tree.c
> @@ -317,7 +317,7 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd,
>   	struct btrfs_disk_key disk_key;
>   	struct btrfs_key found_key;
>   	struct cache_tree block_root;	/* for multiple --block parameters */
> -	struct open_ctree_flags ocf = { 0 };
> +	struct open_ctree_args oca = { 0 };
>   	char uuidbuf[BTRFS_UUID_UNPARSED_SIZE];
>   	int ret = 0;
>   	int slot;
> @@ -492,9 +492,9 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd,
>
>   	pr_verbose(LOG_DEFAULT, "%s\n", PACKAGE_STRING);
>
> -	ocf.filename = argv[optind];
> -	ocf.flags = open_ctree_flags;
> -	info = open_ctree_fs_info(&ocf);
> +	oca.filename = argv[optind];
> +	oca.flags = open_ctree_flags;
> +	info = open_ctree_fs_info(&oca);
>   	if (!info) {
>   		error("unable to open %s", argv[optind]);
>   		goto out;
> diff --git a/cmds/rescue.c b/cmds/rescue.c
> index 5551374d4b75..11f351f20ede 100644
> --- a/cmds/rescue.c
> +++ b/cmds/rescue.c
> @@ -233,7 +233,7 @@ static int cmd_rescue_fix_device_size(const struct cmd_struct *cmd,
>   				      int argc, char **argv)
>   {
>   	struct btrfs_fs_info *fs_info;
> -	struct open_ctree_flags ocf = { 0 };
> +	struct open_ctree_args oca = { 0 };
>   	char *devname;
>   	int ret;
>
> @@ -254,9 +254,9 @@ static int cmd_rescue_fix_device_size(const struct cmd_struct *cmd,
>   		goto out;
>   	}
>
> -	ocf.filename = devname;
> -	ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL;
> -	fs_info = open_ctree_fs_info(&ocf);
> +	oca.filename = devname;
> +	oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL;
> +	fs_info = open_ctree_fs_info(&oca);
>   	if (!fs_info) {
>   		error("could not open btrfs");
>   		ret = -EIO;
> @@ -368,7 +368,7 @@ static int cmd_rescue_clear_uuid_tree(const struct cmd_struct *cmd,
>   				      int argc, char **argv)
>   {
>   	struct btrfs_fs_info *fs_info;
> -	struct open_ctree_flags ocf = {};
> +	struct open_ctree_args oca = {};
>   	char *devname;
>   	int ret;
>
> @@ -387,9 +387,9 @@ static int cmd_rescue_clear_uuid_tree(const struct cmd_struct *cmd,
>   		ret = -EBUSY;
>   		goto out;
>   	}
> -	ocf.filename = devname;
> -	ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL;
> -	fs_info = open_ctree_fs_info(&ocf);
> +	oca.filename = devname;
> +	oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL;
> +	fs_info = open_ctree_fs_info(&oca);
>   	if (!fs_info) {
>   		error("could not open btrfs");
>   		ret = -EIO;
> diff --git a/cmds/restore.c b/cmds/restore.c
> index 9fe7b4d2d07d..7a3606457771 100644
> --- a/cmds/restore.c
> +++ b/cmds/restore.c
> @@ -1216,7 +1216,7 @@ static struct btrfs_root *open_fs(const char *dev, u64 root_location,
>   {
>   	struct btrfs_fs_info *fs_info = NULL;
>   	struct btrfs_root *root = NULL;
> -	struct open_ctree_flags ocf = { 0 };
> +	struct open_ctree_args oca = { 0 };
>   	u64 bytenr;
>   	int i;
>
> @@ -1228,12 +1228,12 @@ static struct btrfs_root *open_fs(const char *dev, u64 root_location,
>   		 * in extent tree. Skip block group item search will allow
>   		 * restore to be executed on heavily damaged fs.
>   		 */
> -		ocf.filename = dev;
> -		ocf.sb_bytenr = bytenr;
> -		ocf.root_tree_bytenr = root_location;
> -		ocf.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS |
> +		oca.filename = dev;
> +		oca.sb_bytenr = bytenr;
> +		oca.root_tree_bytenr = root_location;
> +		oca.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS |
>   			    OPEN_CTREE_ALLOW_TRANSID_MISMATCH;
> -		fs_info = open_ctree_fs_info(&ocf);
> +		fs_info = open_ctree_fs_info(&oca);
>   		if (fs_info)
>   			break;
>   		pr_stderr(LOG_DEFAULT, "Could not open root, trying backup super\n");
> diff --git a/image/main.c b/image/main.c
> index c175179e1515..42fd2854e9d4 100644
> --- a/image/main.c
> +++ b/image/main.c
> @@ -2795,12 +2795,12 @@ static int restore_metadump(const char *input, FILE *out, int old_restore,
>
>   	/* NOTE: open with write mode */
>   	if (fixup_offset) {
> -		struct open_ctree_flags ocf = { 0 };
> +		struct open_ctree_args oca = { 0 };
>
> -		ocf.filename = target;
> -		ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_RESTORE |
> +		oca.filename = target;
> +		oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_RESTORE |
>   			    OPEN_CTREE_PARTIAL | OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS;
> -		info = open_ctree_fs_info(&ocf);
> +		info = open_ctree_fs_info(&oca);
>   		if (!info) {
>   			error("open ctree failed");
>   			ret = -EIO;
> @@ -3223,15 +3223,15 @@ int BOX_MAIN(image)(int argc, char *argv[])
>
>   	 /* extended support for multiple devices */
>   	if (!create && multi_devices) {
> -		struct open_ctree_flags ocf = { 0 };
> +		struct open_ctree_args oca = { 0 };
>   		struct btrfs_fs_info *info;
>   		u64 total_devs;
>   		int i;
>
> -		ocf.filename = target;
> -		ocf.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_RESTORE |
> +		oca.filename = target;
> +		oca.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_RESTORE |
>   			OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS;
> -		info = open_ctree_fs_info(&ocf);
> +		info = open_ctree_fs_info(&oca);
>   		if (!info) {
>   			error("open ctree failed at %s", target);
>   			return 1;
> diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c
> index 442d3af8bc01..4e7cc381471c 100644
> --- a/kernel-shared/disk-io.c
> +++ b/kernel-shared/disk-io.c
> @@ -1437,7 +1437,7 @@ int btrfs_setup_chunk_tree_and_device_map(struct btrfs_fs_info *fs_info,
>   	return 0;
>   }
>
> -static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *ocf)
> +static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_args *oca)
>   {
>   	struct btrfs_fs_info *fs_info;
>   	struct btrfs_super_block *disk_super;
> @@ -1446,8 +1446,8 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
>   	int ret;
>   	int oflags;
>   	unsigned sbflags = SBREAD_DEFAULT;
> -	unsigned flags = ocf->flags;
> -	u64 sb_bytenr = ocf->sb_bytenr;
> +	unsigned flags = oca->flags;
> +	u64 sb_bytenr = oca->sb_bytenr;
>
>   	if (sb_bytenr == 0)
>   		sb_bytenr = BTRFS_SUPER_INFO_OFFSET;
> @@ -1491,7 +1491,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
>   	if (flags & OPEN_CTREE_IGNORE_FSID_MISMATCH)
>   		sbflags |= SBREAD_IGNORE_FSID_MISMATCH;
>
> -	ret = btrfs_scan_fs_devices(fp, ocf->filename, &fs_devices, sb_bytenr,
> +	ret = btrfs_scan_fs_devices(fp, oca->filename, &fs_devices, sb_bytenr,
>   			sbflags, (flags & OPEN_CTREE_NO_DEVICES));
>   	if (ret)
>   		goto out;
> @@ -1559,7 +1559,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
>   	if (fcntl(fp, F_GETFL) & O_DIRECT)
>   		fs_info->zoned = 1;
>
> -	ret = btrfs_setup_chunk_tree_and_device_map(fs_info, ocf->chunk_tree_bytenr);
> +	ret = btrfs_setup_chunk_tree_and_device_map(fs_info, oca->chunk_tree_bytenr);
>   	if (ret)
>   		goto out_chunk;
>
> @@ -1591,7 +1591,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
>   			   btrfs_header_chunk_tree_uuid(eb),
>   			   BTRFS_UUID_SIZE);
>
> -	ret = btrfs_setup_all_roots(fs_info, ocf->root_tree_bytenr, flags);
> +	ret = btrfs_setup_all_roots(fs_info, oca->root_tree_bytenr, flags);
>   	if (ret && !(flags & __OPEN_CTREE_RETURN_CHUNK_ROOT) &&
>   	    !fs_info->ignore_chunk_tree_error)
>   		goto out_chunk;
> @@ -1608,7 +1608,7 @@ out:
>   	return NULL;
>   }
>
> -struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_flags *ocf)
> +struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_args *oca)
>   {
>   	int fp;
>   	int ret;
> @@ -1616,28 +1616,28 @@ struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_flags *ocf)
>   	int oflags = O_RDWR;
>   	struct stat st;
>
> -	ret = stat(ocf->filename, &st);
> +	ret = stat(oca->filename, &st);
>   	if (ret < 0) {
> -		error("cannot stat '%s': %m", ocf->filename);
> +		error("cannot stat '%s': %m", oca->filename);
>   		return NULL;
>   	}
>   	if (!(((st.st_mode & S_IFMT) == S_IFREG) || ((st.st_mode & S_IFMT) == S_IFBLK))) {
> -		error("not a regular file or block device: %s", ocf->filename);
> +		error("not a regular file or block device: %s", oca->filename);
>   		return NULL;
>   	}
>
> -	if (!(ocf->flags & OPEN_CTREE_WRITES))
> +	if (!(oca->flags & OPEN_CTREE_WRITES))
>   		oflags = O_RDONLY;
>
> -	if ((oflags & O_RDWR) && zoned_model(ocf->filename) == ZONED_HOST_MANAGED)
> +	if ((oflags & O_RDWR) && zoned_model(oca->filename) == ZONED_HOST_MANAGED)
>   		oflags |= O_DIRECT;
>
> -	fp = open(ocf->filename, oflags);
> +	fp = open(oca->filename, oflags);
>   	if (fp < 0) {
> -		error("cannot open '%s': %m", ocf->filename);
> +		error("cannot open '%s': %m", oca->filename);
>   		return NULL;
>   	}
> -	info = __open_ctree_fd(fp, ocf);
> +	info = __open_ctree_fd(fp, oca);
>   	close(fp);
>   	return info;
>   }
> @@ -1646,14 +1646,14 @@ struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr,
>   			      unsigned flags)
>   {
>   	struct btrfs_fs_info *info;
> -	struct open_ctree_flags ocf = { 0 };
> +	struct open_ctree_args oca = { 0 };
>
>   	/* This flags may not return fs_info with any valid root */
>   	BUG_ON(flags & OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR);
> -	ocf.filename = filename;
> -	ocf.sb_bytenr = sb_bytenr;
> -	ocf.flags = flags;
> -	info = open_ctree_fs_info(&ocf);
> +	oca.filename = filename;
> +	oca.sb_bytenr = sb_bytenr;
> +	oca.flags = flags;
> +	info = open_ctree_fs_info(&oca);
>   	if (!info)
>   		return NULL;
>   	if (flags & __OPEN_CTREE_RETURN_CHUNK_ROOT)
> @@ -1665,7 +1665,7 @@ struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
>   				 unsigned flags)
>   {
>   	struct btrfs_fs_info *info;
> -	struct open_ctree_flags ocf = { 0 };
> +	struct open_ctree_args oca = { 0 };
>
>   	/* This flags may not return fs_info with any valid root */
>   	if (flags & OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR) {
> @@ -1673,10 +1673,10 @@ struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
>   				(unsigned long long)flags);
>   		return NULL;
>   	}
> -	ocf.filename = path;
> -	ocf.sb_bytenr = sb_bytenr;
> -	ocf.flags = flags;
> -	info = __open_ctree_fd(fp, &ocf);
> +	oca.filename = path;
> +	oca.sb_bytenr = sb_bytenr;
> +	oca.flags = flags;
> +	info = __open_ctree_fd(fp, &oca);
>   	if (!info)
>   		return NULL;
>   	if (flags & __OPEN_CTREE_RETURN_CHUNK_ROOT)
> diff --git a/kernel-shared/disk-io.h b/kernel-shared/disk-io.h
> index 3a31667967cc..424b953e0363 100644
> --- a/kernel-shared/disk-io.h
> +++ b/kernel-shared/disk-io.h
> @@ -175,7 +175,7 @@ struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr,
>   			      unsigned flags);
>   struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
>   				 unsigned flags);
> -struct open_ctree_flags {
> +struct open_ctree_args {
>   	const char *filename;
>   	u64 sb_bytenr;
>   	u64 root_tree_bytenr;
> @@ -183,7 +183,7 @@ struct open_ctree_flags {
>   	unsigned flags;
>   };
>
> -struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_flags *ocf);
> +struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_args *oca);
>   int close_ctree_fs_info(struct btrfs_fs_info *fs_info);
>   static inline int close_ctree(struct btrfs_root *root)
>   {
> diff --git a/mkfs/main.c b/mkfs/main.c
> index 7acd39ec6531..972ed1112ea6 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -990,7 +990,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
>   	struct btrfs_root *root;
>   	struct btrfs_fs_info *fs_info;
>   	struct btrfs_trans_handle *trans;
> -	struct open_ctree_flags ocf = { 0 };
> +	struct open_ctree_args oca = { 0 };
>   	int ret = 0;
>   	int close_ret;
>   	int i;
> @@ -1569,9 +1569,9 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
>   		goto error;
>   	}
>
> -	ocf.filename = file;
> -	ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER;
> -	fs_info = open_ctree_fs_info(&ocf);
> +	oca.filename = file;
> +	oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER;
> +	fs_info = open_ctree_fs_info(&oca);
>   	if (!fs_info) {
>   		error("open ctree failed");
>   		goto error;
diff mbox series

Patch

diff --git a/btrfs-find-root.c b/btrfs-find-root.c
index 398d7f216ee7..e5a60c2023df 100644
--- a/btrfs-find-root.c
+++ b/btrfs-find-root.c
@@ -335,7 +335,7 @@  int main(int argc, char **argv)
 	struct btrfs_find_root_filter filter = {0};
 	struct cache_tree result;
 	struct cache_extent *found;
-	struct open_ctree_flags ocf = { 0 };
+	struct open_ctree_args oca = { 0 };
 	int ret;
 
 	/* Default to search root tree */
@@ -378,9 +378,9 @@  int main(int argc, char **argv)
 	if (check_argc_min(argc - optind, 1))
 		return 1;
 
-	ocf.filename = argv[optind];
-	ocf.flags = OPEN_CTREE_CHUNK_ROOT_ONLY | OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR;
-	fs_info = open_ctree_fs_info(&ocf);
+	oca.filename = argv[optind];
+	oca.flags = OPEN_CTREE_CHUNK_ROOT_ONLY | OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR;
+	fs_info = open_ctree_fs_info(&oca);
 	if (!fs_info) {
 		error("open ctree failed");
 		return 1;
diff --git a/check/main.c b/check/main.c
index 77bb50a0e21e..2f4fa5ada339 100644
--- a/check/main.c
+++ b/check/main.c
@@ -9983,7 +9983,7 @@  static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
 {
 	struct cache_tree root_cache;
 	struct btrfs_root *root;
-	struct open_ctree_flags ocf = { 0 };
+	struct open_ctree_args oca = { 0 };
 	u64 bytenr = 0;
 	u64 subvolid = 0;
 	u64 tree_root_bytenr = 0;
@@ -10204,12 +10204,12 @@  static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
 	if (opt_check_repair)
 		ctree_flags |= OPEN_CTREE_PARTIAL;
 
-	ocf.filename = argv[optind];
-	ocf.sb_bytenr = bytenr;
-	ocf.root_tree_bytenr = tree_root_bytenr;
-	ocf.chunk_tree_bytenr = chunk_root_bytenr;
-	ocf.flags = ctree_flags;
-	gfs_info = open_ctree_fs_info(&ocf);
+	oca.filename = argv[optind];
+	oca.sb_bytenr = bytenr;
+	oca.root_tree_bytenr = tree_root_bytenr;
+	oca.chunk_tree_bytenr = chunk_root_bytenr;
+	oca.flags = ctree_flags;
+	gfs_info = open_ctree_fs_info(&oca);
 	if (!gfs_info) {
 		error("cannot open file system");
 		ret = -EIO;
diff --git a/cmds/filesystem.c b/cmds/filesystem.c
index 47fd2377f5f4..79f3e799250a 100644
--- a/cmds/filesystem.c
+++ b/cmds/filesystem.c
@@ -636,7 +636,7 @@  static int map_seed_devices(struct list_head *all_uuids)
 	fs_uuids = btrfs_scanned_uuids();
 
 	list_for_each_entry(cur_fs, all_uuids, list) {
-		struct open_ctree_flags ocf = { 0 };
+		struct open_ctree_args oca = { 0 };
 
 		device = list_first_entry(&cur_fs->devices,
 						struct btrfs_device, dev_list);
@@ -650,9 +650,9 @@  static int map_seed_devices(struct list_head *all_uuids)
 		/*
 		 * open_ctree_* detects seed/sprout mapping
 		 */
-		ocf.filename = device->name;
-		ocf.flags = OPEN_CTREE_PARTIAL;
-		fs_info = open_ctree_fs_info(&ocf);
+		oca.filename = device->name;
+		oca.flags = OPEN_CTREE_PARTIAL;
+		fs_info = open_ctree_fs_info(&oca);
 		if (!fs_info)
 			continue;
 
diff --git a/cmds/inspect-dump-tree.c b/cmds/inspect-dump-tree.c
index bfc0fff148dd..4c65f55db014 100644
--- a/cmds/inspect-dump-tree.c
+++ b/cmds/inspect-dump-tree.c
@@ -317,7 +317,7 @@  static int cmd_inspect_dump_tree(const struct cmd_struct *cmd,
 	struct btrfs_disk_key disk_key;
 	struct btrfs_key found_key;
 	struct cache_tree block_root;	/* for multiple --block parameters */
-	struct open_ctree_flags ocf = { 0 };
+	struct open_ctree_args oca = { 0 };
 	char uuidbuf[BTRFS_UUID_UNPARSED_SIZE];
 	int ret = 0;
 	int slot;
@@ -492,9 +492,9 @@  static int cmd_inspect_dump_tree(const struct cmd_struct *cmd,
 
 	pr_verbose(LOG_DEFAULT, "%s\n", PACKAGE_STRING);
 
-	ocf.filename = argv[optind];
-	ocf.flags = open_ctree_flags;
-	info = open_ctree_fs_info(&ocf);
+	oca.filename = argv[optind];
+	oca.flags = open_ctree_flags;
+	info = open_ctree_fs_info(&oca);
 	if (!info) {
 		error("unable to open %s", argv[optind]);
 		goto out;
diff --git a/cmds/rescue.c b/cmds/rescue.c
index 5551374d4b75..11f351f20ede 100644
--- a/cmds/rescue.c
+++ b/cmds/rescue.c
@@ -233,7 +233,7 @@  static int cmd_rescue_fix_device_size(const struct cmd_struct *cmd,
 				      int argc, char **argv)
 {
 	struct btrfs_fs_info *fs_info;
-	struct open_ctree_flags ocf = { 0 };
+	struct open_ctree_args oca = { 0 };
 	char *devname;
 	int ret;
 
@@ -254,9 +254,9 @@  static int cmd_rescue_fix_device_size(const struct cmd_struct *cmd,
 		goto out;
 	}
 
-	ocf.filename = devname;
-	ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL;
-	fs_info = open_ctree_fs_info(&ocf);
+	oca.filename = devname;
+	oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL;
+	fs_info = open_ctree_fs_info(&oca);
 	if (!fs_info) {
 		error("could not open btrfs");
 		ret = -EIO;
@@ -368,7 +368,7 @@  static int cmd_rescue_clear_uuid_tree(const struct cmd_struct *cmd,
 				      int argc, char **argv)
 {
 	struct btrfs_fs_info *fs_info;
-	struct open_ctree_flags ocf = {};
+	struct open_ctree_args oca = {};
 	char *devname;
 	int ret;
 
@@ -387,9 +387,9 @@  static int cmd_rescue_clear_uuid_tree(const struct cmd_struct *cmd,
 		ret = -EBUSY;
 		goto out;
 	}
-	ocf.filename = devname;
-	ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL;
-	fs_info = open_ctree_fs_info(&ocf);
+	oca.filename = devname;
+	oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL;
+	fs_info = open_ctree_fs_info(&oca);
 	if (!fs_info) {
 		error("could not open btrfs");
 		ret = -EIO;
diff --git a/cmds/restore.c b/cmds/restore.c
index 9fe7b4d2d07d..7a3606457771 100644
--- a/cmds/restore.c
+++ b/cmds/restore.c
@@ -1216,7 +1216,7 @@  static struct btrfs_root *open_fs(const char *dev, u64 root_location,
 {
 	struct btrfs_fs_info *fs_info = NULL;
 	struct btrfs_root *root = NULL;
-	struct open_ctree_flags ocf = { 0 };
+	struct open_ctree_args oca = { 0 };
 	u64 bytenr;
 	int i;
 
@@ -1228,12 +1228,12 @@  static struct btrfs_root *open_fs(const char *dev, u64 root_location,
 		 * in extent tree. Skip block group item search will allow
 		 * restore to be executed on heavily damaged fs.
 		 */
-		ocf.filename = dev;
-		ocf.sb_bytenr = bytenr;
-		ocf.root_tree_bytenr = root_location;
-		ocf.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS |
+		oca.filename = dev;
+		oca.sb_bytenr = bytenr;
+		oca.root_tree_bytenr = root_location;
+		oca.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS |
 			    OPEN_CTREE_ALLOW_TRANSID_MISMATCH;
-		fs_info = open_ctree_fs_info(&ocf);
+		fs_info = open_ctree_fs_info(&oca);
 		if (fs_info)
 			break;
 		pr_stderr(LOG_DEFAULT, "Could not open root, trying backup super\n");
diff --git a/image/main.c b/image/main.c
index c175179e1515..42fd2854e9d4 100644
--- a/image/main.c
+++ b/image/main.c
@@ -2795,12 +2795,12 @@  static int restore_metadump(const char *input, FILE *out, int old_restore,
 
 	/* NOTE: open with write mode */
 	if (fixup_offset) {
-		struct open_ctree_flags ocf = { 0 };
+		struct open_ctree_args oca = { 0 };
 
-		ocf.filename = target;
-		ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_RESTORE |
+		oca.filename = target;
+		oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_RESTORE |
 			    OPEN_CTREE_PARTIAL | OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS;
-		info = open_ctree_fs_info(&ocf);
+		info = open_ctree_fs_info(&oca);
 		if (!info) {
 			error("open ctree failed");
 			ret = -EIO;
@@ -3223,15 +3223,15 @@  int BOX_MAIN(image)(int argc, char *argv[])
 
 	 /* extended support for multiple devices */
 	if (!create && multi_devices) {
-		struct open_ctree_flags ocf = { 0 };
+		struct open_ctree_args oca = { 0 };
 		struct btrfs_fs_info *info;
 		u64 total_devs;
 		int i;
 
-		ocf.filename = target;
-		ocf.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_RESTORE |
+		oca.filename = target;
+		oca.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_RESTORE |
 			OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS;
-		info = open_ctree_fs_info(&ocf);
+		info = open_ctree_fs_info(&oca);
 		if (!info) {
 			error("open ctree failed at %s", target);
 			return 1;
diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c
index 442d3af8bc01..4e7cc381471c 100644
--- a/kernel-shared/disk-io.c
+++ b/kernel-shared/disk-io.c
@@ -1437,7 +1437,7 @@  int btrfs_setup_chunk_tree_and_device_map(struct btrfs_fs_info *fs_info,
 	return 0;
 }
 
-static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *ocf)
+static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_args *oca)
 {
 	struct btrfs_fs_info *fs_info;
 	struct btrfs_super_block *disk_super;
@@ -1446,8 +1446,8 @@  static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
 	int ret;
 	int oflags;
 	unsigned sbflags = SBREAD_DEFAULT;
-	unsigned flags = ocf->flags;
-	u64 sb_bytenr = ocf->sb_bytenr;
+	unsigned flags = oca->flags;
+	u64 sb_bytenr = oca->sb_bytenr;
 
 	if (sb_bytenr == 0)
 		sb_bytenr = BTRFS_SUPER_INFO_OFFSET;
@@ -1491,7 +1491,7 @@  static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
 	if (flags & OPEN_CTREE_IGNORE_FSID_MISMATCH)
 		sbflags |= SBREAD_IGNORE_FSID_MISMATCH;
 
-	ret = btrfs_scan_fs_devices(fp, ocf->filename, &fs_devices, sb_bytenr,
+	ret = btrfs_scan_fs_devices(fp, oca->filename, &fs_devices, sb_bytenr,
 			sbflags, (flags & OPEN_CTREE_NO_DEVICES));
 	if (ret)
 		goto out;
@@ -1559,7 +1559,7 @@  static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
 	if (fcntl(fp, F_GETFL) & O_DIRECT)
 		fs_info->zoned = 1;
 
-	ret = btrfs_setup_chunk_tree_and_device_map(fs_info, ocf->chunk_tree_bytenr);
+	ret = btrfs_setup_chunk_tree_and_device_map(fs_info, oca->chunk_tree_bytenr);
 	if (ret)
 		goto out_chunk;
 
@@ -1591,7 +1591,7 @@  static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc
 			   btrfs_header_chunk_tree_uuid(eb),
 			   BTRFS_UUID_SIZE);
 
-	ret = btrfs_setup_all_roots(fs_info, ocf->root_tree_bytenr, flags);
+	ret = btrfs_setup_all_roots(fs_info, oca->root_tree_bytenr, flags);
 	if (ret && !(flags & __OPEN_CTREE_RETURN_CHUNK_ROOT) &&
 	    !fs_info->ignore_chunk_tree_error)
 		goto out_chunk;
@@ -1608,7 +1608,7 @@  out:
 	return NULL;
 }
 
-struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_flags *ocf)
+struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_args *oca)
 {
 	int fp;
 	int ret;
@@ -1616,28 +1616,28 @@  struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_flags *ocf)
 	int oflags = O_RDWR;
 	struct stat st;
 
-	ret = stat(ocf->filename, &st);
+	ret = stat(oca->filename, &st);
 	if (ret < 0) {
-		error("cannot stat '%s': %m", ocf->filename);
+		error("cannot stat '%s': %m", oca->filename);
 		return NULL;
 	}
 	if (!(((st.st_mode & S_IFMT) == S_IFREG) || ((st.st_mode & S_IFMT) == S_IFBLK))) {
-		error("not a regular file or block device: %s", ocf->filename);
+		error("not a regular file or block device: %s", oca->filename);
 		return NULL;
 	}
 
-	if (!(ocf->flags & OPEN_CTREE_WRITES))
+	if (!(oca->flags & OPEN_CTREE_WRITES))
 		oflags = O_RDONLY;
 
-	if ((oflags & O_RDWR) && zoned_model(ocf->filename) == ZONED_HOST_MANAGED)
+	if ((oflags & O_RDWR) && zoned_model(oca->filename) == ZONED_HOST_MANAGED)
 		oflags |= O_DIRECT;
 
-	fp = open(ocf->filename, oflags);
+	fp = open(oca->filename, oflags);
 	if (fp < 0) {
-		error("cannot open '%s': %m", ocf->filename);
+		error("cannot open '%s': %m", oca->filename);
 		return NULL;
 	}
-	info = __open_ctree_fd(fp, ocf);
+	info = __open_ctree_fd(fp, oca);
 	close(fp);
 	return info;
 }
@@ -1646,14 +1646,14 @@  struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr,
 			      unsigned flags)
 {
 	struct btrfs_fs_info *info;
-	struct open_ctree_flags ocf = { 0 };
+	struct open_ctree_args oca = { 0 };
 
 	/* This flags may not return fs_info with any valid root */
 	BUG_ON(flags & OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR);
-	ocf.filename = filename;
-	ocf.sb_bytenr = sb_bytenr;
-	ocf.flags = flags;
-	info = open_ctree_fs_info(&ocf);
+	oca.filename = filename;
+	oca.sb_bytenr = sb_bytenr;
+	oca.flags = flags;
+	info = open_ctree_fs_info(&oca);
 	if (!info)
 		return NULL;
 	if (flags & __OPEN_CTREE_RETURN_CHUNK_ROOT)
@@ -1665,7 +1665,7 @@  struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
 				 unsigned flags)
 {
 	struct btrfs_fs_info *info;
-	struct open_ctree_flags ocf = { 0 };
+	struct open_ctree_args oca = { 0 };
 
 	/* This flags may not return fs_info with any valid root */
 	if (flags & OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR) {
@@ -1673,10 +1673,10 @@  struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
 				(unsigned long long)flags);
 		return NULL;
 	}
-	ocf.filename = path;
-	ocf.sb_bytenr = sb_bytenr;
-	ocf.flags = flags;
-	info = __open_ctree_fd(fp, &ocf);
+	oca.filename = path;
+	oca.sb_bytenr = sb_bytenr;
+	oca.flags = flags;
+	info = __open_ctree_fd(fp, &oca);
 	if (!info)
 		return NULL;
 	if (flags & __OPEN_CTREE_RETURN_CHUNK_ROOT)
diff --git a/kernel-shared/disk-io.h b/kernel-shared/disk-io.h
index 3a31667967cc..424b953e0363 100644
--- a/kernel-shared/disk-io.h
+++ b/kernel-shared/disk-io.h
@@ -175,7 +175,7 @@  struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr,
 			      unsigned flags);
 struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
 				 unsigned flags);
-struct open_ctree_flags {
+struct open_ctree_args {
 	const char *filename;
 	u64 sb_bytenr;
 	u64 root_tree_bytenr;
@@ -183,7 +183,7 @@  struct open_ctree_flags {
 	unsigned flags;
 };
 
-struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_flags *ocf);
+struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_args *oca);
 int close_ctree_fs_info(struct btrfs_fs_info *fs_info);
 static inline int close_ctree(struct btrfs_root *root)
 {
diff --git a/mkfs/main.c b/mkfs/main.c
index 7acd39ec6531..972ed1112ea6 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -990,7 +990,7 @@  int BOX_MAIN(mkfs)(int argc, char **argv)
 	struct btrfs_root *root;
 	struct btrfs_fs_info *fs_info;
 	struct btrfs_trans_handle *trans;
-	struct open_ctree_flags ocf = { 0 };
+	struct open_ctree_args oca = { 0 };
 	int ret = 0;
 	int close_ret;
 	int i;
@@ -1569,9 +1569,9 @@  int BOX_MAIN(mkfs)(int argc, char **argv)
 		goto error;
 	}
 
-	ocf.filename = file;
-	ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER;
-	fs_info = open_ctree_fs_info(&ocf);
+	oca.filename = file;
+	oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER;
+	fs_info = open_ctree_fs_info(&oca);
 	if (!fs_info) {
 		error("open ctree failed");
 		goto error;