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
Subject: [PATCH 10/16] btrfs-progs: preparing the latest device's superblock for commit
Date: Mon, 14 Aug 2023 23:28:06 +0800	[thread overview]
Message-ID: <98d2fc9f0f90b4134fe7784f5fb482c88f241599.1692018849.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1692018849.git.anand.jain@oracle.com>

This patch provides a flag to copy the superblock of the latest device to the
fs_info::super_copy for the commit process, rather than using the superblock
from the device specified in the argument.

This serves as groundwork to enable recovery from an incomplete
btrfstune -M|m|u|U operation.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 kernel-shared/disk-io.c | 3 +++
 kernel-shared/disk-io.h | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c
index 6a3178a84c88..1ef28ba33f28 100644
--- a/kernel-shared/disk-io.c
+++ b/kernel-shared/disk-io.c
@@ -1513,6 +1513,9 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_args *oca
 	if (flags & OPEN_CTREE_RECOVER_SUPER)
 		ret = btrfs_read_dev_super(fs_devices->latest_bdev, disk_super,
 				sb_bytenr, SBREAD_RECOVER);
+	else if (flags & OPEN_CTREE_USE_LATEST_BDEV)
+		ret = btrfs_read_dev_super(fs_devices->latest_bdev, disk_super,
+					   sb_bytenr, sbflags);
 	else
 		ret = btrfs_read_dev_super(fp, disk_super, sb_bytenr,
 				sbflags);
diff --git a/kernel-shared/disk-io.h b/kernel-shared/disk-io.h
index 424b953e0363..4f9ef633227d 100644
--- a/kernel-shared/disk-io.h
+++ b/kernel-shared/disk-io.h
@@ -104,6 +104,11 @@ enum btrfs_open_ctree_flags {
 	 * specific checks and only do the superficial checks.
 	 */
 	OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS	= (1U << 17),
+
+	/*
+	 * Use the superblock of the latest device for the transaction commit.
+	 */
+	OPEN_CTREE_USE_LATEST_BDEV		= (1U << 18),
 };
 
 /*
-- 
2.39.3


  parent reply	other threads:[~2023-08-14 15:30 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 ` [PATCH 04/16] btrfs-progs: rename set_metadata_uuid new_fsid to fsid Anand Jain
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 ` Anand Jain [this message]
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=98d2fc9f0f90b4134fe7784f5fb482c88f241599.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).