All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH 1/8] btrfs-progs: Allow open_ctree to ignore fsid mismatch.
Date: Tue, 5 May 2015 14:16:39 +0800	[thread overview]
Message-ID: <1430806606-3226-2-git-send-email-quwenruo@cn.fujitsu.com> (raw)
In-Reply-To: <1430806606-3226-1-git-send-email-quwenruo@cn.fujitsu.com>

This feature is used for later UUID change function.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 ctree.h   | 1 +
 disk-io.c | 5 ++++-
 disk-io.h | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ctree.h b/ctree.h
index 10dc838..45fef3d 100644
--- a/ctree.h
+++ b/ctree.h
@@ -1010,6 +1010,7 @@ struct btrfs_fs_info {
 	unsigned int is_chunk_recover:1;
 	unsigned int quota_enabled:1;
 	unsigned int suppress_check_block_errors:1;
+	unsigned int ignore_fsid:1;
 
 	int (*free_extent_hook)(struct btrfs_trans_handle *trans,
 				struct btrfs_root *root,
diff --git a/disk-io.c b/disk-io.c
index c1cf146..8a91345 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -49,7 +49,8 @@ static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
 
 	fs_devices = root->fs_info->fs_devices;
 	while (fs_devices) {
-		if (!memcmp_extent_buffer(buf, fs_devices->fsid,
+		if (root->fs_info->ignore_fsid ||
+		    !memcmp_extent_buffer(buf, fs_devices->fsid,
 					  btrfs_header_fsid(),
 					  BTRFS_FSID_SIZE)) {
 			ret = 0;
@@ -1149,6 +1150,8 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path,
 		fs_info->on_restoring = 1;
 	if (flags & OPEN_CTREE_SUPPRESS_CHECK_BLOCK_ERRORS)
 		fs_info->suppress_check_block_errors = 1;
+	if (flags & OPEN_CTREE_IGNORE_FSID)
+		fs_info->ignore_fsid = 1;
 
 	ret = btrfs_scan_fs_devices(fp, path, &fs_devices, sb_bytenr,
 				    (flags & OPEN_CTREE_RECOVER_SUPER),
diff --git a/disk-io.h b/disk-io.h
index 4caebeb..83cbe47 100644
--- a/disk-io.h
+++ b/disk-io.h
@@ -49,6 +49,9 @@ enum btrfs_open_ctree_flags {
 	 * tree bits.
 	 * Like split PARTIAL into SKIP_CSUM/SKIP_EXTENT
 	 */
+
+	/* Currently, no codes check chunk_tree_uuid, so only ignore fsid */
+	OPEN_CTREE_IGNORE_FSID		= (1 << 10)
 };
 
 static inline u64 btrfs_sb_offset(int mirror)
-- 
2.3.7


  reply	other threads:[~2015-05-05  6:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05  6:16 [PATCH 0/8] Introduce offline fsid/chunk tree uuid change for btrfstune Qu Wenruo
2015-05-05  6:16 ` Qu Wenruo [this message]
2015-05-05  6:16 ` [PATCH 2/8] btrfs-progs: Export write_tree_block() Qu Wenruo
2015-05-05  6:16 ` [PATCH 3/8] btrfs-progs: Introduce change_header_uuid() function Qu Wenruo
2015-05-05  6:16 ` [PATCH 4/8] btrfs-progs: Introduce change_extents_uuid() function Qu Wenruo
2015-05-05  6:16 ` [PATCH 5/8] btrfs-progs: Introduce function change_device_uuid() Qu Wenruo
2015-05-05  6:16 ` [PATCH 6/8] btrfs-progs: Introduce change_devices_uuid() function Qu Wenruo
2015-05-05  6:16 ` [PATCH 7/8] btrfs-progs: Introduce change_uuid() function Qu Wenruo
2015-05-05  6:16 ` [PATCH 8/8] btrfs-progs: btrfstune: Introduce new "-u" and "-U" options Qu Wenruo
2015-05-05 15:20 ` [PATCH 0/8] Introduce offline fsid/chunk tree uuid change for btrfstune David Sterba
2015-05-06  0:49   ` Qu Wenruo
2015-05-06 15:43     ` David Sterba
2015-05-08  8:57       ` Qu Wenruo
2015-05-11 16:24         ` David Sterba
2015-05-12  2:09           ` Qu Wenruo
2015-05-12  4:00             ` Anand Jain
2015-05-13  0:54               ` Qu Wenruo
2015-05-13 13:43               ` David Sterba
2015-05-15 15:42                 ` Anand Jain
2015-05-21 16:30                   ` David Sterba
2015-05-22 15:20                     ` 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=1430806606-3226-2-git-send-email-quwenruo@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.