aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4cbb00af92ff..62176ad89846 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -157,6 +157,7 @@ static struct btrfs_lockdep_keyset {
157 { .id = BTRFS_TREE_LOG_OBJECTID, .name_stem = "log" }, 157 { .id = BTRFS_TREE_LOG_OBJECTID, .name_stem = "log" },
158 { .id = BTRFS_TREE_RELOC_OBJECTID, .name_stem = "treloc" }, 158 { .id = BTRFS_TREE_RELOC_OBJECTID, .name_stem = "treloc" },
159 { .id = BTRFS_DATA_RELOC_TREE_OBJECTID, .name_stem = "dreloc" }, 159 { .id = BTRFS_DATA_RELOC_TREE_OBJECTID, .name_stem = "dreloc" },
160 { .id = BTRFS_UUID_TREE_OBJECTID, .name_stem = "uuid" },
160 { .id = 0, .name_stem = "tree" }, 161 { .id = 0, .name_stem = "tree" },
161}; 162};
162 163
@@ -1560,8 +1561,9 @@ int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
1560 return ret; 1561 return ret;
1561} 1562}
1562 1563
1563struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, 1564struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
1564 struct btrfs_key *location) 1565 struct btrfs_key *location,
1566 bool check_ref)
1565{ 1567{
1566 struct btrfs_root *root; 1568 struct btrfs_root *root;
1567 int ret; 1569 int ret;
@@ -1585,7 +1587,7 @@ struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
1585again: 1587again:
1586 root = btrfs_lookup_fs_root(fs_info, location->objectid); 1588 root = btrfs_lookup_fs_root(fs_info, location->objectid);
1587 if (root) { 1589 if (root) {
1588 if (btrfs_root_refs(&root->root_item) == 0) 1590 if (check_ref && btrfs_root_refs(&root->root_item) == 0)
1589 return ERR_PTR(-ENOENT); 1591 return ERR_PTR(-ENOENT);
1590 return root; 1592 return root;
1591 } 1593 }
@@ -1594,7 +1596,7 @@ again:
1594 if (IS_ERR(root)) 1596 if (IS_ERR(root))
1595 return root; 1597 return root;
1596 1598
1597 if (btrfs_root_refs(&root->root_item) == 0) { 1599 if (check_ref && btrfs_root_refs(&root->root_item) == 0) {
1598 ret = -ENOENT; 1600 ret = -ENOENT;
1599 goto fail; 1601 goto fail;
1600 } 1602 }
@@ -3415,6 +3417,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors)
3415 if (total_errors > max_errors) { 3417 if (total_errors > max_errors) {
3416 printk(KERN_ERR "btrfs: %d errors while writing supers\n", 3418 printk(KERN_ERR "btrfs: %d errors while writing supers\n",
3417 total_errors); 3419 total_errors);
3420 mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
3418 3421
3419 /* FUA is masked off if unsupported and can't be the reason */ 3422 /* FUA is masked off if unsupported and can't be the reason */
3420 btrfs_error(root->fs_info, -EIO, 3423 btrfs_error(root->fs_info, -EIO,