From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 06/11] btrfs-progs: track changing_fsid flag in fs_devices
Date: Fri, 7 Jul 2023 23:52:36 +0800 [thread overview]
Message-ID: <8964ffba81e66712b57ac826c139ee0d8c50e75d.1688724045.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1688724045.git.anand.jain@oracle.com>
To prepare for reuniting separated devices due to an incomplete
fsid change task, consolidate and monitor the per device's
changing_fsid flag in the struct btrfs_fs_devices.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
kernel-shared/volumes.c | 9 +++++++++
kernel-shared/volumes.h | 2 ++
tune/change-uuid.c | 4 +---
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c
index 4a8c559d4b20..51b3a16a39af 100644
--- a/kernel-shared/volumes.c
+++ b/kernel-shared/volumes.c
@@ -342,6 +342,9 @@ static int device_list_add(const char *path,
u64 devid = btrfs_stack_device_id(&disk_super->dev_item);
bool metadata_uuid = (btrfs_super_incompat_flags(disk_super) &
BTRFS_FEATURE_INCOMPAT_METADATA_UUID);
+ bool changing_fsid = (btrfs_super_flags(disk_super) &
+ (BTRFS_SUPER_FLAG_CHANGING_FSID |
+ BTRFS_SUPER_FLAG_CHANGING_FSID_V2));
if (metadata_uuid)
fs_devices = find_fsid(disk_super->fsid,
@@ -424,6 +427,12 @@ static int device_list_add(const char *path,
device->name = name;
}
+ /*
+ * If changing_fsid the fs_devices will still hold the status from
+ * the other devices.
+ */
+ if (changing_fsid)
+ fs_devices->changing_fsid = true;
if (found_transid > fs_devices->latest_trans) {
fs_devices->latest_devid = devid;
diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h
index d2915681e6de..9763c677a7cc 100644
--- a/kernel-shared/volumes.h
+++ b/kernel-shared/volumes.h
@@ -99,6 +99,8 @@ struct btrfs_fs_devices {
struct btrfs_fs_devices *seed;
enum btrfs_chunk_allocation_policy chunk_alloc_policy;
+
+ bool changing_fsid;
};
struct btrfs_bio_stripe {
diff --git a/tune/change-uuid.c b/tune/change-uuid.c
index cbfc8634168b..30cfb145459f 100644
--- a/tune/change-uuid.c
+++ b/tune/change-uuid.c
@@ -214,10 +214,8 @@ int check_unfinished_fsid_change(struct btrfs_fs_info *fs_info,
uuid_t fsid_ret, uuid_t chunk_id_ret)
{
struct btrfs_root *tree_root = fs_info->tree_root;
- u64 flags = btrfs_super_flags(fs_info->super_copy);
- if (flags & (BTRFS_SUPER_FLAG_CHANGING_FSID |
- BTRFS_SUPER_FLAG_CHANGING_FSID_V2)) {
+ if (fs_info->fs_devices->changing_fsid) {
memcpy(fsid_ret, fs_info->super_copy->fsid, BTRFS_FSID_SIZE);
read_extent_buffer(tree_root->node, chunk_id_ret,
btrfs_header_chunk_tree_uuid(tree_root->node),
--
2.39.3
next prev parent reply other threads:[~2023-07-07 15:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 15:52 [PATCH 00/11] btrfs-progs: fix bugs and CHANGING_FSID_V2 flag Anand Jain
2023-07-07 15:52 ` [PATCH 01/11] btrfs-progs: fix duplicate missing device Anand Jain
2023-07-07 15:52 ` [PATCH 02/11] btrfs-progs: call warn() for " Anand Jain
2023-07-13 18:48 ` David Sterba
2023-07-17 18:22 ` Anand Jain
2023-07-19 14:34 ` Anand Jain
2023-07-07 15:52 ` [PATCH 03/11] btrfs-progs: track missing device counter Anand Jain
2023-07-07 15:52 ` [PATCH 04/11] btrfs-progs: NULL initialize device name for missing Anand Jain
2023-07-07 15:52 ` [PATCH 05/11] btrfs-progs: tune: check for missing device Anand Jain
2023-07-13 18:49 ` David Sterba
2023-07-17 19:02 ` Anand Jain
2023-07-07 15:52 ` Anand Jain [this message]
2023-07-07 15:52 ` [PATCH 07/11] btrfs-progs: track num_devices per fs_devices Anand Jain
2023-07-07 15:52 ` [PATCH 08/11] btrfs-progs: track total_devs in fs devices Anand Jain
2023-07-13 18:58 ` David Sterba
2023-07-17 19:28 ` Anand Jain
2023-07-07 15:52 ` [PATCH 09/11] btrfs-progs: track active metadata_uuid per fs_devices Anand Jain
2023-07-07 15:52 ` [PATCH 10/11] btrfs-progs: add helper to reunite devices with same metadata_uuid Anand Jain
2023-07-07 15:52 ` [PATCH 11/11] btrfs-progs: tune: fix incomplete fsid_change Anand Jain
2023-07-13 18:57 ` David Sterba
2023-07-17 19:25 ` Anand Jain
2023-07-20 14:33 ` 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=8964ffba81e66712b57ac826c139ee0d8c50e75d.1688724045.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).