diff options
author | Eric Sandeen <sandeen@redhat.com> | 2013-04-26 16:06:05 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-08-09 14:32:28 +0200 |
commit | 14b53c07367bef243404cf9794586ccd03977f24 (patch) | |
tree | 6351e7f56a9560ff8ee8f9b384610a8bdb64181d /ctree.c | |
parent | a3e5eeb94c5ae524ca5af9b39d63f21810a173f1 (diff) |
Btrfs-progs: move btrfs_fsck_reinit_root to cmds-check.c
cmds-check.c contains the only caller of btrfs_fsck_reinit_root;
moving it to the caller's source file gets ctree.c a little
closer to kernelspace, although it does require exporting
add_root_to_dirty_list(), which is not done in kernelspace.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'ctree.c')
-rw-r--r-- | ctree.c | 49 |
1 files changed, 1 insertions, 48 deletions
@@ -67,7 +67,7 @@ void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p) memset(p, 0, sizeof(*p)); } -static void add_root_to_dirty_list(struct btrfs_root *root) +void add_root_to_dirty_list(struct btrfs_root *root) { if (root->track_dirty && list_empty(&root->dirty_list)) { list_add(&root->dirty_list, @@ -137,53 +137,6 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans, return 0; } -int btrfs_fsck_reinit_root(struct btrfs_trans_handle *trans, - struct btrfs_root *root, int overwrite) -{ - struct extent_buffer *c; - struct extent_buffer *old = root->node; - int level; - struct btrfs_disk_key disk_key = {0,0,0}; - - level = 0; - - if (overwrite) { - c = old; - extent_buffer_get(c); - goto init; - } - c = btrfs_alloc_free_block(trans, root, - btrfs_level_size(root, 0), - root->root_key.objectid, - &disk_key, level, 0, 0); - if (IS_ERR(c)) { - c = old; - extent_buffer_get(c); - } -init: - memset_extent_buffer(c, 0, 0, sizeof(struct btrfs_header)); - btrfs_set_header_level(c, level); - btrfs_set_header_bytenr(c, c->start); - btrfs_set_header_generation(c, trans->transid); - btrfs_set_header_backref_rev(c, BTRFS_MIXED_BACKREF_REV); - btrfs_set_header_owner(c, root->root_key.objectid); - - write_extent_buffer(c, root->fs_info->fsid, - (unsigned long)btrfs_header_fsid(c), - BTRFS_FSID_SIZE); - - write_extent_buffer(c, root->fs_info->chunk_tree_uuid, - (unsigned long)btrfs_header_chunk_tree_uuid(c), - BTRFS_UUID_SIZE); - - btrfs_mark_buffer_dirty(c); - - free_extent_buffer(old); - root->node = c; - add_root_to_dirty_list(root); - return 0; -} - /* * check if the tree block can be shared by multiple trees */ |