}
if (device->writeable) {
- lock_chunks(root);
+ lock_chunks(root->fs_info);
list_del_init(&device->dev_alloc_list);
device->fs_devices->rw_devices--;
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
clear_super = true;
}
error_undo:
if (device->writeable) {
- lock_chunks(root);
+ lock_chunks(root->fs_info);
list_add(&device->dev_alloc_list,
&root->fs_info->fs_devices->alloc_list);
device->fs_devices->rw_devices++;
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
}
goto out;
}
list_for_each_entry(device, &seed_devices->devices, dev_list)
device->fs_devices = seed_devices;
- lock_chunks(root);
+ lock_chunks(root->fs_info);
list_splice_init(&fs_devices->alloc_list, &seed_devices->alloc_list);
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
fs_devices->seeding = 0;
fs_devices->num_devices = 0;
device->fs_devices = root->fs_info->fs_devices;
mutex_lock(&root->fs_info->fs_devices->device_list_mutex);
- lock_chunks(root);
+ lock_chunks(root->fs_info);
list_add_rcu(&device->dev_list, &root->fs_info->fs_devices->devices);
list_add(&device->dev_alloc_list,
&root->fs_info->fs_devices->alloc_list);
*/
btrfs_clear_space_info_full(root->fs_info);
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
if (seeding_dev) {
- lock_chunks(root);
+ lock_chunks(root->fs_info);
ret = init_first_rw_device(trans, root, device);
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
if (ret) {
btrfs_abort_transaction(trans, ret);
goto error_trans;
if (!device->writeable)
return -EACCES;
- lock_chunks(device->fs_info->dev_root);
+ lock_chunks(device->fs_info);
old_total = btrfs_super_total_bytes(super_copy);
diff = new_size - device->total_bytes;
if (new_size <= device->total_bytes ||
device->is_tgtdev_for_dev_replace) {
- unlock_chunks(device->fs_info->dev_root);
+ unlock_chunks(device->fs_info);
return -EINVAL;
}
if (list_empty(&device->resized_list))
list_add_tail(&device->resized_list,
&fs_devices->resized_devices);
- unlock_chunks(device->fs_info->dev_root);
+ unlock_chunks(device->fs_info);
return btrfs_update_device(trans, device);
}
u32 cur;
struct btrfs_key key;
- lock_chunks(root);
+ lock_chunks(root->fs_info);
array_size = btrfs_super_sys_array_size(super_copy);
ptr = super_copy->sys_chunk_array;
cur += len;
}
}
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
return ret;
}
return -EINVAL;
}
map = em->map_lookup;
- lock_chunks(root->fs_info->chunk_root);
+ lock_chunks(fs_info);
check_system_chunk(trans, extent_root, map->type);
- unlock_chunks(root->fs_info->chunk_root);
+ unlock_chunks(fs_info);
/*
* Take the device list mutex to prevent races with the final phase of
}
if (device->bytes_used > 0) {
- lock_chunks(root);
+ lock_chunks(root->fs_info);
btrfs_device_set_bytes_used(device,
device->bytes_used - dev_extent_len);
spin_lock(&root->fs_info->free_chunk_lock);
root->fs_info->free_chunk_space += dev_extent_len;
spin_unlock(&root->fs_info->free_chunk_lock);
btrfs_clear_space_info_full(root->fs_info);
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
}
if (map->stripes[i].dev) {
path->reada = READA_FORWARD;
- lock_chunks(root);
+ lock_chunks(root->fs_info);
btrfs_device_set_total_bytes(device, new_size);
if (device->writeable) {
root->fs_info->free_chunk_space -= diff;
spin_unlock(&root->fs_info->free_chunk_lock);
}
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
again:
key.objectid = device->devid;
goto done;
}
- lock_chunks(root);
+ lock_chunks(root->fs_info);
/*
* We checked in the above loop all device extents that were already in
if (contains_pending_extent(trans->transaction, device,
&start, len)) {
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
checked_pending_chunks = true;
failed = 0;
retried = false;
WARN_ON(diff > old_total);
btrfs_set_super_total_bytes(super_copy, old_total - diff);
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
/* Now btrfs_update_device() will change the on-disk size. */
ret = btrfs_update_device(trans, device);
done:
btrfs_free_path(path);
if (ret) {
- lock_chunks(root);
+ lock_chunks(root->fs_info);
btrfs_device_set_total_bytes(device, old_size);
if (device->writeable)
device->fs_devices->total_rw_bytes += diff;
spin_lock(&root->fs_info->free_chunk_lock);
root->fs_info->free_chunk_space += diff;
spin_unlock(&root->fs_info->free_chunk_lock);
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
}
return ret;
}
u32 array_size;
u8 *ptr;
- lock_chunks(root);
+ lock_chunks(root->fs_info);
array_size = btrfs_super_sys_array_size(super_copy);
if (array_size + item_size + sizeof(disk_key)
> BTRFS_SYSTEM_CHUNK_ARRAY_SIZE) {
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
return -EFBIG;
}
memcpy(ptr, chunk, item_size);
item_size += sizeof(disk_key);
btrfs_set_super_sys_array_size(super_copy, array_size + item_size);
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
return 0;
}
return -ENOMEM;
mutex_lock(&uuid_mutex);
- lock_chunks(root);
+ lock_chunks(root->fs_info);
/*
* Read all device items, and then all the chunk items. All
}
ret = 0;
error:
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
mutex_unlock(&uuid_mutex);
btrfs_free_path(path);
return;
mutex_lock(&fs_devices->device_list_mutex);
- lock_chunks(fs_info->dev_root);
+ lock_chunks(fs_info);
list_for_each_entry_safe(curr, next, &fs_devices->resized_devices,
resized_list) {
list_del_init(&curr->resized_list);
curr->commit_total_bytes = curr->disk_total_bytes;
}
- unlock_chunks(fs_info->dev_root);
+ unlock_chunks(fs_info);
mutex_unlock(&fs_devices->device_list_mutex);
}
return;
/* In order to kick the device replace finish process */
- lock_chunks(root);
+ lock_chunks(root->fs_info);
list_for_each_entry(em, &transaction->pending_chunks, list) {
map = em->map_lookup;
dev->commit_bytes_used = dev->bytes_used;
}
}
- unlock_chunks(root);
+ unlock_chunks(root->fs_info);
}
void btrfs_set_fs_info_ptr(struct btrfs_fs_info *fs_info)