From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 04/16] btrfs-progs: rename set_metadata_uuid new_fsid to fsid
Date: Mon, 14 Aug 2023 23:28:00 +0800 [thread overview]
Message-ID: <ada69ed5f097b75732cc371412ed8567b4a6057e.1692018849.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1692018849.git.anand.jain@oracle.com>
The %new_fsid is not only new it can be the fsid from the passed disk
so just rename it to %fsid. Also, in the next patch the %new_fsid will
be a bool variable to indicate if the %fsid is new from the fsid in the
disk.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
tune/change-metadata-uuid.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tune/change-metadata-uuid.c b/tune/change-metadata-uuid.c
index f356de8b57ce..0e5760194b54 100644
--- a/tune/change-metadata-uuid.c
+++ b/tune/change-metadata-uuid.c
@@ -27,7 +27,7 @@
int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string)
{
struct btrfs_super_block *disk_super;
- uuid_t new_fsid, unused1, unused2;
+ uuid_t fsid, unused1, unused2;
struct btrfs_trans_handle *trans;
bool new_uuid = true;
u64 incompat_flags;
@@ -51,11 +51,11 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string)
}
if (new_fsid_string)
- uuid_parse(new_fsid_string, new_fsid);
+ uuid_parse(new_fsid_string, fsid);
else
- uuid_generate(new_fsid);
+ uuid_generate(fsid);
- new_uuid = (memcmp(new_fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0);
+ new_uuid = (memcmp(fsid, disk_super->fsid, BTRFS_FSID_SIZE) != 0);
/* Step 1 sets the in progress flag */
trans = btrfs_start_transaction(root, 1);
@@ -66,23 +66,23 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string)
return ret;
if (new_uuid && uuid_changed && memcmp(disk_super->metadata_uuid,
- new_fsid, BTRFS_FSID_SIZE) == 0) {
+ fsid, BTRFS_FSID_SIZE) == 0) {
/*
* Changing fsid to be the same as metadata uuid, so just
* disable the flag
*/
- memcpy(disk_super->fsid, &new_fsid, BTRFS_FSID_SIZE);
+ memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE);
incompat_flags &= ~BTRFS_FEATURE_INCOMPAT_METADATA_UUID;
btrfs_set_super_incompat_flags(disk_super, incompat_flags);
memset(disk_super->metadata_uuid, 0, BTRFS_FSID_SIZE);
} else if (new_uuid && uuid_changed && memcmp(disk_super->metadata_uuid,
- new_fsid, BTRFS_FSID_SIZE)) {
+ fsid, BTRFS_FSID_SIZE)) {
/*
* Changing fsid on an already changed FS, in this case we
* only change the fsid and don't touch metadata uuid as it
* has already the correct value
*/
- memcpy(disk_super->fsid, &new_fsid, BTRFS_FSID_SIZE);
+ memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE);
} else if (new_uuid && !uuid_changed) {
/*
* First time changing the fsid, copy the fsid to metadata_uuid
@@ -91,7 +91,7 @@ int set_metadata_uuid(struct btrfs_root *root, const char *new_fsid_string)
btrfs_set_super_incompat_flags(disk_super, incompat_flags);
memcpy(disk_super->metadata_uuid, disk_super->fsid,
BTRFS_FSID_SIZE);
- memcpy(disk_super->fsid, &new_fsid, BTRFS_FSID_SIZE);
+ memcpy(disk_super->fsid, &fsid, BTRFS_FSID_SIZE);
} else {
/* Setting the same fsid as current, do nothing */
return 0;
--
2.39.3
next prev parent reply other threads:[~2023-08-14 15:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 15:27 [PATCH 00/16] btrfs-progs: recover from failed metadata_uuid Anand Jain
2023-08-14 15:27 ` [PATCH 01/16] btrfs-progs: track num_devices per fs_devices Anand Jain
2023-08-14 15:27 ` [PATCH 02/16] btrfs-progs: tune can use local fs_info variable Anand Jain
2023-08-14 15:27 ` [PATCH 03/16] btrfs-progs: rename set_metadata_uuid arg to new_fsid_str Anand Jain
2023-08-14 15:28 ` Anand Jain [this message]
2023-08-14 15:28 ` [PATCH 05/16] btrfs-progs: rename set_metadata_uuid new_uuid to new_fsid Anand Jain
2023-08-14 15:28 ` [PATCH 06/16] btrfs-progs: rename set_metadata_uuid uuid_changed to fsid_changed Anand Jain
2023-08-14 15:28 ` [PATCH 07/16] btrfs-progs: pass fsid in check_unfinished_fsid_change arg2 Anand Jain
2023-08-14 15:28 ` [PATCH 08/16] btrfs-progs: pass metadata_uuid in check_unfinished_fsid_change arg3 Anand Jain
2023-08-14 15:28 ` [PATCH 09/16] btrfs-progs: fix return without flag reset commit in tune Anand Jain
2023-08-14 15:28 ` [PATCH 10/16] btrfs-progs: preparing the latest device's superblock for commit Anand Jain
2023-08-14 15:28 ` [PATCH 11/16] btrfs-progs: rename fs_devices::list to match the kernel Anand Jain
2023-08-14 15:28 ` [PATCH 12/16] btrfs-progs: rename fs_devices::latest_trans " Anand Jain
2023-08-14 15:28 ` [PATCH 13/16] btrfs-progs: tune use the latest bdev in fs_devices for super_copy Anand Jain
2023-08-14 15:28 ` [PATCH 14/16] btrfs-progs: add support to fix superblock with CHANGING_FSID_V2 flag Anand Jain
2023-08-14 15:28 ` [PATCH 15/16] btrfs-progs: recover from the failed btrfstune -m|M Anand Jain
2023-08-14 15:28 ` [PATCH 16/16] btrfs-progs: test btrfstune -m|M ability to fix previous failures Anand Jain
2023-08-23 20:10 ` David Sterba
2023-08-24 14:00 ` Anand Jain
2023-08-23 22:13 ` [PATCH 00/16] btrfs-progs: recover from failed metadata_uuid David Sterba
2023-08-23 22:24 ` David Sterba
2023-08-24 13:54 ` Anand Jain
2023-08-25 11:53 ` David Sterba
2023-08-25 14:57 ` 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=ada69ed5f097b75732cc371412ed8567b4a6057e.1692018849.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).