summaryrefslogtreecommitdiff
path: root/disk-io.c
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2018-04-11 15:29:35 +0800
committerDavid Sterba <dsterba@suse.com>2018-04-24 13:00:12 +0200
commitc57ed6ca6b1b0655bba4fff97ad10e32dba4a81d (patch)
tree5229d43bf5f8bca34d04a006e7aadbf805c364c9 /disk-io.c
parentcc66055f97ef7ecdd77b18487b5c32f8334b8c8b (diff)
btrfs-progs: Rename OPEN_CTREE_FS_PARTIAL to OPEN_CTREE_TEMPORARY_SUPER
The old flag OPEN_CTREE_FS_PARTIAL is in fact quite easy to be confused with OPEN_CTREE_PARTIAL, which allow btrfs-progs to open damaged filesystem (like corrupted extent/csum tree). However OPEN_CTREE_FS_PARTIAL, unlike its name, is just allowing btrfs-progs to open fs with temporary superblocks (which only has 6 basic trees on SINGLE meta/sys chunks). The usage of FS_PARTIAL is really confusing here. So rename OPEN_CTREE_FS_PARTIAL to OPEN_CTREE_TEMPORARY_SUPER, and add extra comment for its behavior. Also rename BTRFS_MAGIC_PARTIAL to BTRFS_MAGIC_TEMPORARY to keep the naming consistent. And with above comment, the usage of FS_PARTIAL in dump-tree is obviously incorrect, fix it. Fixes: 8698a2b9ba89 ("btrfs-progs: Allow inspect dump-tree to show specified tree block even some tree roots are corrupted") Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'disk-io.c')
-rw-r--r--disk-io.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/disk-io.c b/disk-io.c
index 310ab19c..72d44531 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -1116,14 +1116,14 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path,
fs_info->ignore_chunk_tree_error = 1;
if ((flags & OPEN_CTREE_RECOVER_SUPER)
- && (flags & OPEN_CTREE_FS_PARTIAL)) {
+ && (flags & OPEN_CTREE_TEMPORARY_SUPER)) {
fprintf(stderr,
- "cannot open a partially created filesystem for recovery");
+ "cannot open a filesystem with temporary super block for recovery");
goto out;
}
- if (flags & OPEN_CTREE_FS_PARTIAL)
- sbflags = SBREAD_PARTIAL;
+ if (flags & OPEN_CTREE_TEMPORARY_SUPER)
+ sbflags = SBREAD_TEMPORARY;
ret = btrfs_scan_fs_devices(fp, path, &fs_devices, sb_bytenr, sbflags,
(flags & OPEN_CTREE_NO_DEVICES));
@@ -1284,8 +1284,8 @@ static int check_super(struct btrfs_super_block *sb, unsigned sbflags)
int csum_size;
if (btrfs_super_magic(sb) != BTRFS_MAGIC) {
- if (btrfs_super_magic(sb) == BTRFS_MAGIC_PARTIAL) {
- if (!(sbflags & SBREAD_PARTIAL)) {
+ if (btrfs_super_magic(sb) == BTRFS_MAGIC_TEMPORARY) {
+ if (!(sbflags & SBREAD_TEMPORARY)) {
error("superblock magic doesn't match");
return -EIO;
}