summaryrefslogtreecommitdiff
path: root/disk-io.h
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-10-28 14:28:43 -0400
committerChris Mason <chris.mason@fusionio.com>2013-11-07 16:10:40 -0500
commit4735d0bb8248a3900f420cb9144e4f7969f0b44d (patch)
treefebecdd28a64d93816e63a1bf36d6864a732dcd8 /disk-io.h
parent337f86fea1d06e189f3cf234adba2567a07678bd (diff)
downloadbtrfs-progs-4735d0bb8248a3900f420cb9144e4f7969f0b44d.tar.gz
Btrfs-progs: rework open_ctree to take flags, add a new one V2
So I needed to add a flag to not try to read block groups when doing --init-extent-tree since we could hang there, but that meant adding a whole other 0/1 type flag to open_ctree_fs_info. So instead I've converted it all over to using a flags setting and added the flag that I needed. This has been tested with xfstests and make test. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'disk-io.h')
-rw-r--r--disk-io.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/disk-io.h b/disk-io.h
index b0292db..ca6af2d 100644
--- a/disk-io.h
+++ b/disk-io.h
@@ -25,6 +25,15 @@
#define BTRFS_SUPER_MIRROR_MAX 3
#define BTRFS_SUPER_MIRROR_SHIFT 12
+enum btrfs_open_ctree_flags {
+ OPEN_CTREE_WRITES = 1,
+ OPEN_CTREE_PARTIAL = 2,
+ OPEN_CTREE_BACKUP_ROOT = 4,
+ OPEN_CTREE_RECOVER_SUPER = 8,
+ OPEN_CTREE_RESTORE = 16,
+ OPEN_CTREE_NO_BLOCK_GROUPS = 32,
+};
+
static inline u64 btrfs_sb_offset(int mirror)
{
u64 start = 16 * 1024;
@@ -52,8 +61,8 @@ int clean_tree_block(struct btrfs_trans_handle *trans,
void btrfs_free_fs_info(struct btrfs_fs_info *fs_info);
struct btrfs_fs_info *btrfs_new_fs_info(int writable, u64 sb_bytenr);
int btrfs_check_fs_compatibility(struct btrfs_super_block *sb, int writable);
-int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info,
- u64 root_tree_bytenr, int partial, int backup_root);
+int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info, u64 root_tree_bytenr,
+ enum btrfs_open_ctree_flags flags);
void btrfs_release_all_roots(struct btrfs_fs_info *fs_info);
void btrfs_cleanup_all_caches(struct btrfs_fs_info *fs_info);
int btrfs_scan_fs_devices(int fd, const char *path,
@@ -61,18 +70,13 @@ int btrfs_scan_fs_devices(int fd, const char *path,
int run_ioctl);
int btrfs_setup_chunk_tree_and_device_map(struct btrfs_fs_info *fs_info);
-struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr, int writes);
+struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr,
+ enum btrfs_open_ctree_flags flags);
struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
- int writes);
-struct btrfs_fs_info *open_ctree_fs_info_restore(const char *filename,
- u64 sb_bytenr, u64 root_tree_bytenr,
- int writes, int partial);
+ enum btrfs_open_ctree_flags flags);
struct btrfs_fs_info *open_ctree_fs_info(const char *filename,
u64 sb_bytenr, u64 root_tree_bytenr,
- int writes, int partial,
- int backup_root);
-struct btrfs_root *open_ctree_with_broken_super(const char *filename,
- u64 sb_bytenr, int writes);
+ enum btrfs_open_ctree_flags flags);
int close_ctree(struct btrfs_root *root);
int write_all_supers(struct btrfs_root *root);
int write_ctree_super(struct btrfs_trans_handle *trans,