Commit 0403e47e authored by Yan Zheng's avatar Yan Zheng Committed by Chris Mason

Btrfs: Add checking of csum tree in balancing code

This updates the space balancing code for the
new checksum format.
Signed-off-by: default avatarYan Zheng <zheng.yan@oracle.com>
parent 459931ec
...@@ -1097,6 +1097,8 @@ struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, ...@@ -1097,6 +1097,8 @@ struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
return fs_info->chunk_root; return fs_info->chunk_root;
if (location->objectid == BTRFS_DEV_TREE_OBJECTID) if (location->objectid == BTRFS_DEV_TREE_OBJECTID)
return fs_info->dev_root; return fs_info->dev_root;
if (location->objectid == BTRFS_CSUM_TREE_OBJECTID)
return fs_info->csum_root;
root = radix_tree_lookup(&fs_info->fs_roots_radix, root = radix_tree_lookup(&fs_info->fs_roots_radix,
(unsigned long)location->objectid); (unsigned long)location->objectid);
......
...@@ -241,7 +241,7 @@ static int cache_block_group(struct btrfs_root *root, ...@@ -241,7 +241,7 @@ static int cache_block_group(struct btrfs_root *root,
* skip the locking here * skip the locking here
*/ */
path->skip_locking = 1; path->skip_locking = 1;
key.objectid = last; key.objectid = max_t(u64, last, BTRFS_SUPER_INFO_OFFSET);
key.offset = 0; key.offset = 0;
btrfs_set_key_type(&key, BTRFS_EXTENT_ITEM_KEY); btrfs_set_key_type(&key, BTRFS_EXTENT_ITEM_KEY);
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
...@@ -4087,7 +4087,8 @@ static int is_cowonly_root(u64 root_objectid) ...@@ -4087,7 +4087,8 @@ static int is_cowonly_root(u64 root_objectid)
root_objectid == BTRFS_EXTENT_TREE_OBJECTID || root_objectid == BTRFS_EXTENT_TREE_OBJECTID ||
root_objectid == BTRFS_CHUNK_TREE_OBJECTID || root_objectid == BTRFS_CHUNK_TREE_OBJECTID ||
root_objectid == BTRFS_DEV_TREE_OBJECTID || root_objectid == BTRFS_DEV_TREE_OBJECTID ||
root_objectid == BTRFS_TREE_LOG_OBJECTID) root_objectid == BTRFS_TREE_LOG_OBJECTID ||
root_objectid == BTRFS_CSUM_TREE_OBJECTID)
return 1; return 1;
return 0; return 0;
} }
...@@ -5497,8 +5498,7 @@ static int __insert_orphan_inode(struct btrfs_trans_handle *trans, ...@@ -5497,8 +5498,7 @@ static int __insert_orphan_inode(struct btrfs_trans_handle *trans,
btrfs_set_inode_generation(leaf, item, 1); btrfs_set_inode_generation(leaf, item, 1);
btrfs_set_inode_size(leaf, item, size); btrfs_set_inode_size(leaf, item, size);
btrfs_set_inode_mode(leaf, item, S_IFREG | 0600); btrfs_set_inode_mode(leaf, item, S_IFREG | 0600);
btrfs_set_inode_flags(leaf, item, BTRFS_INODE_NODATASUM | btrfs_set_inode_flags(leaf, item, BTRFS_INODE_NOCOMPRESS);
BTRFS_INODE_NOCOMPRESS);
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(root, path); btrfs_release_path(root, path);
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment