diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/disk-io.c | 9 | ||||
-rw-r--r-- | fs/btrfs/disk-io.h | 13 | ||||
-rw-r--r-- | fs/btrfs/relocation.c | 2 |
3 files changed, 17 insertions, 7 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 4ae17ed13b32..62176ad89846 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1561,8 +1561,9 @@ int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info, | |||
1561 | return ret; | 1561 | return ret; |
1562 | } | 1562 | } |
1563 | 1563 | ||
1564 | struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, | 1564 | struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info, |
1565 | struct btrfs_key *location) | 1565 | struct btrfs_key *location, |
1566 | bool check_ref) | ||
1566 | { | 1567 | { |
1567 | struct btrfs_root *root; | 1568 | struct btrfs_root *root; |
1568 | int ret; | 1569 | int ret; |
@@ -1586,7 +1587,7 @@ struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, | |||
1586 | again: | 1587 | again: |
1587 | root = btrfs_lookup_fs_root(fs_info, location->objectid); | 1588 | root = btrfs_lookup_fs_root(fs_info, location->objectid); |
1588 | if (root) { | 1589 | if (root) { |
1589 | if (btrfs_root_refs(&root->root_item) == 0) | 1590 | if (check_ref && btrfs_root_refs(&root->root_item) == 0) |
1590 | return ERR_PTR(-ENOENT); | 1591 | return ERR_PTR(-ENOENT); |
1591 | return root; | 1592 | return root; |
1592 | } | 1593 | } |
@@ -1595,7 +1596,7 @@ again: | |||
1595 | if (IS_ERR(root)) | 1596 | if (IS_ERR(root)) |
1596 | return root; | 1597 | return root; |
1597 | 1598 | ||
1598 | if (btrfs_root_refs(&root->root_item) == 0) { | 1599 | if (check_ref && btrfs_root_refs(&root->root_item) == 0) { |
1599 | ret = -ENOENT; | 1600 | ret = -ENOENT; |
1600 | goto fail; | 1601 | goto fail; |
1601 | } | 1602 | } |
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index b71acd6e1e5b..5ce2a7da8b11 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
@@ -68,8 +68,17 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_root *tree_root, | |||
68 | int btrfs_init_fs_root(struct btrfs_root *root); | 68 | int btrfs_init_fs_root(struct btrfs_root *root); |
69 | int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info, | 69 | int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info, |
70 | struct btrfs_root *root); | 70 | struct btrfs_root *root); |
71 | struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, | 71 | |
72 | struct btrfs_key *location); | 72 | struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info, |
73 | struct btrfs_key *key, | ||
74 | bool check_ref); | ||
75 | static inline struct btrfs_root * | ||
76 | btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, | ||
77 | struct btrfs_key *location) | ||
78 | { | ||
79 | return btrfs_get_fs_root(fs_info, location, true); | ||
80 | } | ||
81 | |||
73 | int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info); | 82 | int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info); |
74 | void btrfs_btree_balance_dirty(struct btrfs_root *root); | 83 | void btrfs_btree_balance_dirty(struct btrfs_root *root); |
75 | void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root); | 84 | void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root); |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index a5a26320503f..4a355726151e 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -588,7 +588,7 @@ static struct btrfs_root *read_fs_root(struct btrfs_fs_info *fs_info, | |||
588 | else | 588 | else |
589 | key.offset = (u64)-1; | 589 | key.offset = (u64)-1; |
590 | 590 | ||
591 | return btrfs_read_fs_root_no_name(fs_info, &key); | 591 | return btrfs_get_fs_root(fs_info, &key, false); |
592 | } | 592 | } |
593 | 593 | ||
594 | #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 | 594 | #ifdef BTRFS_COMPAT_EXTENT_TREE_V0 |