summaryrefslogtreecommitdiff
path: root/disk-io.h
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-08-22 16:32:24 +0200
committerDavid Sterba <dsterba@suse.com>2016-08-24 14:37:31 +0200
commit2ff04db5f4fbf28cf990804b4ed4ad2bd605e677 (patch)
treeceec1a34bd9f49d2ede1c8cc9d9c8dcad1d50a40 /disk-io.h
parent974cfeeebb42b4911737876241c13dd12685b412 (diff)
btrfs-progs: two staged filesystem creation
The filesystem existence on a device is manifested by the signature, during the mkfs process we write it first and then create other structures. Such filesystem is not valid and should not be registered during device scan nor listed among devices from blkid. This patch will introduce two staged creation. In the first phase, the signature is wrong, but recognized as a partially created filesystem (by open or scan helpers). Once we successfully create and write everything, we fixup the signature. At this point automated scanning should find a valid filesystem on all devices. We can also rely on the partially created filesystem to do better error handling during creation. We can just bail out and do not need to clean up. The partial signature is '!BHRfS_M', can be shown by btrfs inspect-internal dump-super -F image Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'disk-io.h')
-rw-r--r--disk-io.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/disk-io.h b/disk-io.h
index 153ef1f4..a73dede1 100644
--- a/disk-io.h
+++ b/disk-io.h
@@ -61,7 +61,10 @@ enum btrfs_open_ctree_flags {
* It's useful for chunk corruption case.
* Makes no sense for open_ctree variants returning btrfs_root.
*/
- OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR = (1 << 11)
+ OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR = (1 << 11),
+
+ /* Allow to open a partially created filesystem */
+ OPEN_CTREE_FS_PARTIAL = (1 << 12),
};
/*
@@ -71,6 +74,12 @@ enum btrfs_read_sb_flags {
SBREAD_DEFAULT = 0,
/* Reading superblock during recovery */
SBREAD_RECOVER = (1 << 0),
+
+ /*
+ * Read superblock with the fake signature, cannot be used with
+ * SBREAD_RECOVER
+ */
+ SBREAD_PARTIAL = (1 << 1),
};
static inline u64 btrfs_sb_offset(int mirror)