Lines Matching refs:fs_devices

281 static void free_fs_devices(struct btrfs_fs_devices *fs_devices)  in free_fs_devices()  argument
284 WARN_ON(fs_devices->opened); in free_fs_devices()
285 while (!list_empty(&fs_devices->devices)) { in free_fs_devices()
286 device = list_entry(fs_devices->devices.next, in free_fs_devices()
291 kfree(fs_devices); in free_fs_devices()
309 struct btrfs_fs_devices *fs_devices; in btrfs_cleanup_fs_uuids() local
312 fs_devices = list_entry(fs_uuids.next, in btrfs_cleanup_fs_uuids()
314 list_del(&fs_devices->fs_list); in btrfs_cleanup_fs_uuids()
315 free_fs_devices(fs_devices); in btrfs_cleanup_fs_uuids()
359 struct btrfs_fs_devices *fs_devices; in find_fsid() local
361 list_for_each_entry(fs_devices, &fs_uuids, fs_list) { in find_fsid()
362 if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0) in find_fsid()
363 return fs_devices; in find_fsid()
551 fs_info->fs_devices->open_devices > 1) { in run_scheduled_bios()
622 struct btrfs_fs_devices *fs_devices, *tmp_fs_devices; in btrfs_free_stale_devices() local
625 list_for_each_entry_safe(fs_devices, tmp_fs_devices, &fs_uuids, fs_list) { in btrfs_free_stale_devices()
626 mutex_lock(&fs_devices->device_list_mutex); in btrfs_free_stale_devices()
627 if (fs_devices->opened) { in btrfs_free_stale_devices()
628 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_free_stale_devices()
633 &fs_devices->devices, dev_list) { in btrfs_free_stale_devices()
650 fs_devices->num_devices--; in btrfs_free_stale_devices()
654 if (fs_devices->num_devices == 0) in btrfs_free_stale_devices()
657 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_free_stale_devices()
658 if (fs_devices->num_devices == 0) { in btrfs_free_stale_devices()
659 btrfs_sysfs_remove_fsid(fs_devices); in btrfs_free_stale_devices()
660 list_del(&fs_devices->fs_list); in btrfs_free_stale_devices()
661 free_fs_devices(fs_devices); in btrfs_free_stale_devices()
671 static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices, in btrfs_open_one_device() argument
704 fs_devices->seeding = 1; in btrfs_open_one_device()
714 fs_devices->rotating = 1; in btrfs_open_one_device()
720 fs_devices->open_devices++; in btrfs_open_one_device()
723 fs_devices->rw_devices++; in btrfs_open_one_device()
724 list_add_tail(&device->dev_alloc_list, &fs_devices->alloc_list); in btrfs_open_one_device()
749 struct btrfs_fs_devices *fs_devices; in device_list_add() local
754 fs_devices = find_fsid(disk_super->fsid); in device_list_add()
755 if (!fs_devices) { in device_list_add()
756 fs_devices = alloc_fs_devices(disk_super->fsid); in device_list_add()
757 if (IS_ERR(fs_devices)) in device_list_add()
758 return ERR_CAST(fs_devices); in device_list_add()
760 mutex_lock(&fs_devices->device_list_mutex); in device_list_add()
761 list_add(&fs_devices->fs_list, &fs_uuids); in device_list_add()
765 mutex_lock(&fs_devices->device_list_mutex); in device_list_add()
766 device = btrfs_find_device(fs_devices, devid, in device_list_add()
771 if (fs_devices->opened) { in device_list_add()
772 mutex_unlock(&fs_devices->device_list_mutex); in device_list_add()
779 mutex_unlock(&fs_devices->device_list_mutex); in device_list_add()
787 mutex_unlock(&fs_devices->device_list_mutex); in device_list_add()
792 list_add_rcu(&device->dev_list, &fs_devices->devices); in device_list_add()
793 fs_devices->num_devices++; in device_list_add()
795 device->fs_devices = fs_devices; in device_list_add()
832 if (!fs_devices->opened && found_transid < device->generation) { in device_list_add()
840 mutex_unlock(&fs_devices->device_list_mutex); in device_list_add()
853 mutex_unlock(&fs_devices->device_list_mutex); in device_list_add()
859 mutex_unlock(&fs_devices->device_list_mutex); in device_list_add()
883 mutex_unlock(&fs_devices->device_list_mutex); in device_list_add()
889 fs_devices->missing_devices--; in device_list_add()
900 if (!fs_devices->opened) in device_list_add()
903 fs_devices->total_devices = btrfs_super_num_devices(disk_super); in device_list_add()
905 mutex_unlock(&fs_devices->device_list_mutex); in device_list_add()
911 struct btrfs_fs_devices *fs_devices; in clone_fs_devices() local
915 fs_devices = alloc_fs_devices(orig->fsid); in clone_fs_devices()
916 if (IS_ERR(fs_devices)) in clone_fs_devices()
917 return fs_devices; in clone_fs_devices()
920 fs_devices->total_devices = orig->total_devices; in clone_fs_devices()
945 list_add(&device->dev_list, &fs_devices->devices); in clone_fs_devices()
946 device->fs_devices = fs_devices; in clone_fs_devices()
947 fs_devices->num_devices++; in clone_fs_devices()
950 return fs_devices; in clone_fs_devices()
953 free_fs_devices(fs_devices); in clone_fs_devices()
961 void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices, int step) in btrfs_free_extra_devids() argument
969 list_for_each_entry_safe(device, next, &fs_devices->devices, dev_list) { in btrfs_free_extra_devids()
993 fs_devices->open_devices--; in btrfs_free_extra_devids()
998 fs_devices->rw_devices--; in btrfs_free_extra_devids()
1001 fs_devices->num_devices--; in btrfs_free_extra_devids()
1005 if (fs_devices->seed) { in btrfs_free_extra_devids()
1006 fs_devices = fs_devices->seed; in btrfs_free_extra_devids()
1010 fs_devices->latest_bdev = latest_dev->bdev; in btrfs_free_extra_devids()
1038 struct btrfs_fs_devices *fs_devices = device->fs_devices; in btrfs_close_one_device() local
1043 fs_devices->open_devices--; in btrfs_close_one_device()
1048 fs_devices->rw_devices--; in btrfs_close_one_device()
1056 fs_devices->missing_devices--; in btrfs_close_one_device()
1073 new_device->fs_devices = device->fs_devices; in btrfs_close_one_device()
1078 static int close_fs_devices(struct btrfs_fs_devices *fs_devices) in close_fs_devices() argument
1082 if (--fs_devices->opened > 0) in close_fs_devices()
1085 mutex_lock(&fs_devices->device_list_mutex); in close_fs_devices()
1086 list_for_each_entry_safe(device, tmp, &fs_devices->devices, dev_list) { in close_fs_devices()
1089 mutex_unlock(&fs_devices->device_list_mutex); in close_fs_devices()
1091 WARN_ON(fs_devices->open_devices); in close_fs_devices()
1092 WARN_ON(fs_devices->rw_devices); in close_fs_devices()
1093 fs_devices->opened = 0; in close_fs_devices()
1094 fs_devices->seeding = 0; in close_fs_devices()
1099 int btrfs_close_devices(struct btrfs_fs_devices *fs_devices) in btrfs_close_devices() argument
1105 ret = close_fs_devices(fs_devices); in btrfs_close_devices()
1106 if (!fs_devices->opened) { in btrfs_close_devices()
1107 seed_devices = fs_devices->seed; in btrfs_close_devices()
1108 fs_devices->seed = NULL; in btrfs_close_devices()
1113 fs_devices = seed_devices; in btrfs_close_devices()
1114 seed_devices = fs_devices->seed; in btrfs_close_devices()
1115 close_fs_devices(fs_devices); in btrfs_close_devices()
1116 free_fs_devices(fs_devices); in btrfs_close_devices()
1121 static int open_fs_devices(struct btrfs_fs_devices *fs_devices, in open_fs_devices() argument
1130 list_for_each_entry(device, &fs_devices->devices, dev_list) { in open_fs_devices()
1132 if (btrfs_open_one_device(fs_devices, device, flags, holder)) in open_fs_devices()
1139 if (fs_devices->open_devices == 0) { in open_fs_devices()
1143 fs_devices->opened = 1; in open_fs_devices()
1144 fs_devices->latest_bdev = latest_dev->bdev; in open_fs_devices()
1145 fs_devices->total_rw_bytes = 0; in open_fs_devices()
1164 int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, in btrfs_open_devices() argument
1178 if (fs_devices->opened) { in btrfs_open_devices()
1179 fs_devices->opened++; in btrfs_open_devices()
1182 list_sort(NULL, &fs_devices->devices, devid_cmp); in btrfs_open_devices()
1183 ret = open_fs_devices(fs_devices, flags, holder); in btrfs_open_devices()
1878 next_device = btrfs_find_next_active_device(fs_info->fs_devices, in btrfs_assign_next_active_device()
1886 if (fs_info->fs_devices->latest_bdev == device->bdev) in btrfs_assign_next_active_device()
1887 fs_info->fs_devices->latest_bdev = next_device->bdev; in btrfs_assign_next_active_device()
1895 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_rm_device() local
1901 num_devices = fs_devices->num_devices; in btrfs_rm_device()
1924 fs_info->fs_devices->rw_devices == 1) { in btrfs_rm_device()
1932 device->fs_devices->rw_devices--; in btrfs_rm_device()
1969 cur_devices = device->fs_devices; in btrfs_rm_device()
1970 mutex_lock(&fs_devices->device_list_mutex); in btrfs_rm_device()
1976 if (cur_devices != fs_devices) in btrfs_rm_device()
1977 fs_devices->total_devices--; in btrfs_rm_device()
1987 btrfs_sysfs_rm_device_link(fs_devices, device); in btrfs_rm_device()
1992 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_rm_device()
2006 while (fs_devices) { in btrfs_rm_device()
2007 if (fs_devices->seed == cur_devices) { in btrfs_rm_device()
2008 fs_devices->seed = cur_devices->seed; in btrfs_rm_device()
2011 fs_devices = fs_devices->seed; in btrfs_rm_device()
2026 &fs_devices->alloc_list); in btrfs_rm_device()
2027 device->fs_devices->rw_devices++; in btrfs_rm_device()
2035 struct btrfs_fs_devices *fs_devices; in btrfs_rm_dev_replace_remove_srcdev() local
2037 lockdep_assert_held(&srcdev->fs_info->fs_devices->device_list_mutex); in btrfs_rm_dev_replace_remove_srcdev()
2045 fs_devices = srcdev->fs_devices; in btrfs_rm_dev_replace_remove_srcdev()
2049 fs_devices->num_devices--; in btrfs_rm_dev_replace_remove_srcdev()
2051 fs_devices->missing_devices--; in btrfs_rm_dev_replace_remove_srcdev()
2054 fs_devices->rw_devices--; in btrfs_rm_dev_replace_remove_srcdev()
2057 fs_devices->open_devices--; in btrfs_rm_dev_replace_remove_srcdev()
2063 struct btrfs_fs_devices *fs_devices = srcdev->fs_devices; in btrfs_rm_dev_replace_free_srcdev() local
2074 if (!fs_devices->num_devices) { in btrfs_rm_dev_replace_free_srcdev()
2083 ASSERT(fs_devices->seeding); in btrfs_rm_dev_replace_free_srcdev()
2085 tmp_fs_devices = fs_info->fs_devices; in btrfs_rm_dev_replace_free_srcdev()
2087 if (tmp_fs_devices->seed == fs_devices) { in btrfs_rm_dev_replace_free_srcdev()
2088 tmp_fs_devices->seed = fs_devices->seed; in btrfs_rm_dev_replace_free_srcdev()
2093 fs_devices->seed = NULL; in btrfs_rm_dev_replace_free_srcdev()
2094 close_fs_devices(fs_devices); in btrfs_rm_dev_replace_free_srcdev()
2095 free_fs_devices(fs_devices); in btrfs_rm_dev_replace_free_srcdev()
2101 struct btrfs_fs_devices *fs_devices = tgtdev->fs_info->fs_devices; in btrfs_destroy_dev_replace_tgtdev() local
2104 mutex_lock(&fs_devices->device_list_mutex); in btrfs_destroy_dev_replace_tgtdev()
2106 btrfs_sysfs_rm_device_link(fs_devices, tgtdev); in btrfs_destroy_dev_replace_tgtdev()
2109 fs_devices->open_devices--; in btrfs_destroy_dev_replace_tgtdev()
2111 fs_devices->num_devices--; in btrfs_destroy_dev_replace_tgtdev()
2117 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_destroy_dev_replace_tgtdev()
2151 *device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid, in btrfs_find_device_by_path()
2169 devices = &fs_info->fs_devices->devices; in btrfs_find_device_missing_or_by_path()
2198 *device = btrfs_find_device(fs_info->fs_devices, devid, in btrfs_find_device_by_devspec()
2217 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_prepare_sprout() local
2225 if (!fs_devices->seeding) in btrfs_prepare_sprout()
2232 old_devices = clone_fs_devices(fs_devices); in btrfs_prepare_sprout()
2240 memcpy(seed_devices, fs_devices, sizeof(*seed_devices)); in btrfs_prepare_sprout()
2246 mutex_lock(&fs_devices->device_list_mutex); in btrfs_prepare_sprout()
2247 list_splice_init_rcu(&fs_devices->devices, &seed_devices->devices, in btrfs_prepare_sprout()
2250 device->fs_devices = seed_devices; in btrfs_prepare_sprout()
2253 list_splice_init(&fs_devices->alloc_list, &seed_devices->alloc_list); in btrfs_prepare_sprout()
2256 fs_devices->seeding = 0; in btrfs_prepare_sprout()
2257 fs_devices->num_devices = 0; in btrfs_prepare_sprout()
2258 fs_devices->open_devices = 0; in btrfs_prepare_sprout()
2259 fs_devices->missing_devices = 0; in btrfs_prepare_sprout()
2260 fs_devices->rotating = 0; in btrfs_prepare_sprout()
2261 fs_devices->seed = seed_devices; in btrfs_prepare_sprout()
2263 generate_random_uuid(fs_devices->fsid); in btrfs_prepare_sprout()
2264 memcpy(fs_info->fsid, fs_devices->fsid, BTRFS_FSID_SIZE); in btrfs_prepare_sprout()
2265 memcpy(disk_super->fsid, fs_devices->fsid, BTRFS_FSID_SIZE); in btrfs_prepare_sprout()
2266 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_prepare_sprout()
2331 device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid, in btrfs_finish_sprout()
2335 if (device->fs_devices->seeding) { in btrfs_finish_sprout()
2359 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_init_new_device() local
2366 if (sb_rdonly(sb) && !fs_devices->seeding) in btrfs_init_new_device()
2374 if (fs_devices->seeding) { in btrfs_init_new_device()
2382 mutex_lock(&fs_devices->device_list_mutex); in btrfs_init_new_device()
2383 list_for_each_entry(device, &fs_devices->devices, dev_list) { in btrfs_init_new_device()
2387 &fs_devices->device_list_mutex); in btrfs_init_new_device()
2391 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_init_new_device()
2440 device->fs_devices = fs_devices; in btrfs_init_new_device()
2442 mutex_lock(&fs_devices->device_list_mutex); in btrfs_init_new_device()
2444 list_add_rcu(&device->dev_list, &fs_devices->devices); in btrfs_init_new_device()
2445 list_add(&device->dev_alloc_list, &fs_devices->alloc_list); in btrfs_init_new_device()
2446 fs_devices->num_devices++; in btrfs_init_new_device()
2447 fs_devices->open_devices++; in btrfs_init_new_device()
2448 fs_devices->rw_devices++; in btrfs_init_new_device()
2449 fs_devices->total_devices++; in btrfs_init_new_device()
2450 fs_devices->total_rw_bytes += device->total_bytes; in btrfs_init_new_device()
2455 fs_devices->rotating = 1; in btrfs_init_new_device()
2475 btrfs_sysfs_add_device_link(fs_devices, device); in btrfs_init_new_device()
2477 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_init_new_device()
2509 if (kobject_rename(&fs_devices->fsid_kobj, fsid_buf)) in btrfs_init_new_device()
2544 btrfs_sysfs_rm_device_link(fs_devices, device); in btrfs_init_new_device()
2545 mutex_lock(&fs_info->fs_devices->device_list_mutex); in btrfs_init_new_device()
2549 fs_info->fs_devices->num_devices--; in btrfs_init_new_device()
2550 fs_info->fs_devices->open_devices--; in btrfs_init_new_device()
2551 fs_info->fs_devices->rw_devices--; in btrfs_init_new_device()
2552 fs_info->fs_devices->total_devices--; in btrfs_init_new_device()
2553 fs_info->fs_devices->total_rw_bytes -= device->total_bytes; in btrfs_init_new_device()
2560 mutex_unlock(&fs_info->fs_devices->device_list_mutex); in btrfs_init_new_device()
2628 struct btrfs_fs_devices *fs_devices; in btrfs_grow_device() local
2647 fs_devices = fs_info->fs_devices; in btrfs_grow_device()
2651 device->fs_devices->total_rw_bytes += diff; in btrfs_grow_device()
2658 &fs_devices->resized_devices); in btrfs_grow_device()
2782 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_remove_chunk() local
2804 mutex_lock(&fs_devices->device_list_mutex); in btrfs_remove_chunk()
2811 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_remove_chunk()
2828 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_remove_chunk()
2834 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_remove_chunk()
3491 devices = &fs_info->fs_devices->devices; in __btrfs_balance()
3781 num_devices = fs_info->fs_devices->num_devices; in btrfs_balance()
4410 device->fs_devices->total_rw_bytes -= diff; in btrfs_shrink_device()
4531 &fs_info->fs_devices->resized_devices); in btrfs_shrink_device()
4552 device->fs_devices->total_rw_bytes += diff; in btrfs_shrink_device()
4619 struct btrfs_fs_devices *fs_devices = info->fs_devices; in __btrfs_alloc_chunk() local
4647 if (list_empty(&fs_devices->alloc_list)) { in __btrfs_alloc_chunk()
4669 if (fs_devices->total_rw_bytes > 50ULL * SZ_1G) in __btrfs_alloc_chunk()
4688 max_chunk_size = min(div_factor(fs_devices->total_rw_bytes, 1), in __btrfs_alloc_chunk()
4691 devices_info = kcalloc(fs_devices->rw_devices, sizeof(*devices_info), in __btrfs_alloc_chunk()
4701 list_for_each_entry(device, &fs_devices->alloc_list, dev_alloc_list) { in __btrfs_alloc_chunk()
4743 if (ndevs == fs_devices->rw_devices) { in __btrfs_alloc_chunk()
4745 __func__, fs_devices->rw_devices); in __btrfs_alloc_chunk()
4943 mutex_lock(&fs_info->fs_devices->device_list_mutex); in btrfs_finish_chunk_alloc()
4957 mutex_unlock(&fs_info->fs_devices->device_list_mutex); in btrfs_finish_chunk_alloc()
4971 mutex_unlock(&fs_info->fs_devices->device_list_mutex); in btrfs_finish_chunk_alloc()
6267 struct btrfs_device *btrfs_find_device(struct btrfs_fs_devices *fs_devices, in btrfs_find_device() argument
6273 while (fs_devices) { in btrfs_find_device()
6275 !memcmp(fs_devices->fsid, fsid, BTRFS_FSID_SIZE)) { in btrfs_find_device()
6276 list_for_each_entry(device, &fs_devices->devices, in btrfs_find_device()
6285 fs_devices = fs_devices->seed; in btrfs_find_device()
6292 static struct btrfs_device *add_missing_dev(struct btrfs_fs_devices *fs_devices, in add_missing_dev() argument
6310 list_add(&device->dev_list, &fs_devices->devices); in add_missing_dev()
6311 device->fs_devices = fs_devices; in add_missing_dev()
6312 fs_devices->num_devices++; in add_missing_dev()
6315 fs_devices->missing_devices++; in add_missing_dev()
6454 map->stripes[i].dev = btrfs_find_device(fs_info->fs_devices, in read_one_chunk()
6464 add_missing_dev(fs_info->fs_devices, devid, in read_one_chunk()
6519 struct btrfs_fs_devices *fs_devices; in open_seed_devices() local
6525 fs_devices = fs_info->fs_devices->seed; in open_seed_devices()
6526 while (fs_devices) { in open_seed_devices()
6527 if (!memcmp(fs_devices->fsid, fsid, BTRFS_FSID_SIZE)) in open_seed_devices()
6528 return fs_devices; in open_seed_devices()
6530 fs_devices = fs_devices->seed; in open_seed_devices()
6533 fs_devices = find_fsid(fsid); in open_seed_devices()
6534 if (!fs_devices) { in open_seed_devices()
6538 fs_devices = alloc_fs_devices(fsid); in open_seed_devices()
6539 if (IS_ERR(fs_devices)) in open_seed_devices()
6540 return fs_devices; in open_seed_devices()
6542 fs_devices->seeding = 1; in open_seed_devices()
6543 fs_devices->opened = 1; in open_seed_devices()
6544 return fs_devices; in open_seed_devices()
6547 fs_devices = clone_fs_devices(fs_devices); in open_seed_devices()
6548 if (IS_ERR(fs_devices)) in open_seed_devices()
6549 return fs_devices; in open_seed_devices()
6551 ret = open_fs_devices(fs_devices, FMODE_READ, fs_info->bdev_holder); in open_seed_devices()
6553 free_fs_devices(fs_devices); in open_seed_devices()
6554 fs_devices = ERR_PTR(ret); in open_seed_devices()
6558 if (!fs_devices->seeding) { in open_seed_devices()
6559 close_fs_devices(fs_devices); in open_seed_devices()
6560 free_fs_devices(fs_devices); in open_seed_devices()
6561 fs_devices = ERR_PTR(-EINVAL); in open_seed_devices()
6565 fs_devices->seed = fs_info->fs_devices->seed; in open_seed_devices()
6566 fs_info->fs_devices->seed = fs_devices; in open_seed_devices()
6568 return fs_devices; in open_seed_devices()
6575 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in read_one_dev() local
6589 fs_devices = open_seed_devices(fs_info, fs_uuid); in read_one_dev()
6590 if (IS_ERR(fs_devices)) in read_one_dev()
6591 return PTR_ERR(fs_devices); in read_one_dev()
6594 device = btrfs_find_device(fs_info->fs_devices, devid, dev_uuid, in read_one_dev()
6603 device = add_missing_dev(fs_devices, devid, dev_uuid); in read_one_dev()
6630 device->fs_devices->missing_devices++; in read_one_dev()
6635 if (device->fs_devices != fs_devices) { in read_one_dev()
6639 list_move(&device->dev_list, &fs_devices->devices); in read_one_dev()
6640 device->fs_devices->num_devices--; in read_one_dev()
6641 fs_devices->num_devices++; in read_one_dev()
6643 device->fs_devices->missing_devices--; in read_one_dev()
6644 fs_devices->missing_devices++; in read_one_dev()
6646 device->fs_devices = fs_devices; in read_one_dev()
6650 if (device->fs_devices != fs_info->fs_devices) { in read_one_dev()
6661 device->fs_devices->total_rw_bytes += device->total_bytes; in read_one_dev()
6882 fs_info->fs_devices->total_rw_bytes = 0; in btrfs_read_chunk_tree()
6930 if (total_dev != fs_info->fs_devices->total_devices) { in btrfs_read_chunk_tree()
6935 fs_info->fs_devices->total_devices = total_dev; in btrfs_read_chunk_tree()
6939 fs_info->fs_devices->total_rw_bytes) { in btrfs_read_chunk_tree()
6943 fs_info->fs_devices->total_rw_bytes); in btrfs_read_chunk_tree()
6958 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_init_devices_late() local
6961 while (fs_devices) { in btrfs_init_devices_late()
6962 mutex_lock(&fs_devices->device_list_mutex); in btrfs_init_devices_late()
6963 list_for_each_entry(device, &fs_devices->devices, dev_list) in btrfs_init_devices_late()
6965 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_init_devices_late()
6967 fs_devices = fs_devices->seed; in btrfs_init_devices_late()
6984 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_init_dev_stats() local
6998 mutex_lock(&fs_devices->device_list_mutex); in btrfs_init_dev_stats()
6999 list_for_each_entry(device, &fs_devices->devices, dev_list) { in btrfs_init_dev_stats()
7033 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_init_dev_stats()
7111 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_run_dev_stats() local
7116 mutex_lock(&fs_devices->device_list_mutex); in btrfs_run_dev_stats()
7117 list_for_each_entry(device, &fs_devices->devices, dev_list) { in btrfs_run_dev_stats()
7140 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_run_dev_stats()
7189 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_get_dev_stats() local
7192 mutex_lock(&fs_devices->device_list_mutex); in btrfs_get_dev_stats()
7193 dev = btrfs_find_device(fs_info->fs_devices, stats->devid, in btrfs_get_dev_stats()
7195 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_get_dev_stats()
7259 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_update_commit_device_size() local
7262 if (list_empty(&fs_devices->resized_devices)) in btrfs_update_commit_device_size()
7265 mutex_lock(&fs_devices->device_list_mutex); in btrfs_update_commit_device_size()
7267 list_for_each_entry_safe(curr, next, &fs_devices->resized_devices, in btrfs_update_commit_device_size()
7273 mutex_unlock(&fs_devices->device_list_mutex); in btrfs_update_commit_device_size()
7304 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_set_fs_info_ptr() local
7305 while (fs_devices) { in btrfs_set_fs_info_ptr()
7306 fs_devices->fs_info = fs_info; in btrfs_set_fs_info_ptr()
7307 fs_devices = fs_devices->seed; in btrfs_set_fs_info_ptr()
7313 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; in btrfs_reset_fs_info_ptr() local
7314 while (fs_devices) { in btrfs_reset_fs_info_ptr()
7315 fs_devices->fs_info = NULL; in btrfs_reset_fs_info_ptr()
7316 fs_devices = fs_devices->seed; in btrfs_reset_fs_info_ptr()
7411 dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true); in verify_one_dev_extent()
7420 dev = btrfs_find_device(fs_info->fs_devices->seed, devid, in verify_one_dev_extent()