Lines Matching defs:device
33 * To copy all extents (both new and on-disk) from source device to target
34 * device, while still keeping the filesystem read-write.
42 * if replace gets canceled, sources device still contains up-to-date data.
108 "found replace target device without a valid replace item");
170 "replace without active item, run 'device scan --forget' on the target device");
184 * allow 'btrfs dev replace_cancel' if src/tgt device is
191 "cannot mount because device replace operation is ongoing and");
200 "cannot mount because device replace operation is ongoing and");
238 * Initialize a new device for device replace target from a given source dev
241 * Return 0 and new device in @device_out, otherwise return < 0
249 struct btrfs_device *device;
263 btrfs_err(fs_info, "target device %s is invalid!", device_path);
269 "dev-replace: zoned type of target device mismatch with filesystem");
276 list_for_each_entry(device, &fs_devices->devices, dev_list) {
277 if (device->bdev == bdev) {
279 "target device is in the filesystem!");
288 "target device is smaller than source device!");
294 device = btrfs_alloc_device(NULL, &devid, NULL, device_path);
295 if (IS_ERR(device)) {
296 ret = PTR_ERR(device);
300 ret = lookup_bdev(device_path, &device->devt);
304 set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
305 device->generation = 0;
306 device->io_width = fs_info->sectorsize;
307 device->io_align = fs_info->sectorsize;
308 device->sector_size = fs_info->sectorsize;
309 device->total_bytes = btrfs_device_get_total_bytes(srcdev);
310 device->disk_total_bytes = btrfs_device_get_disk_total_bytes(srcdev);
311 device->bytes_used = btrfs_device_get_bytes_used(srcdev);
312 device->commit_total_bytes = srcdev->commit_total_bytes;
313 device->commit_bytes_used = device->bytes_used;
314 device->fs_info = fs_info;
315 device->bdev = bdev;
316 set_bit(BTRFS_DEV_STATE_IN_FS_METADATA, &device->dev_state);
317 set_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state);
318 device->holder = fs_info->bdev_holder;
319 device->dev_stats_valid = 1;
320 set_blocksize(device->bdev, BTRFS_BDEV_BLOCKSIZE);
321 device->fs_devices = fs_devices;
323 ret = btrfs_get_dev_zone_info(device, false);
328 list_add(&device->dev_list, &fs_devices->devices);
333 *device_out = device;
342 * called from commit_transaction. Writes changed device replace state to
576 /* We have more device extent to copy */
589 * Has more stripes on this device. Keep this block group
595 /* Last stripe on this device */
619 "cannot replace device %s (devid %llu) due to active swapfile",
695 * groups that are allocated after we started the device replace, and
696 * must be done after setting up the device replace state.
786 * we have removed target device, it is safe to allow new bios request.
795 * When finishing the device replace, before swapping the source device with the
796 * target device we must update the chunk allocation state in the target device,
893 * chunks shouldn't be allocated on the device.
906 /* Prevent new chunks being allocated on the source device */
927 * Update allocation state in the new device and replace the old device
994 * is running, the target device is part of the filesystem, the
995 * source device is not part of the filesystem anymore and its 1st
1022 * Read progress of device replace status according to the state and last