summaryrefslogtreecommitdiff
path: root/disk-io.h
diff options
context:
space:
mode:
Diffstat (limited to 'disk-io.h')
-rw-r--r--disk-io.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/disk-io.h b/disk-io.h
index d3e3aaac..c2eb1d6e 100644
--- a/disk-io.h
+++ b/disk-io.h
@@ -53,7 +53,15 @@ enum btrfs_open_ctree_flags {
* Like split PARTIAL into SKIP_CSUM/SKIP_EXTENT
*/
- OPEN_CTREE_IGNORE_FSID_MISMATCH = (1 << 10)
+ OPEN_CTREE_IGNORE_FSID_MISMATCH = (1 << 10),
+
+ /*
+ * Allow open_ctree_fs_info() to return a incomplete fs_info with
+ * system chunks from super block only.
+ * 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)
};
static inline u64 btrfs_sb_offset(int mirror)
@@ -101,7 +109,13 @@ struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
struct btrfs_fs_info *open_ctree_fs_info(const char *filename,
u64 sb_bytenr, u64 root_tree_bytenr,
enum btrfs_open_ctree_flags flags);
-int close_ctree(struct btrfs_root *root);
+int close_ctree_fs_info(struct btrfs_fs_info *fs_info);
+static inline int close_ctree(struct btrfs_root *root)
+{
+ BUG_ON(!root);
+ return close_ctree_fs_info(root->fs_info);
+}
+
int write_all_supers(struct btrfs_root *root);
int write_ctree_super(struct btrfs_trans_handle *trans,
struct btrfs_root *root);